[ http://issues.apache.org/jira/browse/XALANJ-1510?page=all ]
     
Christine Li closed XALANJ-1510:
--------------------------------

    Assign To:     (was: Xalan Developers Mailing List)

> Got NullPointerException, when document() is called inside a <redirect:write> 
> element
> -------------------------------------------------------------------------------------
>
>          Key: XALANJ-1510
>          URL: http://issues.apache.org/jira/browse/XALANJ-1510
>      Project: XalanJ2
>         Type: Bug
>   Components: Xalan-extensions
>     Versions: 2.5
>  Environment: Operating System: Other
> Platform: Other
>     Reporter: Christine Li
>  Attachments: TestInput1.xml, TestInput2.xml, TransformerImplPatch.txt, 
> tst.xsl
>
> This problem is reported by Rick Bullotta:
> We're now have a test case that will always throw an NPE.  And it is a
> VERY interesting and odd bug...here's the basics:
> 1) When used inside of the <redirect:write> element, a call to
> document() (or something it calls) throws an NPE...how here's the
> strange part...
> 2) ONLY WHEN the document being included has one or more attributes on
> its top level element!!!
> 3) If you use the following examples, anything referencing
> TestInput1.xml will work fine, whereas TestInput2.xml will fail!
> File: TestInput1.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <Root>
>                <Child>
>                                <SubChild>AAA</SubChild>
>                                <SubChild>BBB</SubChild>
>                </Child>
> </Root>
> =====================
> File: TestInput2.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <Root attrib="XXX">
>                <Child>
>                                <SubChild>AAA</SubChild>
>                                <SubChild>BBB</SubChild>
>                </Child>
> </Root>
> =====================
> File: TestStylesheet.xsl
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
> extension-element-prefixes="redirect">
>                <xsl:variable name="URL1">C:/TestInput1.xml</xsl:variable>
>                <xsl:variable name="URL2">C:/TestInput2.xml</xsl:variable>
>                <xsl:variable
> name="File1">C:\Temp\TestOutput1.xml</xsl:variable>
>                <xsl:variable
> name="File2">C:\Temp\TestOutput2.xml</xsl:variable>
>                
>                <xsl:template match="/">
>                                <results>
>                                                <redirect:write 
> select="$File1">
>                                                                <wrapper>
>                                                                       
>        <xsl:copy-of
> select="document($URL1)"/>
>                                                                </wrapper>
>                                                </redirect:write>
>                                                
>                                                <wrapper>
>                                                                <xsl:copy-of 
> select="document($URL1)"/>
>                                                </wrapper>
>                                                <redirect:write 
> select="$File2">
>                                                                <wrapper>
>                                                                       
>        <xsl:copy-of
> select="document($URL2)"/>
>                                                                </wrapper>
>                                                </redirect:write>
>                                                
>                                                <wrapper>
>                                                                <xsl:copy-of 
> select="document($URL2)"/>
>                                                </wrapper>
>                                </results>
>                </xsl:template>
> </xsl:stylesheet>

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to