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=11792>.
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=11792

XPathAPI throws NPE If Any Extension Function Used

           Summary: XPathAPI throws NPE If Any Extension Function Used
           Product: XalanJ2
           Version: 2.4Dx
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: org.apache.xpath
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


XPathAPI constructs an XPathContext using the
default ctor (i.e. not supplying an ExtensionProvider).

Thus, when any attempt is made to call an
extension function, a null ExtensionProvider pointer
is retrieved and dereferenced resulting in NPE at FuncExtFunction.java:196.

XPathContext is constructed in XPathAPI.java or
CachedXPathAPI.java (e.g. xpathSupport = new XPathContext();).

XPath used: /ico/keywords/keyword[regexp:containsMatch('ll*', 'llal')]

containsMatch is defined in the PatternMatcher class (no package).

PatternMatcher source and instructions are available at:

http://www-106.ibm.com/developerworks/library/x-callbk/?open&l=976,t=gr

Tested using ApplyXPath sample.

Test Document used was:

<ico xmlns:regexp="xalan://PatternMatcher">
        <id>423234</id>
        <keywords>
                <keyword>Haus</keyword>
                <keyword>Baum</keyword>
                <keyword>Auto</keyword>
                <keyword>Boot</keyword>
                <keyword>Sonne</keyword>
        </keywords>
        <faws>
                <faw>Meier</faw>
                <faw>Muller</faw>
                <faw>Bremen</faw>
                <faw>Winter</faw>
                <faw>Boot</faw>
                <faw>PC</faw>
        </faws>
        <author>Heiner Meier</author>
        <words>502</words>
        <date>19082002</date>
</ico>

Stack trace wass:

Exception in thread "main" java.lang.NullPointerException
        at org.apache.xpath.functions.FuncExtFunction.execute
(FuncExtFunction.java:196)
        at org.apache.xpath.axes.PredicatedNodeTest.executePredicates
(PredicatedNodeTest.java:326)
        at org.apache.xpath.axes.PredicatedNodeTest.acceptNode
(PredicatedNodeTest.java:458)
        at org.apache.xpath.axes.AxesWalker.nextNode(AxesWalker.java:406)
        at org.apache.xpath.axes.WalkingIterator.nextNode
(WalkingIterator.java:176)
        at org.apache.xpath.axes.NodeSequence.nextNode(NodeSequence.java:320)
        at org.apache.xml.dtm.ref.DTMNodeIterator.nextNode
(DTMNodeIterator.java:195)
        at ApplyXPath.doMain(ApplyXPath.java:134)
        at ApplyXPath.main(ApplyXPath.java:183)

Have seen similar results attempting to use EXSLT functions via XPathAPI.

The implication, planned or not, is that XPathAPI and CachedXPathAPI
currently do not support the use of extension functions.

Reply via email to