[ 
http://nagoya.apache.org/jira/browse/XALANJ-1783?page=comments#action_57000 ]
     
Paul Palaszewski commented on XALANJ-1783:
------------------------------------------

Hi!

I've just encountered the same issue with xalan 2.6.0. My test szenario:
xalan 2.6.0 (the version, that's packaged with com.sun-packages in jdk 1.5)
xerces 2.6.2 (the apache distribution)
xsltc (no special options/flags/params)

I changed a quite long xsl, where we had constructs like 
<xsl:if test="@someAttr"><xsl:attribute name="someAttr"><xsl:value-of 
select="@someAttr"/></xsl:attribute></xsl:if>

to
<xsl:copy-of select="@someAttr"/>

I've expected, that the 2nd version should be faster. Did this for serveral 
attributes, which can but don't have to occur in the document. Then, during 
testing, I had exactly the same stack traces with the SAX2DTM2#copyAttribute 
method causing an ArrayIndexOutOfBoundsException in it's Vector.

The XSL generates HTML so no output namespaces. It processes an input xml with 
namespaces.

I hope I've described the test scenario with enough detailed, that you need to 
reproduce and fix this issue.

> Java extension functions in XSLTC returning NodeList causes exception on 
> xsl:copy-of
> ------------------------------------------------------------------------------------
>
>          Key: XALANJ-1783
>          URL: http://nagoya.apache.org/jira/browse/XALANJ-1783
>      Project: XalanJ2
>         Type: Bug
>   Components: XSLTC
>     Versions: 2.5
>  Environment: Operating System: All
> Platform: All
>     Reporter: Derek Lewis
>     Assignee: Xalan Developers Mailing List
>  Attachments: Bug26697Library.txt, xalan-bug-small.tar.gz
>
> When trying to do xsl:copy-of on a nodeset returned from a Java extension
> function, in XSLTC, an ArrayIndexOutOfBoundsException is thrown. (Acctually,
> it's a TransletException wrapping the AIOOBE.)
> It seems like it might be somehow related to namespaces.
> After tracing the exception down a bit, it seems to be in the outputting of
> attributes.  The exception does not occur if I remove the namespace from the
> attributes.
> At the URL specified in this bug report is a tar.gz containing some Java 
> source,
> the version of Xalan I've encountered this with, and some xml and xslt files. 
> There is also a README file describing the exact steps to duplicate the bug.
> Tested on 2 versions of Java:
> 1. Blackdown-1.3.1-02b-FCS
> 2. java full version "1.3.1_01"
> Below is a copy of my mail to the list, describing in more detail.
> ------ BEGIN EMAIL -------
> I understand from the documentation that org.w3c.dom.NodeList is a valid
> return-type for an extension function, that should be converted approptiately.
> I'm having problems, however, whenever I try to output the NodeList using
> xsl:copy-of.  I can call count($list) or count($list/*), or I can even do a
> xsl:value-of on $list or $list/*, and they all behave as I would expect.
> However, when I try to do xsl:copy-of on $list or $list/*, I get an
> ArrayIndexOutOfBoundsException.
> The NodeList I return has one element (in this case), and that element has
> around 70 child elements, and a few attributes.
> The exception I see when I do <xsl:copy-of select="$list/*" /> is:
> org.apache.xalan.xsltc.TransletException:
> java.lang.ArrayIndexOutOfBoundsException: -7 < 0
>         at org.apache.xalan.xsltc.dom.SAXImpl.copy(SAXImpl.java:1392)
>         at org.apache.xalan.xsltc.dom.DOMAdapter.copy(DOMAdapter.java:309)
>         at org.apache.xalan.xsltc.dom.MultiDOM.copy(MultiDOM.java:540)
>         at components1.template$dot$4()
>         at components1.applyTemplates2()
>         at components1.template$dot$1()
>         at components1.applyTemplates2()
>         at components1.applyTemplates()
>         at components1.transform()
> (components1 is the name of my xslt file)
> I added a e.printStackTrace to the dom.SAXImpl class so I could see what the
> real exception is and got a few extra lines:
> java.lang.ArrayIndexOutOfBoundsException: -7 < 0
>         at java.util.Vector.elementAt(Vector.java:427)
>         at 
> org.apache.xml.dtm.ref.sax2dtm.SAX2DTM2.copyAttribute(SAX2DTM2.java:3347)
>         at org.apache.xalan.xsltc.dom.SAXImpl.copy(SAXImpl.java:1361)
>         at org.apache.xalan.xsltc.dom.DOMAdapter.copy(DOMAdapter.java:309)
>         at org.apache.xalan.xsltc.dom.MultiDOM.copy(MultiDOM.java:540)
> I've tried this with my own implementation of NodeList, and with
> org.apache.xpath.NodeSet, and I get the exact same stack trace regardless of
> which I use.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to