DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10597>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10597 ArrayIndexOutOfBoundsException after processing invalid XML Summary: ArrayIndexOutOfBoundsException after processing invalid XML Product: XalanJ2 Version: 2.2.x Platform: Other OS/Version: AIX Status: NEW Severity: Normal Priority: Other Component: org.apache.xalan.transformer AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] After processing XML which contains invalid Unicode characters, (e.g. 0x18), the next time the same stylesheet is used to process valid XML, it usually falls over with an ArrayIndexOutOfBounds exception. This is the code snippet which causes the problem: XslTranslator transform = null; try { transform = xslmanager.loadStyleSheetOnDemand(type.style, type.getName()); if (transform == null) log.debug("Failed to load style sheet"); } catch (TransformerConfigurationException ex){ log.error("XSLT Transformation problem", ex); return false; } try { log.debug("Applying style sheet"); line = transform.applyStyleSheet(message); if (line == null){ log.debug("Failed to apply style sheet"); } log.debug("Output data:"+line); } catch (TransformerException ex){ log.error("Error transforming message", ex); // Failure point return false; } 'Failure point' is where an exception is caught the first time the code is called, signifying an invalid Unicode character javax.xml.transform.TransformerException: An invalid XML character (Unicode: 0x18) was found in the element content of the document. at org.apache.xalan.transformer.TransformerImpl.transform (TransformerImpl.java:660) at org.apache.xalan.transformer.TransformerImpl.transform (TransformerImpl.java:1118) This is handled correctly and the method is called again with valid XML. This time another exception is thrown: javax.xml.transform.TransformerException: -6 at org.apache.xalan.transformer.TransformerImpl.transformNode (TransformerImpl.java:1212) at org.apache.xalan.transformer.TransformerImpl.run (TransformerImpl.java:2894) at java.lang.Thread.run(Thread.java:512) --------- java.lang.ArrayIndexOutOfBoundsException: -6 at org.apache.xml.utils.NodeVector.popPair(NodeVector.java:307) at org.apache.xalan.transformer.TransformerImpl.popCurrentMatched (TransformerImpl.java:2372) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode (TransformerImpl.java:2038) at org.apache.xalan.transformer.TransformerImpl.transformNode (TransformerImpl.java:1189) at org.apache.xalan.transformer.TransformerImpl.run (TransformerImpl.java:2894) at java.lang.Thread.run(Thread.java:512) However, the same XML can be processed if it is not proceeded by invalid XML. Occasionally the second message is processed correctly, but if it is, the Java application hangs and does not terminate correctly.
