Details
-
Bug
-
Status: Resolved
-
Resolution: Fixed
-
2.2.x
-
None
-
None
-
Operating System: AIX
Platform: Other
-
10597
Description
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
catch
(TransformerConfigurationException ex)
try {
log.debug("Applying
style sheet");
line =
transform.applyStyleSheet(message);
if (line == null)
log.debug("Output
data:"+line);
}
catch (TransformerException ex)
'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.