jimma commented on a change in pull request #414: [CXF-7653]:Fix NPE in 
ClientProxy
URL: https://github.com/apache/cxf/pull/414#discussion_r185826292
 
 

 ##########
 File path: core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
 ##########
 @@ -657,24 +657,9 @@ private void enrichFault(Fault fault) {
         if (ex != null) {
             throw ex;
         }
-
-        if (resList == null   
-            && oi != null && !oi.getOperationInfo().isOneWay()) {
-            
-            BindingOperationInfo boi = oi;
-            if (boi.isUnwrapped()) {
-                boi = boi.getWrappedOperation();
-            }
-            if (!boi.getOutput().getMessageParts().isEmpty()) {
-                //we were supposed to get some output, but didn't
-                throw new IllegalStateException("Response message did not 
contain proper response data. Expected: "
-                    + 
boi.getOutput().getMessageParts().get(0).getConcreteName());
-            }
-        }
 
 Review comment:
   > Why is all this code removed? If the WSDL states that there should be a 
response and there isn't, an exception should be thrown. The above is correct. 
   
   When I ran reproducer EmptySoapBodyTest and found the NPE is thrown from 
Proxy class and root cause for this NPE is a null return value for a primitive 
type in InvocationHandler(ClientProxy), that's why I remove this and add this 
check in ClientProxy.  I only looked at EmptySoapBodayTest , any other 
reproducer I need to have a look for CXF-7653 ?
   
   Another reason why I remove these lines is this check doesn't work for this 
case: for example we have a simple wsdl which generates the following operation 
: 
   ```
   public HelloResponse doSomething(HelloRequest request);
   ```
   To work with Dispatch/Provider ,  a provider class created to simply return 
an empty StreamSource like:
   ```
   @WebServiceProvider(
             serviceName="HelloService",
             portName="HelloPort",
             targetNamespace="http://cxf.apache.org/provider";,
             wsdlLocation="WEB-INF/hello.wsdl"
     )
   @BindingType(value=javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING)
   @ServiceMode (value=javax.xml.ws.Service.Mode.PAYLOAD)
   public class HelloProvider implements Provider<Source> {
     public Source invoke(Source req)  {
         return new StreamSource();
     }
   }
   ```
   The client dispatch expects receiving a null value. Add this check in 
ClientImpl throws  IllegalStateException instead of return a null result.
   
   > By pushing some of this down into the ClientProxy's, anything that doesn't 
use the client proxies (like Camel endpoints) wouldn't have this check in place.
   
   For the caml endpoints without using the client proxy, it gets a null value 
result. Is the null value a problem for ClientCallback and something else ?  
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to