NPE in xpath match when using wildcards
Xpath math throws null pointer exception when test run multiple times. Note: it works the first time. We have many tests with wildcard match and only 2 or 3 have issues. Here is response xml: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:findCustomerAccountResponse xmlns:ns2="http://ws.api.meveo.org/"> <return> <actionStatus> <status>SUCCESS</status> </actionStatus> <customerAccount code="WS_FULL_104_PRE46_Payment"> <created>2017-10-20T12:05:40.623-03:00</created> <customer>WS_BASE_CUST</customer> <currency>EUR</currency> <language>FRA</language> <status>ACTIVE</status> <dateStatus>2017-10-20T12:05:40.621-03:00</dateStatus> <dateDunningLevel>2017-10-20T12:05:40.621-03:00</dateDunningLevel> <dunningLevel>R0</dunningLevel> <balance>0</balance> <totalInvoiceBalance>0</totalInvoiceBalance> <paymentMethods> <methodOfPayment paymentMethodType="DIRECTDEBIT"> <id>83</id> <disabled>false</disabled> <preferred>false</preferred> <customerAccountCode>WS_FULL_104_PRE46_Payment</customerAccountCode> <bankCoordinates> <bankCode>12456</bankCode> <branchCode>23456</branchCode> <accountNumber>34589324756</accountNumber> <key>45</key> <iban>1212</iban> <bic>67789456</bic> <accountOwner>Me and co</accountOwner> <bankName>Some bank</bankName> <bankId>78946</bankId> <issuerNumber>46789</issuerNumber> <issuerName>Some issuer</issuerName> <ics>5587</ics> </bankCoordinates> </methodOfPayment> <methodOfPayment paymentMethodType="DIRECTDEBIT"> <id>84</id> <disabled>false</disabled> <preferred>false</preferred> <customerAccountCode>WS_FULL_104_PRE46_Payment</customerAccountCode> <bankCoordinates> <bankCode>33333</bankCode> <branchCode>23456</branchCode> <accountNumber>34589324756</accountNumber> <key>45</key> <iban>1313</iban> <bic>67789456</bic> <accountOwner>Me and co</accountOwner> <bankName>Some bank</bankName> <bankId>78946</bankId> <issuerNumber>46789</issuerNumber> <issuerName>Some issuer</issuerName> <ics>5587</ics> </bankCoordinates> </methodOfPayment> <methodOfPayment paymentMethodType="WIRETRANSFER"> <id>82</id> <disabled>false</disabled> <preferred>true</preferred> <customerAccountCode>WS_FULL_104_PRE46_Payment</customerAccountCode> </methodOfPayment> </paymentMethods> <excludedFromPayment>false</excludedFromPayment> <paymentMethod>DIRECTDEBIT</paymentMethod> <billingAccounts> <billingAccount code="WS_FULL_104_PRE46_Payment-3"> <created>2017-10-20T12:05:41.721-03:00</created> <customerAccount>WS_FULL_104_PRE46_Payment</customerAccount> <billingCycle>CYC_INV_MT_1</billingCycle> <country>US</country> <language>ENG</language> <nextInvoiceDate>2016-04-01T00:00:00-03:00</nextInvoiceDate> <subscriptionDate>2016-01-01T00:00:00-03:00</subscriptionDate> <electronicBilling>false</electronicBilling> <status>ACTIVE</status> <statusDate>2017-10-20T12:05:41.721-03:00</statusDate> <paymentMethod>WIRETRANSFER</paymentMethod> <userAccounts/> </billingAccount> <billingAccount code="WS_FULL_104_PRE46_Payment-4"> <created>2017-10-20T12:05:42.195-03:00</created> <customerAccount>WS_FULL_104_PRE46_Payment</customerAccount> <billingCycle>CYC_INV_MT_1</billingCycle> <country>US</country> <language>ENG</language> <nextInvoiceDate>2016-04-01T00:00:00-03:00</nextInvoiceDate> <subscriptionDate>2016-01-01T00:00:00-03:00</subscriptionDate> <electronicBilling>false</electronicBilling> <status>ACTIVE</status> <statusDate>2017-10-20T12:05:42.194-03:00</statusDate> <paymentMethod>WIRETRANSFER</paymentMethod> <userAccounts/> </billingAccount> <billingAccount code="WS_FULL_104_PRE46_Payment-5"> <created>2017-10-20T12:05:42.666-03:00</created> <customerAccount>WS_FULL_104_PRE46_Payment</customerAccount> <billingCycle>CYC_INV_MT_1</billingCycle> <country>US</country> <language>ENG</language> <nextInvoiceDate>2016-04-01T00:00:00-03:00</nextInvoiceDate> <subscriptionDate>2016-01-01T00:00:00-03:00</subscriptionDate> <electronicBilling>false</electronicBilling> <status>ACTIVE</status> <statusDate>2017-10-20T12:05:42.666-03:00</statusDate> <paymentMethod>WIRETRANSFER</paymentMethod> <userAccounts/> </billingAccount> </billingAccounts> </customerAccount> </return> </ns2:findCustomerAccountResponse> </soap:Body> </soap:Envelope> Here is http log: Fri Oct 20 12:12:42 ART 2017:DEBUG:>> "POST /opencell/AccountWs HTTP/1.1[\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> "Accept-Encoding: gzip,deflate[\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> "Content-Type: text/xml;charset=UTF-8[\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> "SOAPAction: ""[\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> "Authorization: Basic b3BlbmNlbGwuYWRtaW46b3BlbmNlbGwuYWRtaW4=[\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> "Content-Length: 338[\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> "Host: localhost:8080[\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> "Connection: Keep-Alive[\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> "[\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> "[\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> " [\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> " [\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> " [\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> " WS_FULL_104_PRE46_Payment[\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> " [\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> " [\r][\n]" Fri Oct 20 12:12:42 ART 2017:DEBUG:>> "" Fri Oct 20 12:12:44 ART 2017:DEBUG:<< "HTTP/1.1 200 OK[\r][\n]" Fri Oct 20 12:12:44 ART 2017:DEBUG:<< "Expires: 0[\r][\n]" Fri Oct 20 12:12:44 ART 2017:DEBUG:<< "Cache-Control: no-cache, no-store, must-revalidate[\r][\n]" Fri Oct 20 12:12:44 ART 2017:DEBUG:<< "X-Powered-By: Undertow/1[\r][\n]" Fri Oct 20 12:12:44 ART 2017:DEBUG:<< "Server: WildFly/10[\r][\n]" Fri Oct 20 12:12:44 ART 2017:DEBUG:<< "Pragma: no-cache[\r][\n]" Fri Oct 20 12:12:44 ART 2017:DEBUG:<< "Date: Fri, 20 Oct 2017 15:12:44 GMT[\r][\n]" Fri Oct 20 12:12:44 ART 2017:DEBUG:<< "Connection: keep-alive[\r][\n]" Fri Oct 20 12:12:44 ART 2017:DEBUG:<< "Content-Type: text/xml;charset=UTF-8[\r][\n]" Fri Oct 20 12:12:44 ART 2017:DEBUG:<< "Content-Length: 3879[\r][\n]" Fri Oct 20 12:12:44 ART 2017:DEBUG:<< "[\r][\n]" Fri Oct 20 12:12:44 ART 2017:DEBUG:<< "SUCCESS2017-10-20T12:05:40.623-03:00WS_BASE_CUSTEURFRAACTIVE2017-10-20T12:05:40.621-03:002017-10-20T12:05:40.621-03:00R00083falsefalseWS_FULL_104_PRE46_Payment12456234563458932475645121267789456Me and coSome bank7894646789Some issuer558784falsefalseWS_FULL_104_PRE46_Payment33333234563458932475645131367789456Me and coSome bank7894646789Some issuer558782falsetrueWS_FULL_104_PRE46_PaymentfalseDIRECTDEBIT2017-10-20T12:05:41.721-03:00WS_FULL_104_PRE46_PaymentCYC_INV_MT_1USENG2016-04-01T00:00:00-03:002016-01-01T00:00:00-03:00falseACTIVE2017-10-20T12:05:41.721-03:00WIRETRANSFER<billi" <li="">Fri Oct 20 12:12:44 ART 2017:DEBUG:<< "ngAccount code="WS_FULL_104_PRE46_Payment-4">2017-10-20T12:05:42.195-03:00WS_FULL_104_PRE46_PaymentCYC_INV_MT_1USENG2016-04-01T00:00:00-03:002016-01-01T00:00:00-03:00falseACTIVE2017-10-20T12:05:42.194-03:00WIRETRANSFER2017-10-20T12:05:42.666-03:00WS_FULL_104_PRE46_PaymentCYC_INV_MT_1USENG2016-04-01T00:00:00-03:002016-01-01T00:00:00-03:00falseACTIVE2017-10-20T12:05:42.666-03:00WIRETRANSFER" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> "POST /opencell/AccountWs HTTP/1.1[\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> "Accept-Encoding: gzip,deflate[\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> "Content-Type: text/xml;charset=UTF-8[\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> "SOAPAction: ""[\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> "Authorization: Basic b3BlbmNlbGwuYWRtaW46b3BlbmNlbGwuYWRtaW4=[\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> "Content-Length: 338[\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> "Host: localhost:8080[\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> "Connection: Keep-Alive[\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> "[\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> "[\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> " [\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> " [\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> " [\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> " WS_FULL_104_PRE46_Payment[\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> " [\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> " [\r][\n]" Fri Oct 20 12:27:22 ART 2017:DEBUG:>> "" Fri Oct 20 12:27:23 ART 2017:DEBUG:<< "HTTP/1.1 200 OK[\r][\n]" Fri Oct 20 12:27:23 ART 2017:DEBUG:<< "Expires: 0[\r][\n]" Fri Oct 20 12:27:23 ART 2017:DEBUG:<< "Cache-Control: no-cache, no-store, must-revalidate[\r][\n]" Fri Oct 20 12:27:23 ART 2017:DEBUG:<< "X-Powered-By: Undertow/1[\r][\n]" Fri Oct 20 12:27:23 ART 2017:DEBUG:<< "Server: WildFly/10[\r][\n]" Fri Oct 20 12:27:23 ART 2017:DEBUG:<< "Pragma: no-cache[\r][\n]" Fri Oct 20 12:27:23 ART 2017:DEBUG:<< "Date: Fri, 20 Oct 2017 15:27:23 GMT[\r][\n]" Fri Oct 20 12:27:23 ART 2017:DEBUG:<< "Connection: keep-alive[\r][\n]" Fri Oct 20 12:27:23 ART 2017:DEBUG:<< "Content-Type: text/xml;charset=UTF-8[\r][\n]" Fri Oct 20 12:27:23 ART 2017:DEBUG:<< "Content-Length: 3879[\r][\n]" Fri Oct 20 12:27:23 ART 2017:DEBUG:<< "[\r][\n]" Fri Oct 20 12:27:23 ART 2017:DEBUG:<< "SUCCESS2017-10-20T12:05:40.623-03:00WS_BASE_CUSTEURFRAACTIVE2017-10-20T12:05:40.621-03:002017-10-20T12:05:40.621-03:00R00083falsefalseWS_FULL_104_PRE46_Payment12456234563458932475645121267789456Me and coSome bank7894646789Some issuer558784falsefalseWS_FULL_104_PRE46_Payment33333234563458932475645131367789456Me and coSome bank7894646789Some issuer558782falsetrueWS_FULL_104_PRE46_PaymentfalseDIRECTDEBIT2017-10-20T12:05:41.721-03:00WS_FULL_104_PRE46_PaymentCYC_INV_MT_1USENG2016-04-01T00:00:00-03:002016-01-01T00:00:00-03:00falseACTIVE2017-10-20T12:05:41.721-03:00WIRETRANSFER<billi" <li="">Fri Oct 20 12:27:23 ART 2017:DEBUG:<< "ngAccount code="WS_FULL_104_PRE46_Payment-4">2017-10-20T12:05:42.195-03:00WS_FULL_104_PRE46_PaymentCYC_INV_MT_1USENG2016-04-01T00:00:00-03:002016-01-01T00:00:00-03:00falseACTIVE2017-10-20T12:05:42.194-03:00WIRETRANSFER2017-10-20T12:05:42.666-03:00WS_FULL_104_PRE46_PaymentCYC_INV_MT_1USENG2016-04-01T00:00:00-03:002016-01-01T00:00:00-03:00falseACTIVE2017-10-20T12:05:42.666-03:00WIRETRANSFER" Here is xpath being matched: //paymentMethods/methodOfPayment[bankCoordinates/iban="1313"] Expected result has checked "Allow wildcards" If we have in expected result this value, it will throw NPE: <methodOfPayment paymentMethodType="DIRECTDEBIT" xmlns:ns2="http://ws.api.meveo.org/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <id>*</id> <disabled>false</disabled> <preferred>false</preferred> <customerAccountCode>*</customerAccountCode> <bankCoordinates> <bankCode>33333</bankCode> <branchCode>23456</branchCode> <accountNumber>34589324756</accountNumber> <key>45</key> <iban>1313</iban> <bic>67789456</bic> <accountOwner>Me and co</accountOwner> <bankName>Some bank</bankName> <bankId>78946</bankId> <issuerNumber>46789</issuerNumber> <issuerName>Some issuer</issuerName> <ics>5587</ics> </bankCoordinates> </methodOfPayment> If I have this, it will match. Note that the only value changed is <customerAccountCode>*</customerAccountCode> to <customerAccountCode>WS_FULL_104_PRE46_Payment</customerAccountCode>: <methodOfPayment paymentMethodType="DIRECTDEBIT" xmlns:ns2="http://ws.api.meveo.org/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <id>*</id> <disabled>false</disabled> <preferred>false</preferred> <customerAccountCode>WS_FULL_104_PRE46_Payment</customerAccountCode> <bankCoordinates> <bankCode>33333</bankCode> <branchCode>23456</branchCode> <accountNumber>34589324756</accountNumber> <key>45</key> <iban>1313</iban> <bic>67789456</bic> <accountOwner>Me and co</accountOwner> <bankName>Some bank</bankName> <bankId>78946</bankId> <issuerNumber>46789</issuerNumber> <issuerName>Some issuer</issuerName> <ics>5587</ics> </bankCoordinates> </methodOfPayment> Error log is empty. Thanks, Andrius1.4KViews0likes1Comment