cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject cxf git commit: [CXF-6716]:log warning message for a Holder parameter annoated with WebParam.Mode.IN property
Date Thu, 17 Dec 2015 14:04:38 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 926b49a9b -> e1736590c


[CXF-6716]:log warning message for a Holder parameter annoated with WebParam.Mode.IN property


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e1736590
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e1736590
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e1736590

Branch: refs/heads/3.0.x-fixes
Commit: e1736590c466a70c14c3cad6ff5a9c5b112216fb
Parents: 926b49a
Author: Jim Ma <ema@apache.org>
Authored: Thu Dec 17 21:39:39 2015 +0800
Committer: Jim Ma <ema@apache.org>
Committed: Thu Dec 17 22:04:09 2015 +0800

----------------------------------------------------------------------
 .../support/JaxWsServiceConfiguration.java      | 17 ++++++++++++++-
 .../factory/AbstractServiceConfiguration.java   |  4 ++++
 .../wsdl/service/factory/Messages.properties    |  3 +++
 .../factory/ReflectionServiceFactoryBean.java   | 22 ++++++++++++++++----
 4 files changed, 41 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e1736590/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
index c85f58f..80043f5 100644
--- a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
+++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
@@ -544,9 +544,24 @@ public class JaxWsServiceConfiguration extends AbstractServiceConfiguration
{
         if (webParam != null && (webParam.mode().equals(Mode.OUT) || webParam.mode().equals(Mode.INOUT)))
{
             return Boolean.TRUE;
         }
-        
         return method.getParameterTypes()[j] == Holder.class;
     }
+    
+    @Override
+    public Boolean isInOutParam(Method method, int j) {
+        method = getDeclaredMethod(method);
+        if (j == -1) {
+            return !method.getReturnType().equals(void.class);
+        }
+
+        WebParam webParam = getWebParam(method, j);
+
+        if (webParam != null && webParam.mode().equals(Mode.INOUT)) {
+            return Boolean.TRUE;
+        }
+        return Boolean.FALSE;
+    }
+    
 
     @Override
     public QName getRequestWrapperName(OperationInfo op, Method method) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/e1736590/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/AbstractServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/AbstractServiceConfiguration.java
b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/AbstractServiceConfiguration.java
index 0767166..f86bf99 100644
--- a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/AbstractServiceConfiguration.java
+++ b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/AbstractServiceConfiguration.java
@@ -79,6 +79,10 @@ public abstract class AbstractServiceConfiguration {
     public Boolean isInParam(Method method, int j) {
         return null;
     }
+    
+    public Boolean isInOutParam(Method method, int j) {
+        return null;
+    }
 
     public QName getInputMessageName(final OperationInfo op, Method method) {
         return null;

http://git-wip-us.apache.org/repos/asf/cxf/blob/e1736590/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/Messages.properties
----------------------------------------------------------------------
diff --git a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/Messages.properties
b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/Messages.properties
index 5d2d561..30694f5 100644
--- a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/Messages.properties
+++ b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/Messages.properties
@@ -37,3 +37,6 @@ NO_WSDL_PROVIDED=WSDL is required for services created from class {0}, but
no WS
 NO_WSDL_NO_SERVICE_CLASS_PROVIDED=No valid WSDL {0} nor service class is specified.
 NO_FAULT_PART = Could not find a fault part for {0}. The fault message must have a single
part.
 INVALID_BARE_METHOD= Method {0} is configured as BARE but there are more than one parameters
with wrong @Webparam annotated or without @WebParam annotated.
+INVALID_WEBPARAM_MODE = Method {0} has a javax.xml.ws.Holder parameter which should not be
annotated with the WebParam.Mode.IN
+
+

http://git-wip-us.apache.org/repos/asf/cxf/blob/e1736590/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
----------------------------------------------------------------------
diff --git a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
index 23b84fa..a6a5e1f 100644
--- a/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
+++ b/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
@@ -1485,7 +1485,7 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
         serviceInfo.addSchema(schemaInfo);
         return schemaInfo;
     }
-
+    // CHECKSTYLE:OFF
     protected void createMessageParts(InterfaceInfo intf, OperationInfo op, Method method)
{
         final Class<?>[] paramClasses = method.getParameterTypes();
         // Setup the input message
@@ -1493,6 +1493,7 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
         MessageInfo inMsg = op.createMessage(this.getInputMessageName(op, method), MessageInfo.Type.INPUT);
         op.setInput(inMsg.getName().getLocalPart(), inMsg);
         final Annotation[][] parAnnotations = method.getParameterAnnotations();
+    // CHECKSTYLE:ON
         final Type[] genParTypes = method.getGenericParameterTypes();
         for (int j = 0; j < paramClasses.length; j++) {
             if (Exchange.class.equals(paramClasses[j])) {
@@ -1508,9 +1509,12 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
                     q = new QName(q.getNamespaceURI(), q.getLocalPart() + j);
                 }
                 MessagePartInfo part = inMsg.addMessagePart(partName);
-
-
-
+                
+                if (isHolder(paramClasses[j], genParTypes[j]) && !isInOutParam(method,
j)) {
+                    LOG.log(Level.WARNING, "INVALID_WEBPARAM_MODE", getServiceClass().getName()
+ "."
+                                                                    + method.getName());
+                }
+                // CHECKSTYLE:ON
                 initializeParameter(part, paramClasses[j], genParTypes[j]);
                 //TODO:remove method param annotations
                 part.setProperty(METHOD_PARAM_ANNOTATIONS, parAnnotations);
@@ -2003,6 +2007,16 @@ public class ReflectionServiceFactoryBean extends org.apache.cxf.service.factory
         }
         return true;
     }
+    
+    protected boolean isInOutParam(Method method, int j) {
+        for (AbstractServiceConfiguration c : serviceConfigurations) {
+            Boolean b = c.isInOutParam(method, j);
+            if (b != null) {
+                return b.booleanValue();
+            }
+        }
+        return true;
+    }
 
     protected QName getInputMessageName(final OperationInfo op, final Method method) {
         for (AbstractServiceConfiguration c : serviceConfigurations) {


Mime
View raw message