From 628701e626a0fbf4b345396f1bfbf22aa640ae13 Mon Sep 17 00:00:00 2001 From: antelder Date: Fri, 18 Nov 2011 15:12:18 +0000 Subject: Fix a couple of NPE and index out of bound exceptions for async operations with void return types git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1203688 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/jaxws/JAXWSAsyncInterfaceProcessor.java | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'sca-java-2.x/trunk') diff --git a/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSAsyncInterfaceProcessor.java b/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSAsyncInterfaceProcessor.java index 315054fc82..daa0bebd81 100644 --- a/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSAsyncInterfaceProcessor.java +++ b/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSAsyncInterfaceProcessor.java @@ -101,7 +101,10 @@ public class JAXWSAsyncInterfaceProcessor implements JavaInterfaceVisitor { } //a return type of Response 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 JAXWSAsyncInterfaceProcessor implements JavaInterfaceVisitor { Class asyncLastParameterTypeClass = asyncOperationInputType.get(size).getPhysical(); if (asyncLastParameterTypeClass == AsyncHandler.class) { //now check the actual type of the AsyncHandler 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 JAXWSAsyncInterfaceProcessor implements JavaInterfaceVisitor { } } - 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; -- cgit v1.2.3