Package org.apache.axiom.util.stax.debug
Class UnclosedReaderDetector
- java.lang.Object
-
- javax.xml.stream.XMLInputFactory
-
- org.apache.axiom.util.stax.wrapper.XMLInputFactoryWrapper
-
- org.apache.axiom.util.stax.wrapper.WrappingXMLInputFactory
-
- org.apache.axiom.util.stax.debug.UnclosedReaderDetector
-
public class UnclosedReaderDetector extends WrappingXMLInputFactory
XMLInputFactory
wrapper that enabled detection of unclosed stream readers. An unclosed reader will be detected when theXMLStreamReader
instance is finalized by the virtual machine. When this happens, a warning message will be logged. The log message contains the stack trace of the instruction that created the reader.Note that for this to work, the detector must compute the stack trace every time a reader is created. Since this may have a significant performance impact, the wrapper should only used during testing and debugging.
-
-
Field Summary
-
Fields inherited from class javax.xml.stream.XMLInputFactory
ALLOCATOR, IS_COALESCING, IS_NAMESPACE_AWARE, IS_REPLACING_ENTITY_REFERENCES, IS_SUPPORTING_EXTERNAL_ENTITIES, IS_VALIDATING, REPORTER, RESOLVER, SUPPORT_DTD
-
-
Constructor Summary
Constructors Constructor Description UnclosedReaderDetector(XMLInputFactory parent)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected XMLStreamReader
wrap(XMLStreamReader reader)
Wrap a reader created from this factory.-
Methods inherited from class org.apache.axiom.util.stax.wrapper.WrappingXMLInputFactory
createFilteredReader, createFilteredReader, createXMLEventReader, createXMLEventReader, createXMLEventReader, createXMLEventReader, createXMLEventReader, createXMLEventReader, createXMLEventReader, createXMLStreamReader, createXMLStreamReader, createXMLStreamReader, createXMLStreamReader, createXMLStreamReader, createXMLStreamReader, wrap
-
Methods inherited from class org.apache.axiom.util.stax.wrapper.XMLInputFactoryWrapper
getEventAllocator, getProperty, getXMLReporter, getXMLResolver, isPropertySupported, setEventAllocator, setProperty, setXMLReporter, setXMLResolver
-
Methods inherited from class javax.xml.stream.XMLInputFactory
newDefaultFactory, newFactory, newFactory, newInstance, newInstance
-
-
-
-
Constructor Detail
-
UnclosedReaderDetector
public UnclosedReaderDetector(XMLInputFactory parent)
Constructor.- Parameters:
parent
- the parent factory
-
-
Method Detail
-
wrap
protected XMLStreamReader wrap(XMLStreamReader reader)
Description copied from class:WrappingXMLInputFactory
Wrap a reader created from this factory. Implementations should override this method if they which to wrapXMLStreamReader
instances created from the factory. The default implementation simply returns the unwrapped reader.- Overrides:
wrap
in classWrappingXMLInputFactory
- Parameters:
reader
- the reader to wrap- Returns:
- the wrapped reader
-
-