You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ne...@apache.org on 2017/03/31 11:01:54 UTC

[1/2] cxf git commit: [CXF-6894] prevent NPE if request uses anonymous types

Repository: cxf
Updated Branches:
  refs/heads/master 6fd76780c -> 0dc7db7aa


[CXF-6894] prevent NPE if request uses anonymous types


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

Branch: refs/heads/master
Commit: fe4c8b6e94fd286473f8ca3b626f08cee50d2ee2
Parents: 408fe33
Author: Neal Hu <ne...@apache.org>
Authored: Fri Mar 31 17:54:17 2017 +0800
Committer: Neal Hu <ne...@apache.org>
Committed: Fri Mar 31 17:54:17 2017 +0800

----------------------------------------------------------------------
 .../jaxws/validator/WrapperStyleNameCollisionValidator.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/fe4c8b6e/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java
index 40e4fe0..b23b48c 100644
--- a/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java
+++ b/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/validator/WrapperStyleNameCollisionValidator.java
@@ -167,9 +167,11 @@ public class WrapperStyleNameCollisionValidator extends ServiceValidator {
                         String mappedName = mapElementName(operation,
                                                            operation.getUnwrappedOperation().getOutput(),
                                                            element);
+                        
+                        QName mn = names.get(mappedName);
                         if (names.containsKey(mappedName)
-                            &&  !(names.get(mappedName) == element.getSchemaTypeName()
-                                || names.get(mappedName).equals(element.getSchemaTypeName()))) {
+                            &&  !(mn == element.getSchemaTypeName()
+                                || (mn != null && mn.equals(element.getSchemaTypeName())))) {
                             handleErrors(names.get(mappedName), element);
                             return false;
                         } else {


[2/2] cxf git commit: [CXF-7307] fix the 404 error in empty string query parameter injection.

Posted by ne...@apache.org.
[CXF-7307] fix the 404 error in empty string query parameter injection.


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

Branch: refs/heads/master
Commit: 0dc7db7aa48f36235f33ff1e7281bec525222903
Parents: fe4c8b6 6fd7678
Author: Neal Hu <ne...@apache.org>
Authored: Fri Mar 31 17:56:57 2017 +0800
Committer: Neal Hu <ne...@apache.org>
Committed: Fri Mar 31 17:56:57 2017 +0800

----------------------------------------------------------------------
 .../org/apache/cxf/common/util/PrimitiveUtils.java  |  5 +++++
 .../org/apache/cxf/jaxrs/utils/InjectionUtils.java  |  5 +++++
 .../apache/cxf/jaxrs/utils/InjectionUtilsTest.java  | 16 ++++++++++++++++
 3 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/0dc7db7a/core/src/main/java/org/apache/cxf/common/util/PrimitiveUtils.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/cxf/common/util/PrimitiveUtils.java
index 1c1b9ff,1c1b9ff..86c175c
--- a/core/src/main/java/org/apache/cxf/common/util/PrimitiveUtils.java
+++ b/core/src/main/java/org/apache/cxf/common/util/PrimitiveUtils.java
@@@ -74,6 -74,6 +74,11 @@@ public final class PrimitiveUtils 
      }
  
      public static <T> Object read(String value, Class<T> type) {
++        if (!(Character.TYPE.equals(type) || Character.class.equals(type))
++            && value != null && value.equals("")) {
++            //pass empty string to number type will result in Exception
++            value = "0";
++        }
          Object ret = value;
          if (Integer.TYPE.equals(type) || Integer.class.equals(type)) {
              ret = Integer.valueOf(value);

http://git-wip-us.apache.org/repos/asf/cxf/blob/0dc7db7a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
----------------------------------------------------------------------
diff --cc rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
index 1f278ae,1f278ae..334a464
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
@@@ -433,6 -433,6 +433,11 @@@ public final class InjectionUtils 
              }
              return theResult;
          }
++
++        if (Number.class.isAssignableFrom(pClass) && "".equals(value)) {
++            //pass empty string to boxed number type will result in 404
++            return null;
++        }
          if (pClass.isPrimitive()) {
              try {
                  T ret = (T)PrimitiveUtils.read(value, pClass);

http://git-wip-us.apache.org/repos/asf/cxf/blob/0dc7db7a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
----------------------------------------------------------------------
diff --cc rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
index 3c96039,3c96039..dafb8ae
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
@@@ -150,6 -150,6 +150,22 @@@ public class InjectionUtilsTest extend
      }
  
      @Test
++    public void testInstantiateIntegerInQuery() {
++        Integer integer = InjectionUtils.handleParameter("", false, Integer.class,
++                Integer.class, null,
++                ParameterType.QUERY, null);
++        assertNull("Integer is not null", integer);
++    }
++
++    @Test
++    public void testInstantiateFloatInQuery() {
++        Float f = InjectionUtils.handleParameter("", false, float.class,
++                float.class, null,
++                ParameterType.QUERY, null);
++        assertEquals("Long is not 0", Float.valueOf(0F), f);
++    }
++
++    @Test
      public void testGenericInterfaceType() throws NoSuchMethodException {
          Type str = InjectionUtils.getGenericResponseType(GenericInterface.class.getMethod("get"),
                         TestService.class, "", String.class, new ExchangeImpl());