You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2011/11/18 16:12:18 UTC

svn commit: r1203688 - /tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSAsyncInterfaceProcessor.java

Author: antelder
Date: Fri Nov 18 15:12:18 2011
New Revision: 1203688

URL: http://svn.apache.org/viewvc?rev=1203688&view=rev
Log:
Fix a couple of NPE and index out of bound exceptions for async operations with void return types

Modified:
    tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSAsyncInterfaceProcessor.java

Modified: tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSAsyncInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSAsyncInterfaceProcessor.java?rev=1203688&r1=1203687&r2=1203688&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSAsyncInterfaceProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSAsyncInterfaceProcessor.java Fri Nov 18 15:12:18 2011
@@ -101,7 +101,10 @@ public class JAXWSAsyncInterfaceProcesso
         }
 
         //a return type of Response<R> where R is the return type of M
-        DataType<?> operationOutputType = operation.getOutputType().getLogical().get(0);
+        DataType<?> operationOutputType = null;
+        if (operation.getOutputType()!= null && operation.getOutputType().getLogical() != null && operation.getOutputType().getLogical().size() > 0) {
+            operationOutputType = operation.getOutputType().getLogical().get(0);
+        }
         DataType<?> asyncOperationOutputType = asyncOperation.getOutputType().getLogical().get(0);
 
         if (operationOutputType != null && asyncOperationOutputType != null) {
@@ -173,7 +176,6 @@ public class JAXWSAsyncInterfaceProcesso
         Class<?> asyncLastParameterTypeClass = asyncOperationInputType.get(size).getPhysical();
         if (asyncLastParameterTypeClass == AsyncHandler.class) {
             //now check the actual type of the AsyncHandler<R> with R
-            Class<?> returnType = operation.getOutputType().getLogical().get(0).getPhysical();
             Class<?> asyncActualLastParameterTypeClass = Object.class;
             if (genericParamType instanceof ParameterizedType) {
                 ParameterizedType asyncLastParameterType = (ParameterizedType)genericParamType;
@@ -188,12 +190,17 @@ public class JAXWSAsyncInterfaceProcesso
                 }
             }
 
-            if (returnType == asyncActualLastParameterTypeClass || returnType.isPrimitive()
-                && primitiveAssignable(returnType, asyncActualLastParameterTypeClass)) {
-                return true;
-            } else {
-                return false;
+            Class<?> returnType = null;
+            if (operation.getOutputType() != null && operation.getOutputType().getLogical() != null && operation.getOutputType().getLogical().size() > 0) {
+                returnType = operation.getOutputType().getLogical().get(0).getPhysical();
+            }
+            if (returnType != null) {
+                if (returnType == asyncActualLastParameterTypeClass || returnType.isPrimitive()
+                    && primitiveAssignable(returnType, asyncActualLastParameterTypeClass)) {
+                    return true;
+                }
             }
+            return false;
         }
 
         return true;