Forum Discussion

SIERRA_NEVADA_C_1's avatar
SIERRA_NEVADA_C_1
Occasional Contributor
14 years ago

NullPointerException on an HttpResponse without an entity (n

The problem is an HttpResponse can have a null entity, and the code from SoapUI 4.0.2 assumes it is not null:

It is in the class: com.eviware.soapui.impl.wsdl.submit.filters.HttpPackagingResponseFilter

if( httpMethod.hasHttpResponse() )
{
responseContentTypeHeader = httpMethod.getHttpResponse().getEntity().getContentType();
}

Where as SoapUI 4.0.1 did not:
Header responseContentTypeHeader = httpMethod.getResponseHeader( "Content-Type");

When getEntity() returns null, the NullPointerExeption occurs.

4 Replies

  • Hi!

    thanks for the digging - will be fixed in the upcoming nightly.

    regards!

    /Ole
    SmartBear Software
  • SIERRA_NEVADA_C_1's avatar
    SIERRA_NEVADA_C_1
    Occasional Contributor
    Thanks for the quick response. Unfortunately, this change only kicked the can down the road a bit. Another place was updated between 4.0.1 and 4.0.2 that attempts to use HttpResponse.getEntity() without verifying it exists in HttpMethodSupport (line 269) that also results in an exception in this same scenario.

    We see getEntity() is actually used 12 times in 4.0.2, but did not analyze in which it can be reached where it would return null, and a null value would cause a problem. But it appears a precondition on most of the Apache wrappers is for a non-null value to be passed in.

    Thanks,
    SNC
  • Hello,

    thanks - we'll fix this as soon as possible (issue id=SOAPUI-3532).

    Regards,
    Vladimir
    SmartBear Software
  • Hello,

    this is fixed and will be released in the next nightly build.

    Regards,
    Vladimir
    SmartBear Software