Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-1048

NullPointerException if non-existent node passed to extension function

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Fixed
    • 2.3
    • None
    • Xalan-extensions
    • None
    • Operating System: Other
      Platform: Other
    • 9731

    Description

      If an extension function exists which takes a Node parameter, and an xslt tag
      specifies as a parameter a path to a node that does not exist, then a
      NullPointerException is thrown before the extension function is invoked.

      I would have expected null to be passed as the node instead.

      Note that if the extension function takes a String instead, an empty string is
      passed to the extension function in place of the invalid node.

      eg

      <?xml version="1.0"?>
      <xsl:stylesheet
      xmlns:xsl="http://www.w3c.org/1999/XSL/Transform"
      xmlns:ecn="xalan://nz.co.ecnetwork.xsltmap">

      <xsl:template match="/">
      <xsl:value-of select="ecn:Extensions.doIt(nosuchnode)"/>
      </xsl:template>

      package nz.co.ecnetwork.xsltmap;
      public class Extensions
      {
      public static String doIt(Node node)

      { System.err.println("this never gets called if node doesn't exist"); }

      }

      platform details:

      • sun java 1.4.0 on linux
      • xalan-j 2.3.1 (using java.endorsed.dirs to override rt.jar)
      • default xml parser
            • Any suggestions for workarounds for this problem welcome!!!!

      Attachments

        Activity

          People

            Unassigned Unassigned
            simon@ecnetwork.co.nz Simon Kitching
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: