You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/02/12 14:14:48 UTC

DO NOT REPLY [Bug 16991] New: - ArrayIndexOutOfBoundsException in SerializerToXML when empty comments in XSL

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=16991>.
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=16991

ArrayIndexOutOfBoundsException in SerializerToXML when empty comments in XSL

           Summary: ArrayIndexOutOfBoundsException in SerializerToXML when
                    empty comments in XSL
           Product: XalanJ2
           Version: 2.4
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.serialize
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: fbanel@laposte.net


When the XSL sheet contains empty comment tags (<xsl:comment/>),
the Transformer.transform() throws an java.lang.ArrayIndexOutOfBoundsException.
The exception is thrown by the SerializerToXML.comment() method,
which tries to read the '-1'th array element when the comment is empty

The problem can be seen also if you try to parse an XML document
containing empty comments (<!---->) , using a SAXParser and a SerializerToXML
as the lexical handler


The stack trace :

javax.xml.transform.TransformerException: 
java.lang.ArrayIndexOutOfBoundsException

	at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2344)

	at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)

	at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2339)

	at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)

	at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes
(ElemApplyTemplates.java:425)

	at org.apache.xalan.templates.ElemApplyTemplates.execute
(ElemApplyTemplates.java:216)

	at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2339)

	at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode
(TransformerImpl.java:2160)

	at org.apache.xalan.transformer.TransformerImpl.transformNode
(TransformerImpl.java:1213)

	at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:668)

	at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:1129)

	at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:1107)

	at com.xalantest.XalanTest.main(XalanTest.java:46)

---------

java.lang.ArrayIndexOutOfBoundsException

	at org.apache.xalan.serialize.SerializerToXML.comment
(SerializerToXML.java:1298)

	at org.apache.xalan.transformer.ResultTreeHandler.comment
(ResultTreeHandler.java:594)

	at org.apache.xalan.templates.ElemComment.execute(ElemComment.java:132)

	at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2339)

	at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)

	at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2339)

	at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)

	at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes
(ElemApplyTemplates.java:425)

	at org.apache.xalan.templates.ElemApplyTemplates.execute
(ElemApplyTemplates.java:216)

	at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2339)

	at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode
(TransformerImpl.java:2160)

	at org.apache.xalan.transformer.TransformerImpl.transformNode
(TransformerImpl.java:1213)

	at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:668)

	at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:1129)

	at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:1107)

	at com.xalantest.XalanTest.main(XalanTest.java:46)