You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Brian Minchau (JIRA)" <xa...@xml.apache.org> on 2005/07/15 18:01:12 UTC
[jira] Updated: (XALANJ-2023) NPE in org.apache.xml.serializer.ToHTMLSAXHandler
[ http://issues.apache.org/jira/browse/XALANJ-2023?page=all ]
Brian Minchau updated XALANJ-2023:
----------------------------------
Attachment: ToHTMLSAXHandler-patch2.txt
I've reviewed the original patch by Ken, and approve it. Virtually everywhere
m_lexHandler is checked against null before being used, but not in this location.
I found one other place where m_lexHandler was not checked against null before use,
and added a check there against null, so Ken's patch and this one other location is
rolled into patch2.
> NPE in org.apache.xml.serializer.ToHTMLSAXHandler
> -------------------------------------------------
>
> Key: XALANJ-2023
> URL: http://issues.apache.org/jira/browse/XALANJ-2023
> Project: XalanJ2
> Type: Bug
> Components: Serialization
> Versions: 2.6
> Reporter: Ken Weiner
> Attachments: ToHTMLSAXHandler-patch.txt, ToHTMLSAXHandler-patch2.txt
>
> On line 360 of org.apache.xml.serializer.ToHTMLSAXHandler, the code does not check to see if a lexical handler has been set before trying to call a method on it. The result is the following stack strace when comments are present in the XML:
> Caused by: java.lang.NullPointerException
> at org.apache.xml.serializer.ToHTMLSAXHandler.comment(ToHTMLSAXHandler.java:360)
> at org.apache.xpath.objects.XString.dispatchAsComment(XString.java:287)
> at org.apache.xml.dtm.ref.DTMTreeWalker.startNode(DTMTreeWalker.java:233)
> at org.apache.xalan.transformer.TreeWalker2Result.startNode(TreeWalker2Result.java:144)
> at org.apache.xml.dtm.ref.DTMTreeWalker.traverse(DTMTreeWalker.java:114)
> at org.apache.xalan.transformer.TreeWalker2Result.traverse(TreeWalker2Result.java:72)
> at org.apache.xalan.templates.ElemCopyOf.execute(ElemCopyOf.java:185)
> at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:395)
> at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:177)
> at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2336)
> ... 21 more
> The fix is to add the guard against a null lexical handler:
> if (m_lexHandler != null)
> m_lexHandler.comment(arg0, arg1, arg2);
> This guard has been added in the similar comment() method of the ToXMLSAXHandler class in the same package.
> Possible workaround: Create a dummy LexicalHandler implementation and set that on the XMLReader before attempting the transformation.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org