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=9731>. 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=9731 NullPointerException if non-existent node passed to extension function Summary: NullPointerException if non-existent node passed to extension function Product: XalanJ2 Version: 2.3 Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: org.apache.xalan.extensions AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] 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!!!!