cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5838] Setting a correct default char value
Date Wed, 09 Jul 2014 11:36:44 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 669e2f061 -> badfac577


[CXF-5838] Setting a correct default char value


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

Branch: refs/heads/master
Commit: badfac57768fdf8fdd2ec5179d3420fc8cd21c4b
Parents: 669e2f0
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Jul 9 12:36:28 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Jul 9 12:36:28 2014 +0100

----------------------------------------------------------------------
 .../java/org/apache/cxf/jaxrs/utils/InjectionUtils.java   |  3 ++-
 .../src/test/java/org/apache/cxf/jaxrs/Customer.java      |  3 ++-
 .../java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java   | 10 ++++++----
 3 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/badfac57/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
----------------------------------------------------------------------
diff --git 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
index 8043da9..7cbfea9 100644
--- 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
@@ -917,7 +917,8 @@ public final class InjectionUtils {
             } else {
                 if (paramType.isPrimitive()) {
                     paramValues = Collections.singletonList(
-                        boolean.class == paramType ? "false" : "0");
+                        boolean.class == paramType ? "false" 
+                            : char.class == paramType ? Character.toString('\u0000') : "0");
                 } else if (InjectionUtils.isSupportedCollectionOrArray(paramType)) {
                     paramValues = Collections.emptyList();
                 } else {

http://git-wip-us.apache.org/repos/asf/cxf/blob/badfac57/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java
index 9bc29bb..f64ae66 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java
@@ -394,7 +394,8 @@ public class Customer extends AbstractCustomer implements CustomerInfo
{
                                   @QueryParam("query2") String queryString2,
                                   @QueryParam("query3") Long queryString3,
                                   @QueryParam("query4") boolean queryBoolean4,
-                                  @QueryParam("query5") String queryString4) {
+                                  @QueryParam("query5") char queryChar5,
+                                  @QueryParam("query6") String queryString6) {
         // complete
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/badfac57/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
index cd0fb53..1e740a9 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
@@ -1428,12 +1428,12 @@ public class JAXRSUtilsTest extends Assert {
     @Test
     public void testMultipleQueryParameters() throws Exception {
         Class<?>[] argType = {String.class, String.class, Long.class, 
-                              Boolean.TYPE, String.class};
+                              Boolean.TYPE, char.class, String.class};
         Method m = Customer.class.getMethod("testMultipleQuery", argType);
         Message messageImpl = createMessage();
         
         messageImpl.put(Message.QUERY_STRING, 
-                        "query=first&query2=second&query3=3&query4=true&query5");
+                        "query=first&query2=second&query3=3&query4=true&query6");
         List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m,

                                                                new ClassResourceInfo(Customer.class)),

                                                            null, messageImpl);
@@ -1445,8 +1445,10 @@ public class JAXRSUtilsTest extends Assert {
                      new Long(3), params.get(2));
         assertEquals("Fourth Query Parameter of multiple was not matched correctly", 
                      Boolean.TRUE, params.get(3));
-        assertEquals("Fourth Query Parameter of multiple was not matched correctly", 
-                     "", params.get(4));
+        assertEquals("Fifth Query Parameter of multiple was not matched correctly", 
+                     '\u0000', params.get(4));
+        assertEquals("Six Query Parameter of multiple was not matched correctly", 
+                     "", params.get(5));
     }
     
     @SuppressWarnings("unchecked")


Mime
View raw message