salilbc / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

NPE when calling Response.sessionId() and cookies are null #173

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Make a REST call on a server, that will return an error (in my case, 
status=400), this way, no cookies will be returned in the response
2. Try to call response.sessionId() on the Response object : there will be a 
NPE with following stacktrace :
java.lang.NullPointerException: Cannot invoke method getValue() on null object
    at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:77)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
    at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:32)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
    at com.jayway.restassured.response.Cookies$getValue.call(Unknown Source)
    at com.jayway.restassured.internal.RestAssuredResponseImpl.cookie(RestAssuredResponseImpl.groovy:259)
    at com.jayway.restassured.response.Response$cookie.callCurrent(Unknown Source)
    at com.jayway.restassured.internal.RestAssuredResponseImpl.getSessionId(RestAssuredResponseImpl.groovy:291)
    at com.jayway.restassured.internal.RestAssuredResponseImpl.sessionId(RestAssuredResponseImpl.groovy:287)
    at fr.fcamblor.demos.sbjd.test.rules.RequiresDefaultRestAssuredConfiguration$KeepingSessionIdAmongRequestsFilter.filter(RequiresDefaultRestAssuredConfiguration.java:43)

What is the expected output? What do you see instead?
I would have expected a null sessionId instead of a NPE.

What version of the product are you using? On what operating system?
Rest Assured 1.6.1

Please provide any additional information below.

Original issue reported on code.google.com by fcamb...@gmail.com on 21 May 2012 at 10:53

GoogleCodeExporter commented 9 years ago
Thanks for reporting

Original comment by johan.ha...@gmail.com on 22 May 2012 at 6:16

GoogleCodeExporter commented 9 years ago
I've now fixed this in trunk

Original comment by johan.ha...@gmail.com on 22 May 2012 at 6:26

GoogleCodeExporter commented 9 years ago
I confirm this fixes the NPE prior to 1.6.2

Original comment by fcamb...@gmail.com on 29 May 2012 at 7:43