Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.23.1
-
None
-
Unknown
Description
The StAXProcessor.java class does not close the stream it opens.
I had to modify it like this:
public void process(Exchange exchange) throws Exception {
InputSource is = exchange.getIn().getMandatoryBody(InputSource.class);
XMLStreamReader stream = exchange.getIn().getMandatoryBody(XMLStreamReader.class);
// Fermeture de la inputstream ici, car dans la version originale de la classe la stream reste ouverte.
try(InputStream inputStreamToClose = is.getByteStream()) {
XMLReader reader = new StaxStreamXMLReader(stream);
ContentHandler handler;
if (this.contentHandlerClass != null)
else
{ handler = this.contentHandler; }reader.setContentHandler(handler);
reader.parse(is);
if (ExchangeHelper.isOutCapable(exchange))
else
{ exchange.getIn().setBody(handler); }} finally
*
{ // Fermeture de la strem ValidatingStreamReader validatingStreamReader = (ValidatingStreamReader)stream; validatingStreamReader.closeCompletely(); }*
}