Discussion:
[jira] [Created] (XALANJ-2590) "InternalRuntimeError: Expected element missing at 6" after upgrade to XALAN 2.7.2
Uwe Schindler (JIRA)
2014-08-14 12:09:13 UTC
Permalink
Uwe Schindler created XALANJ-2590:
-------------------------------------

Summary: "InternalRuntimeError: Expected element missing at 6" after upgrade to XALAN 2.7.2
Key: XALANJ-2590
URL: https://issues.apache.org/jira/browse/XALANJ-2590
Project: XalanJ2
Issue Type: Bug
Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects. Anybody can view the issue.)
Components: DTM, Xalan
Affects Versions: 2.7.2
Reporter: Uwe Schindler
Assignee: Steven J. Hathaway


Hi,
after upgrading to XALAN 2.7.2, I got very strange errors in one of my XSL transformations, but just for some documents. It took a while to find the problem:
I have an extension function that returns a NodeList with some elements and text nodes (some HTML). Unfortunately this NodeList contained an *empty* text node as very last element. This is perfectly fine for DOM, because there is nothing that forbids empty text nodes. This empty node caused the following error when invoking <xsl:copy-of select=java:Class:myExtensionFunction()"/>:

{{InternalRuntimeError: Expected element missing at 6}}

(6 is the last node in the Node-Set, the empty text node)

I fixed the issue by calling normalize() before returning the NodeList as quick hack. Later I did a better fix to not create the empty nodes at all.

In XALAN 2.7.1 this worked without any problem.



--
This message was sent by Atlassian JIRA
(v6.2#6252)
Uwe Schindler (JIRA)
2014-08-14 12:13:11 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANJ-2590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14096903#comment-14096903 ]

Uwe Schindler commented on XALANJ-2590:
---------------------------------------

This seems to be caused by XALANJ-2590: The DOM NodeList gets copied to a DTM. During this process, it looks like empty text nodes are removed. This causes a problem at the end of the iteration. The new Exception was added in this commit.

I will try to produce a testcase with a extension function that creates a DocumentFragment with some empty text nodes, which returns DocFrag.getChildNodes(), so a nodelist with some empty text nodes.
Post by Uwe Schindler (JIRA)
"InternalRuntimeError: Expected element missing at 6" after upgrade to XALAN 2.7.2
----------------------------------------------------------------------------------
Key: XALANJ-2590
URL: https://issues.apache.org/jira/browse/XALANJ-2590
Project: XalanJ2
Issue Type: Bug
Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects. Anybody can view the issue.)
Components: DTM, Xalan
Affects Versions: 2.7.2
Reporter: Uwe Schindler
Assignee: Steven J. Hathaway
Hi,
{{InternalRuntimeError: Expected element missing at 6}}
(6 is the last node in the Node-Set, the empty text node)
I fixed the issue by calling normalize() before returning the NodeList as quick hack. Later I did a better fix to not create the empty nodes at all.
In XALAN 2.7.1 this worked without any problem.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
Uwe Schindler (JIRA)
2014-08-14 12:15:11 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANJ-2590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated XALANJ-2590:
----------------------------------

Component/s: (was: Xalan)
XSLTC
Post by Uwe Schindler (JIRA)
"InternalRuntimeError: Expected element missing at 6" after upgrade to XALAN 2.7.2
----------------------------------------------------------------------------------
Key: XALANJ-2590
URL: https://issues.apache.org/jira/browse/XALANJ-2590
Project: XalanJ2
Issue Type: Bug
Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects. Anybody can view the issue.)
Components: DTM, XSLTC
Affects Versions: 2.7.2
Reporter: Uwe Schindler
Assignee: Steven J. Hathaway
Hi,
{{InternalRuntimeError: Expected element missing at 6}}
(6 is the last node in the Node-Set, the empty text node)
I fixed the issue by calling normalize() before returning the NodeList as quick hack. Later I did a better fix to not create the empty nodes at all.
In XALAN 2.7.1 this worked without any problem.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
Uwe Schindler (JIRA)
2014-08-14 12:19:11 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANJ-2590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14096903#comment-14096903 ]

Uwe Schindler edited comment on XALANJ-2590 at 8/14/14 12:17 PM:
-----------------------------------------------------------------

This seems to be caused by XALANJ-2493: The DOM NodeList gets copied to a DTM. During this process, it looks like empty text nodes are removed. This causes a problem at the end of the iteration. The new Exception was added in this commit.

I will try to produce a testcase with a extension function that creates a DocumentFragment with some empty text nodes, which returns DocFrag.getChildNodes(), so a nodelist with some empty text nodes.


was (Author: thetaphi):
This seems to be caused by XALANJ-2590: The DOM NodeList gets copied to a DTM. During this process, it looks like empty text nodes are removed. This causes a problem at the end of the iteration. The new Exception was added in this commit.

I will try to produce a testcase with a extension function that creates a DocumentFragment with some empty text nodes, which returns DocFrag.getChildNodes(), so a nodelist with some empty text nodes.
Post by Uwe Schindler (JIRA)
"InternalRuntimeError: Expected element missing at 6" after upgrade to XALAN 2.7.2
----------------------------------------------------------------------------------
Key: XALANJ-2590
URL: https://issues.apache.org/jira/browse/XALANJ-2590
Project: XalanJ2
Issue Type: Bug
Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects. Anybody can view the issue.)
Components: DTM, XSLTC
Affects Versions: 2.7.2
Reporter: Uwe Schindler
Assignee: Steven J. Hathaway
Hi,
{{InternalRuntimeError: Expected element missing at 6}}
(6 is the last node in the Node-Set, the empty text node)
I fixed the issue by calling normalize() before returning the NodeList as quick hack. Later I did a better fix to not create the empty nodes at all.
In XALAN 2.7.1 this worked without any problem.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
Gary Gregory (JIRA)
2014-08-15 02:19:19 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANJ-2590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14098074#comment-14098074 ]

Gary Gregory commented on XALANJ-2590:
--------------------------------------

Yes, a test case would be great. In the meantime, do you have stack trace?
Post by Uwe Schindler (JIRA)
"InternalRuntimeError: Expected element missing at 6" after upgrade to XALAN 2.7.2
----------------------------------------------------------------------------------
Key: XALANJ-2590
URL: https://issues.apache.org/jira/browse/XALANJ-2590
Project: XalanJ2
Issue Type: Bug
Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects. Anybody can view the issue.)
Components: DTM, XSLTC
Affects Versions: 2.7.2
Reporter: Uwe Schindler
Assignee: Steven J. Hathaway
Hi,
{{InternalRuntimeError: Expected element missing at 6}}
(6 is the last node in the Node-Set, the empty text node)
I fixed the issue by calling normalize() before returning the NodeList as quick hack. Later I did a better fix to not create the empty nodes at all.
In XALAN 2.7.1 this worked without any problem.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
Uwe Schindler (JIRA)
2014-08-15 09:51:18 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANJ-2590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14098392#comment-14098392 ]

Uwe Schindler commented on XALANJ-2590:
---------------------------------------

Here is the stack trace:

{noformat}
[14/Aug/2014:09:59:13] failure ( 3268): for host XXX trying to GET /XXX, service-j2ee reports: Expected element missing at 6
org.apache.xalan.xsltc.runtime.InternalRuntimeError: Expected element missing at 6
at org.apache.xalan.xsltc.runtime.BasisLibrary.nodeList2Iterator(BasisLibrary.java:1288)
at metadata_html.event()
at metadata_html.listEvents()
at metadata_html.template$dot$22()
at metadata_html.applyTemplates()
at metadata_html.applyTemplates()
at metadata_html.transform()
at org.apache.xalan.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:605)
at org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:628)
at org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:299)
at [...]
{noformat}

event() is a template that has an <xsl:copy-of select="java:Class.staticMethod(..)"/> returning NodeList:

{code:xml}
<xsl:template name="event">
<div>
[...]
<xsl:if test="md:comment"><em class="title"> * Comment: </em><xsl:copy-of select="panxslt:formatCommentWithLinks(md:comment,'')" /></xsl:if>
</div>
</xsl:template>
{code}

panxslt:formatCommentWithLinks inserted empty text nodes into the NodeList, which I fixed already.
Post by Uwe Schindler (JIRA)
"InternalRuntimeError: Expected element missing at 6" after upgrade to XALAN 2.7.2
----------------------------------------------------------------------------------
Key: XALANJ-2590
URL: https://issues.apache.org/jira/browse/XALANJ-2590
Project: XalanJ2
Issue Type: Bug
Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects. Anybody can view the issue.)
Components: DTM, XSLTC
Affects Versions: 2.7.2
Reporter: Uwe Schindler
Assignee: Steven J. Hathaway
Hi,
{{InternalRuntimeError: Expected element missing at 6}}
(6 is the last node in the Node-Set, the empty text node)
I fixed the issue by calling normalize() before returning the NodeList as quick hack. Later I did a better fix to not create the empty nodes at all.
In XALAN 2.7.1 this worked without any problem.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
Uwe Schindler (JIRA)
2014-08-15 09:59:18 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANJ-2590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14098392#comment-14098392 ]

Uwe Schindler edited comment on XALANJ-2590 at 8/15/14 9:57 AM:
----------------------------------------------------------------

Here is the stack trace:

{noformat}
[14/Aug/2014:09:59:13] failure ( 3268): for host XXX trying to GET /XXX, service-j2ee reports: Expected element missing at 6
org.apache.xalan.xsltc.runtime.InternalRuntimeError: Expected element missing at 6
at org.apache.xalan.xsltc.runtime.BasisLibrary.nodeList2Iterator(BasisLibrary.java:1288)
at metadata_html.event()
at metadata_html.listEvents()
at metadata_html.template$dot$22()
at metadata_html.applyTemplates()
at metadata_html.applyTemplates()
at metadata_html.transform()
at org.apache.xalan.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:605)
at org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:628)
at org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:299)
at [...]
{noformat}

event() is a template that has an <xsl:copy-of select="java:Class.staticMethod(..)"/> returning NodeList:

{code:xml}
<xsl:template name="event">
<div>
[...]
<xsl:if test="md:comment"><em class="title"> * Comment: </em><xsl:copy-of select="panxslt:formatCommentWithLinks(md:comment,'')" /></xsl:if>
</div>
</xsl:template>
{code}

panxslt:formatCommentWithLinks inserted empty text nodes into the NodeList, which I fixed already to work around the bug.


was (Author: thetaphi):
Here is the stack trace:

{noformat}
[14/Aug/2014:09:59:13] failure ( 3268): for host XXX trying to GET /XXX, service-j2ee reports: Expected element missing at 6
org.apache.xalan.xsltc.runtime.InternalRuntimeError: Expected element missing at 6
at org.apache.xalan.xsltc.runtime.BasisLibrary.nodeList2Iterator(BasisLibrary.java:1288)
at metadata_html.event()
at metadata_html.listEvents()
at metadata_html.template$dot$22()
at metadata_html.applyTemplates()
at metadata_html.applyTemplates()
at metadata_html.transform()
at org.apache.xalan.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:605)
at org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:628)
at org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:299)
at [...]
{noformat}

event() is a template that has an <xsl:copy-of select="java:Class.staticMethod(..)"/> returning NodeList:

{code:xml}
<xsl:template name="event">
<div>
[...]
<xsl:if test="md:comment"><em class="title"> * Comment: </em><xsl:copy-of select="panxslt:formatCommentWithLinks(md:comment,'')" /></xsl:if>
</div>
</xsl:template>
{code}

panxslt:formatCommentWithLinks inserted empty text nodes into the NodeList, which I fixed already.
Post by Uwe Schindler (JIRA)
"InternalRuntimeError: Expected element missing at 6" after upgrade to XALAN 2.7.2
----------------------------------------------------------------------------------
Key: XALANJ-2590
URL: https://issues.apache.org/jira/browse/XALANJ-2590
Project: XalanJ2
Issue Type: Bug
Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects. Anybody can view the issue.)
Components: DTM, XSLTC
Affects Versions: 2.7.2
Reporter: Uwe Schindler
Assignee: Steven J. Hathaway
Hi,
{{InternalRuntimeError: Expected element missing at 6}}
(6 is the last node in the Node-Set, the empty text node)
I fixed the issue by calling normalize() before returning the NodeList as quick hack. Later I did a better fix to not create the empty nodes at all.
In XALAN 2.7.1 this worked without any problem.
--
This message was sent by Atlassian JIRA
(v6.2#6252)

Loading...