You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by em...@apache.org on 2015/12/17 14:42:40 UTC
cxf git commit: [CXF-6716]:log warning message for a Holder parameter
annoated with WebParam.Mode.IN property
Repository: cxf
Updated Branches:
refs/heads/master cc366789f -> 9c00297ef
[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/9c00297e
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9c00297e
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9c00297e
Branch: refs/heads/master
Commit: 9c00297ef2cfa776ce678a302bb14d87da219cf2
Parents: cc36678
Author: Jim Ma <em...@apache.org>
Authored: Thu Dec 17 21:39:39 2015 +0800
Committer: Jim Ma <em...@apache.org>
Committed: Thu Dec 17 21:42:02 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/9c00297e/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/9c00297e/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/9c00297e/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/9c00297e/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 75adeb4..f3cc641 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) {