Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8062923

XSL: Run-time internal error in 'substring()'

XMLWordPrintable

    • b49
    • Verified

        If the substring function is used during the XSL transformation with negative length, i.e. <xsl:value-of select="substring('asdf',2,-1)/> then the following internal error is observed:
        java.lang.RuntimeException: Run-time internal error in 'substring()'
                at
        com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.runTimeError(BasisLibrary.java:1527)
                at
        com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.runTimeError(BasisLibrary.java:1531)
                at
        com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.substringF(BasisLibrary.java:302)
                at newbug1.template$dot$0()
                at newbug1.applyTemplates()
                at newbug1.transform()
                at
        com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:605)
                at
        com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:734)
                at
        com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:345)
                at tmp.xform(tmp.java:123)
                at tmp.main(tmp.java:102)

        But according to w3.org documentation the empty string should be returned:
        http://www.w3.org/TR/xpath-functions/#func-substring

              aefimov Aleksej Efimov
              shadowbug Shadow Bug
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: