DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9683>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9683

NullPointerException when invoking function via xalan://FQCN

           Summary: NullPointerException when invoking function via
                    xalan://FQCN
           Product: XalanJ2
           Version: 2.3
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.extensions
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When passing a node reference to an extension function where the extension
function is declared using a namespace prefix, a null pointer exception occurs.

When passing the same node to the same function using a java:FQCN prefix there
is no problem. Neither is there a problem when passing a literal to the function.

In the following stylesheet, the first 5 calls to static method toUpper work;
only the 6th fails.

<?xml version="1.0"?> 
<xsl:stylesheet 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
   xmlns:java="http://xml.apache.org/xslt/java";
   xmlns:ecn="xalan://nz.co.ecnetwork.xsltmap.Extensions"
   version="1.0">

  <!-- Interchange Sender ID -->
  <xsl:param name="literalVar" select="'literal-var'"/>
  <xsl:param name="nodeVar">some-value</xsl:param>

  <xsl:template match="/">
    <xsl:value-of
select="java:nz.co.ecnetwork.xsltmap.Extensions.toUpper('literal')"/>
    <xsl:value-of
select="java:nz.co.ecnetwork.xsltmap.Extensions.toUpper($literalVar)"/>
    <xsl:value-of
select="java:nz.co.ecnetwork.xsltmap.Extensions.toUpper($nodeVar)"/>
    <xsl:value-of select="ecn:toUpper('literal')"/>
    <xsl:value-of select="ecn:toUpper($literalVar)"/>
    <xsl:value-of select="ecn:toUpper($nodeVar)"/>
  </xsl:template>
</xsl:stylesheet>

extension class:
package nz.co.ecnetwork.xsltmap;

public class Extensions
{
    /**
     * Convert input string to upper-case : test for Xalan-J bug
     */
    public static String toUpper(String str)
    {
        return str.toUpperCase();
    }
}

Reply via email to