You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Martin Klang <ma...@pingdynasty.com> on 2000/09/22 17:35:44 UTC
TreeWalker bug?
Hey all,
just sent the list a mail about build problems - and here is the reason i
was trying to build it :>
i found that doing an <xsl:copy-of select="."/> when the current node had
an empty or no textnode child i ended up with:
java.lang.NullPointerException: at
org.apache.xalan.xpath.xml.TreeWalker.startNode(TreeWalker.java:248) at
org.apache.xalan.xslt.TreeWalker2Result.startNode(TreeWalker2Result.java:173) at
org.apache.xalan.xpath.xml.TreeWalker.traverse(TreeWalker.java:98) at
org.apache.xalan.xslt.TreeWalker2Result.traverse(TreeWalker2Result.java:92) at
org.apache.xalan.xslt.ElemCopyOf.execute(ElemCopyOf.java:170) at
org.apache.xalan.xslt.ElemTemplateElement.executeChildren(ElemTemplateElement.java:659) at
org.apache.xalan.xslt.ElemTemplateElement.transformChild(ElemTemplateElement.java:1195) at
org.apache.xalan.xslt.ElemTemplateElement.transformSelectedChildren(ElemTemplateElement.java:958) at
org.apache.xalan.xslt.ElemApplyTemplates.execute(ElemApplyTemplates.java:176) at
org.apache.xalan.xslt.ElemTemplateElement.executeChildren(ElemTemplateElement.java:659) at
org.apache.xalan.xslt.ElemLiteralResult.execute(ElemLiteralResult.java:254) at
org.apache.xalan.xslt.ElemTemplateElement.executeChildren(ElemTemplateElement.java:659) at
org.apache.xalan.xslt.ElemTemplate.execute(ElemTemplate.java:145) at
org.apache.xalan.xslt.StylesheetRoot.process(StylesheetRoot.java:443) at
org.apache.xalan.xslt.StylesheetRoot.process(StylesheetRoot.java:271)
problem is that i'm using programmatically created xml, so i don't have a
simple test case i can show you. unfortunately i can't spend much time on
this right now (damn dayjob!), but it seems that if i create an element
like this:
Element e = doc.createElement(name);
Text t = doc.createTextNode(value);
e.appendChild(t);
when 'value' is null, a copy-of on that node will make the TreeWalker
blow up (and it probably affects other parts of the code as well)
the patch below seems to fix the problem.
regards,
/m
--- src/org/apache/xalan/xpath/xml/TreeWalker.java Fri Sep 22
15:41:46 2000+++
xalan_1_2_D01/src/org/apache/xalan/xpath/xml/TreeWalker.java Tue Jul 25
23:33:52 2000
@@ -229,7 +229,6 @@
case Node.TEXT_NODE:
{
String data = ((Text)node).getData();
- if(data != null){
if(nextIsRaw)
{
nextIsRaw = false;
@@ -247,7 +246,6 @@
{
this.m_formatterListener.characters(data.toCharArray(), 0,
data.length());
}
- }
}
break;
case Node.ENTITY_REFERENCE_NODE: