Skip to content

SaajSoap11Body.getFault() does not conforms to interface specification - if no fault is present IllegalArgumentException is thrown instead of returning null. [SWS-486] #619

@gregturn

Description

@gregturn

Oleksandr Alesinskyy opened SWS-486 and commented

Hi,

the call

SoapFault bodyFault = body == null ? null : body.getFault();

returns following exception (line numbers are from Spring-WS 1.5.1, but relevant code is the same in 1.5.6 as well).

java.lang.IllegalArgumentException: element must not be null
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.ws.soap.saaj.SaajSoapElement.<init>(SaajSoapElement.java:40)
at org.springframework.ws.soap.saaj.SaajSoapFault.<init>(SaajSoapFault.java:36)
at org.springframework.ws.soap.saaj.SaajSoap11Fault.<init>(SaajSoap11Fault.java:34)
at org.springframework.ws.soap.saaj.SaajSoap11Body.getFault(SaajSoap11Body.java:45)
at com.navteq.ncs.common.core.utils.aop.EndpointInvokeInterceptor.checkResult(EndpointInvokeInterceptor.java:46)

while SoapBody interface Javadoc states for this method:
Returns:
the SoapFault, or null if none is present

The getFault() method in the class SaajSoap11Body may be modified as follows

public SoapFault getFault() {
    SOAPFault fault = getImplementation().getFault(getSaajBody());
    return fault==null ? null : new SaajSoap11Fault(fault);
}

Affects: 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6

Referenced from: commits 2004935

1 votes, 0 watchers

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions