Layer7 API Management

Expand all | Collapse all

XPath-Query 1.0 throws NullpointerException

Jump to Best Answer
  • 1.  XPath-Query 1.0 throws NullpointerException

    Posted 03-15-2017 09:19 AM

    Hi 

    Given an XML document without namespaces

    <?xml version="1.0" encoding="UTF-8" ?>
    <document/>

    and I query with XPath 1.0 for the namespace

    The XPath assertion fails, the policy immediately aborts and the client gets a NullpointerException:

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <soapenv:Body>
            <soapenv:Fault>
                <faultcode>Server</faultcode>
                <faultstring>java.lang.NullPointerException</faultstring>
                <faultactor/>
                <detail/>
            </soapenv:Fault>
        </soapenv:Body>
    </soapenv:Envelope>

     

    When I do exactly the same but with XPath 2.0, it works perfectly. 

     

    Throwing an Exception and therefore immediately aborting the policy is a bit rude :-)

    I guess the NPE is thrown by the underlying Java Library but it should be catched so that only the assertion fails. 

     

    PS: Happens like this on Gateway 8.3.01

     

    Regards

    Stephan



  • 2.  Re: XPath-Query 1.0 throws NullpointerException

    Posted 03-23-2017 07:05 AM

    Hello Stephan,

     

    could you please address this in a Support Case.

     

    Support should have a look after this.

     

    Thanks

    Heinz-Dirk



  • 3.  Re: XPath-Query 1.0 throws NullpointerException

    Posted 03-24-2017 03:32 AM

    Hi Heinz-Dirk

     

    Done, case 00707767

     

    Regards

    Stephan



  • 4.  Re: XPath-Query 1.0 throws NullpointerException
    Best Answer

    Posted 04-04-2017 03:48 AM

    From Case notes 

     

    The described behavior is related to the XPath error handling and should be expected.
    The error handling has been enhanced in XPath 2.0.
    KB Article has been posted for this:
    TEC1784711 XPath-Query 1.0 throws NullPointerException

     

    https://www.ca.com/us/services-support/ca-support/ca-support-online/knowledge-base-articles.TEC1784711.html?intcmp=searc… 

     

    Regards

    Seenu Mathew