NPE with Saxon 8.6

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

NPE with Saxon 8.6

Stefan Wachter
Hi all,

running Saxon 8.6 (b) on a stylesheet I get the following
NullPointerException. The same stylesheet is successfully run with an
older version of Saxon. (I am not sure about the number of the older
version. The older saxon8.jar has 2943389 bytes.):

     [java] java.lang.NullPointerException
     [java]     at
net.sf.saxon.instruct.CopyOf.createsNewNodes(CopyOf.java:59)
     [java]     at
net.sf.saxon.instruct.Instruction.computeSpecialProperties(Instruction.java:205)
     [java]     at
net.sf.saxon.expr.ComputedExpression.computeStaticProperties(ComputedExpression.java:285)
     [java]     at
net.sf.saxon.expr.ComputedExpression.getSpecialProperties(ComputedExpression.java:274)
     [java]     at
net.sf.saxon.instruct.Block.createsNewNodes(Block.java:138)
     [java]     at
net.sf.saxon.instruct.Instruction.computeSpecialProperties(Instruction.java:205)
     [java]     at
net.sf.saxon.expr.ComputedExpression.computeStaticProperties(ComputedExpression.java:285)
     [java]     at
net.sf.saxon.expr.ComputedExpression.getDependencies(ComputedExpression.java:346)
     [java]     at
net.sf.saxon.expr.ComputedExpression.computeDependencies(ComputedExpression.java:363)
     [java]     at
net.sf.saxon.expr.ComputedExpression.computeStaticProperties(ComputedExpression.java:285)
     [java]     at
net.sf.saxon.expr.ComputedExpression.getDependencies(ComputedExpression.java:346)
     [java]     at
net.sf.saxon.expr.ComputedExpression.computeDependencies(ComputedExpression.java:363)
     [java]     at
net.sf.saxon.expr.ComputedExpression.computeStaticProperties(ComputedExpression.java:285)
     [java]     at
net.sf.saxon.expr.ComputedExpression.getDependencies(ComputedExpression.java:346)
     [java]     at
net.sf.saxon.instruct.ForEach.computeDependencies(ForEach.java:148)
     [java]     at
net.sf.saxon.expr.ComputedExpression.computeStaticProperties(ComputedExpression.java:285)
     [java]     at
net.sf.saxon.expr.ComputedExpression.getCardinality(ComputedExpression.java:323)
     [java]     at
net.sf.saxon.instruct.Block.getCardinality(Block.java:117)
     [java]     at
net.sf.saxon.expr.TypeChecker.staticTypeCheck(TypeChecker.java:247)
     [java]     at
net.sf.saxon.style.XSLGeneralVariable.initializeInstruction(XSLGeneralVariable.java:338)
     [java]     at
net.sf.saxon.style.XSLWithParam.compile(XSLWithParam.java:49)
     [java]     at
net.sf.saxon.style.StyleElement.compileSequenceConstructor(StyleElement.java:1428)
     [java]     at
net.sf.saxon.style.XSLApplyTemplates.compile(XSLApplyTemplates.java:150)
     [java]     at
net.sf.saxon.style.StyleElement.compileSequenceConstructor(StyleElement.java:1428)
     [java]     at
net.sf.saxon.style.StyleElement.compileSequenceConstructor(StyleElement.java:1442)
     [java]     at
net.sf.saxon.style.StyleElement.compileSequenceConstructor(StyleElement.java:1442)
     [java]     at
net.sf.saxon.style.XSLTemplate.compile(XSLTemplate.java:250)
     [java]     at
net.sf.saxon.style.XSLStylesheet.compileStylesheet(XSLStylesheet.java:1018)
     [java]     at
net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:290)
     [java]     at
net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:117)
     [java]     at
net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:130)
     [java]     at net.sf.saxon.Transform.doMain(Transform.java:435)
     [java]     at net.sf.saxon.Transform.main(Transform.java:60)

I set a breakpoint in CopyOf at line 59 and could the track down the
problem somewhat: the method "getExecutable" that is called there
returns null. Following the parent expressions I yields:

CopyOf
Block
Copy
Choose
ForEach
Block
<null>

I think I found the corresponding XSLT code. The position of the initial
CopyOf-expression is marked by "==>":

  <xsl:template match="row" mode="expandMoreRows">
    <xsl:param name="insertions" as="element(insertion)*"/>
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:apply-templates select="entry[1]" mode="expandMoreRows">
        <xsl:with-param name="insertions" select="$insertions"/>
        <xsl:with-param name="position" select="1"/>
      </xsl:apply-templates>
    </xsl:copy>
    <xsl:apply-templates select="following-sibling::row[1]"
mode="expandMoreRows">
      <xsl:with-param name="insertions" as="element(insertion)*">
        <!--
          Select only those insertions whose morerows attribute is
greater than one
          and subtract 1 from this attribute.
        -->
        <xsl:for-each select="$insertions">
          <xsl:if test="xs:integer(@morerows) gt 1">
            <xsl:copy>
==>              <xsl:copy-of select="@* except @morerows"/>
              <xsl:attribute name="morerows" select="@morerows - 1"/>
            </xsl:copy>
          </xsl:if>
        </xsl:for-each>
        <!--
          Generate insertions for those entries that have a morerows
attribute
          that is greater than one.
        -->
        <xsl:apply-templates select="entry[1]" mode="insertions">
          <xsl:with-param name="insertions" select="$insertions"/>
          <xsl:with-param name="position" select="1"/>
        </xsl:apply-templates>
      </xsl:with-param>
    </xsl:apply-templates>
  </xsl:template>
 
Has someone encounter a similar problem? Is there a workaround?

Best regards,
--Stefan



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

RE: NPE with Saxon 8.6

Michael Kay
This is a known bug:

http://sourceforge.net/tracker/index.php?func=detail&aid=1350704&group_id=29
872&atid=397617

The workaround is to replace an xsl:copy-of within a local variable
declaration by xsl:sequence.

A number of people have hit this bug and I'm going to ship a maintenance
release that fixes it as soon as I can. However, there's a bug in XQuery
multiple module import that I want to fix first, and it's proving a little
bit troublesome.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Stefan Wachter
> Sent: 15 November 2005 18:28
> To: [hidden email]
> Subject: [saxon] NPE with Saxon 8.6
>
> Hi all,
>
> running Saxon 8.6 (b) on a stylesheet I get the following
> NullPointerException. The same stylesheet is successfully run with an
> older version of Saxon. (I am not sure about the number of the older
> version. The older saxon8.jar has 2943389 bytes.):
>
>      [java] java.lang.NullPointerException
>      [java]     at
> net.sf.saxon.instruct.CopyOf.createsNewNodes(CopyOf.java:59)
>      [java]     at
> net.sf.saxon.instruct.Instruction.computeSpecialProperties(Ins
> truction.java:205)
>      [java]     at
> net.sf.saxon.expr.ComputedExpression.computeStaticProperties(C
> omputedExpression.java:285)
>      [java]     at
> net.sf.saxon.expr.ComputedExpression.getSpecialProperties(Comp
> utedExpression.java:274)
>      [java]     at
> net.sf.saxon.instruct.Block.createsNewNodes(Block.java:138)
>      [java]     at
> net.sf.saxon.instruct.Instruction.computeSpecialProperties(Ins
> truction.java:205)
>      [java]     at
> net.sf.saxon.expr.ComputedExpression.computeStaticProperties(C
> omputedExpression.java:285)
>      [java]     at
> net.sf.saxon.expr.ComputedExpression.getDependencies(ComputedE
> xpression.java:346)
>      [java]     at
> net.sf.saxon.expr.ComputedExpression.computeDependencies(Compu
> tedExpression.java:363)
>      [java]     at
> net.sf.saxon.expr.ComputedExpression.computeStaticProperties(C
> omputedExpression.java:285)
>      [java]     at
> net.sf.saxon.expr.ComputedExpression.getDependencies(ComputedE
> xpression.java:346)
>      [java]     at
> net.sf.saxon.expr.ComputedExpression.computeDependencies(Compu
> tedExpression.java:363)
>      [java]     at
> net.sf.saxon.expr.ComputedExpression.computeStaticProperties(C
> omputedExpression.java:285)
>      [java]     at
> net.sf.saxon.expr.ComputedExpression.getDependencies(ComputedE
> xpression.java:346)
>      [java]     at
> net.sf.saxon.instruct.ForEach.computeDependencies(ForEach.java:148)
>      [java]     at
> net.sf.saxon.expr.ComputedExpression.computeStaticProperties(C
> omputedExpression.java:285)
>      [java]     at
> net.sf.saxon.expr.ComputedExpression.getCardinality(ComputedEx
> pression.java:323)
>      [java]     at
> net.sf.saxon.instruct.Block.getCardinality(Block.java:117)
>      [java]     at
> net.sf.saxon.expr.TypeChecker.staticTypeCheck(TypeChecker.java:247)
>      [java]     at
> net.sf.saxon.style.XSLGeneralVariable.initializeInstruction(XS
> LGeneralVariable.java:338)
>      [java]     at
> net.sf.saxon.style.XSLWithParam.compile(XSLWithParam.java:49)
>      [java]     at
> net.sf.saxon.style.StyleElement.compileSequenceConstructor(Sty
> leElement.java:1428)
>      [java]     at
> net.sf.saxon.style.XSLApplyTemplates.compile(XSLApplyTemplates
> .java:150)
>      [java]     at
> net.sf.saxon.style.StyleElement.compileSequenceConstructor(Sty
> leElement.java:1428)
>      [java]     at
> net.sf.saxon.style.StyleElement.compileSequenceConstructor(Sty
> leElement.java:1442)
>      [java]     at
> net.sf.saxon.style.StyleElement.compileSequenceConstructor(Sty
> leElement.java:1442)
>      [java]     at
> net.sf.saxon.style.XSLTemplate.compile(XSLTemplate.java:250)
>      [java]     at
> net.sf.saxon.style.XSLStylesheet.compileStylesheet(XSLStyleshe
> et.java:1018)
>      [java]     at
> net.sf.saxon.PreparedStylesheet.setStylesheetDocument(Prepared
> Stylesheet.java:290)
>      [java]     at
> net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:117)
>      [java]     at
> net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFa
> ctoryImpl.java:130)
>      [java]     at net.sf.saxon.Transform.doMain(Transform.java:435)
>      [java]     at net.sf.saxon.Transform.main(Transform.java:60)
>
> I set a breakpoint in CopyOf at line 59 and could the track down the
> problem somewhat: the method "getExecutable" that is called there
> returns null. Following the parent expressions I yields:
>
> CopyOf
> Block
> Copy
> Choose
> ForEach
> Block
> <null>
>
> I think I found the corresponding XSLT code. The position of
> the initial
> CopyOf-expression is marked by "==>":
>
>   <xsl:template match="row" mode="expandMoreRows">
>     <xsl:param name="insertions" as="element(insertion)*"/>
>     <xsl:copy>
>       <xsl:copy-of select="@*"/>
>       <xsl:apply-templates select="entry[1]" mode="expandMoreRows">
>         <xsl:with-param name="insertions" select="$insertions"/>
>         <xsl:with-param name="position" select="1"/>
>       </xsl:apply-templates>
>     </xsl:copy>
>     <xsl:apply-templates select="following-sibling::row[1]"
> mode="expandMoreRows">
>       <xsl:with-param name="insertions" as="element(insertion)*">
>         <!--
>           Select only those insertions whose morerows attribute is
> greater than one
>           and subtract 1 from this attribute.
>         -->
>         <xsl:for-each select="$insertions">
>           <xsl:if test="xs:integer(@morerows) gt 1">
>             <xsl:copy>
> ==>              <xsl:copy-of select="@* except @morerows"/>
>               <xsl:attribute name="morerows" select="@morerows - 1"/>
>             </xsl:copy>
>           </xsl:if>
>         </xsl:for-each>
>         <!--
>           Generate insertions for those entries that have a morerows
> attribute
>           that is greater than one.
>         -->
>         <xsl:apply-templates select="entry[1]" mode="insertions">
>           <xsl:with-param name="insertions" select="$insertions"/>
>           <xsl:with-param name="position" select="1"/>
>         </xsl:apply-templates>
>       </xsl:with-param>
>     </xsl:apply-templates>
>   </xsl:template>
>  
> Has someone encounter a similar problem? Is there a workaround?
>
> Best regards,
> --Stefan
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
> Register for a JBoss Training Course.  Free Certification Exam
> for All Training Attendees Through End of 2005. For more info visit:
> http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

Re: NPE with Saxon 8.6

Stefan Wachter
Thanks for the quick reply and sorry for reporting duplicates.

--Stefan

Michael Kay wrote:

>This is a known bug:
>
>http://sourceforge.net/tracker/index.php?func=detail&aid=1350704&group_id=29
>872&atid=397617
>
>The workaround is to replace an xsl:copy-of within a local variable
>declaration by xsl:sequence.
>
>A number of people have hit this bug and I'm going to ship a maintenance
>release that fixes it as soon as I can. However, there's a bug in XQuery
>multiple module import that I want to fix first, and it's proving a little
>bit troublesome.
>
>Michael Kay
>http://www.saxonica.com/ 
>
>  
>>-----Original Message-----
>>From: [hidden email]
>>[mailto:[hidden email]] On Behalf Of
>>Stefan Wachter
>>Sent: 15 November 2005 18:28
>>To: [hidden email]
>>Subject: [saxon] NPE with Saxon 8.6
>>
>>Hi all,
>>
>>running Saxon 8.6 (b) on a stylesheet I get the following
>>NullPointerException. The same stylesheet is successfully run with an
>>older version of Saxon. (I am not sure about the number of the older
>>version. The older saxon8.jar has 2943389 bytes.):
>>
>>     [java] java.lang.NullPointerException
>>     [java]     at
>>net.sf.saxon.instruct.CopyOf.createsNewNodes(CopyOf.java:59)
>>     [java]     at
>>net.sf.saxon.instruct.Instruction.computeSpecialProperties(Ins
>>truction.java:205)
>>     [java]     at
>>net.sf.saxon.expr.ComputedExpression.computeStaticProperties(C
>>omputedExpression.java:285)
>>     [java]     at
>>net.sf.saxon.expr.ComputedExpression.getSpecialProperties(Comp
>>utedExpression.java:274)
>>     [java]     at
>>net.sf.saxon.instruct.Block.createsNewNodes(Block.java:138)
>>     [java]     at
>>net.sf.saxon.instruct.Instruction.computeSpecialProperties(Ins
>>truction.java:205)
>>     [java]     at
>>net.sf.saxon.expr.ComputedExpression.computeStaticProperties(C
>>omputedExpression.java:285)
>>     [java]     at
>>net.sf.saxon.expr.ComputedExpression.getDependencies(ComputedE
>>xpression.java:346)
>>     [java]     at
>>net.sf.saxon.expr.ComputedExpression.computeDependencies(Compu
>>tedExpression.java:363)
>>     [java]     at
>>net.sf.saxon.expr.ComputedExpression.computeStaticProperties(C
>>omputedExpression.java:285)
>>     [java]     at
>>net.sf.saxon.expr.ComputedExpression.getDependencies(ComputedE
>>xpression.java:346)
>>     [java]     at
>>net.sf.saxon.expr.ComputedExpression.computeDependencies(Compu
>>tedExpression.java:363)
>>     [java]     at
>>net.sf.saxon.expr.ComputedExpression.computeStaticProperties(C
>>omputedExpression.java:285)
>>     [java]     at
>>net.sf.saxon.expr.ComputedExpression.getDependencies(ComputedE
>>xpression.java:346)
>>     [java]     at
>>net.sf.saxon.instruct.ForEach.computeDependencies(ForEach.java:148)
>>     [java]     at
>>net.sf.saxon.expr.ComputedExpression.computeStaticProperties(C
>>omputedExpression.java:285)
>>     [java]     at
>>net.sf.saxon.expr.ComputedExpression.getCardinality(ComputedEx
>>pression.java:323)
>>     [java]     at
>>net.sf.saxon.instruct.Block.getCardinality(Block.java:117)
>>     [java]     at
>>net.sf.saxon.expr.TypeChecker.staticTypeCheck(TypeChecker.java:247)
>>     [java]     at
>>net.sf.saxon.style.XSLGeneralVariable.initializeInstruction(XS
>>LGeneralVariable.java:338)
>>     [java]     at
>>net.sf.saxon.style.XSLWithParam.compile(XSLWithParam.java:49)
>>     [java]     at
>>net.sf.saxon.style.StyleElement.compileSequenceConstructor(Sty
>>leElement.java:1428)
>>     [java]     at
>>net.sf.saxon.style.XSLApplyTemplates.compile(XSLApplyTemplates
>>.java:150)
>>     [java]     at
>>net.sf.saxon.style.StyleElement.compileSequenceConstructor(Sty
>>leElement.java:1428)
>>     [java]     at
>>net.sf.saxon.style.StyleElement.compileSequenceConstructor(Sty
>>leElement.java:1442)
>>     [java]     at
>>net.sf.saxon.style.StyleElement.compileSequenceConstructor(Sty
>>leElement.java:1442)
>>     [java]     at
>>net.sf.saxon.style.XSLTemplate.compile(XSLTemplate.java:250)
>>     [java]     at
>>net.sf.saxon.style.XSLStylesheet.compileStylesheet(XSLStyleshe
>>et.java:1018)
>>     [java]     at
>>net.sf.saxon.PreparedStylesheet.setStylesheetDocument(Prepared
>>Stylesheet.java:290)
>>     [java]     at
>>net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:117)
>>     [java]     at
>>net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFa
>>ctoryImpl.java:130)
>>     [java]     at net.sf.saxon.Transform.doMain(Transform.java:435)
>>     [java]     at net.sf.saxon.Transform.main(Transform.java:60)
>>
>>I set a breakpoint in CopyOf at line 59 and could the track down the
>>problem somewhat: the method "getExecutable" that is called there
>>returns null. Following the parent expressions I yields:
>>
>>CopyOf
>>Block
>>Copy
>>Choose
>>ForEach
>>Block
>><null>
>>
>>I think I found the corresponding XSLT code. The position of
>>the initial
>>CopyOf-expression is marked by "==>":
>>
>>  <xsl:template match="row" mode="expandMoreRows">
>>    <xsl:param name="insertions" as="element(insertion)*"/>
>>    <xsl:copy>
>>      <xsl:copy-of select="@*"/>
>>      <xsl:apply-templates select="entry[1]" mode="expandMoreRows">
>>        <xsl:with-param name="insertions" select="$insertions"/>
>>        <xsl:with-param name="position" select="1"/>
>>      </xsl:apply-templates>
>>    </xsl:copy>
>>    <xsl:apply-templates select="following-sibling::row[1]"
>>mode="expandMoreRows">
>>      <xsl:with-param name="insertions" as="element(insertion)*">
>>        <!--
>>          Select only those insertions whose morerows attribute is
>>greater than one
>>          and subtract 1 from this attribute.
>>        -->
>>        <xsl:for-each select="$insertions">
>>          <xsl:if test="xs:integer(@morerows) gt 1">
>>            <xsl:copy>
>>==>              <xsl:copy-of select="@* except @morerows"/>
>>              <xsl:attribute name="morerows" select="@morerows - 1"/>
>>            </xsl:copy>
>>          </xsl:if>
>>        </xsl:for-each>
>>        <!--
>>          Generate insertions for those entries that have a morerows
>>attribute
>>          that is greater than one.
>>        -->
>>        <xsl:apply-templates select="entry[1]" mode="insertions">
>>          <xsl:with-param name="insertions" select="$insertions"/>
>>          <xsl:with-param name="position" select="1"/>
>>        </xsl:apply-templates>
>>      </xsl:with-param>
>>    </xsl:apply-templates>
>>  </xsl:template>
>>
>>Has someone encounter a similar problem? Is there a workaround?
>>
>>Best regards,
>>--Stefan
>>
>>
>>
>>-------------------------------------------------------
>>This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
>>Register for a JBoss Training Course.  Free Certification Exam
>>for All Training Attendees Through End of 2005. For more info visit:
>>http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
>>_______________________________________________
>>saxon-help mailing list
>>[hidden email]
>>https://lists.sourceforge.net/lists/listinfo/saxon-help
>>
>>    
>
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
>Register for a JBoss Training Course.  Free Certification Exam
>for All Training Attendees Through End of 2005. For more info visit:
>http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
>_______________________________________________
>saxon-help mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/saxon-help
>
>
>  



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help