You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/03/09 04:19:38 UTC

svn commit: r920639 - in /cxf/branches/2.2.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java

Author: dkulp
Date: Tue Mar  9 03:19:31 2010
New Revision: 920639

URL: http://svn.apache.org/viewvc?rev=920639&view=rev
Log:
Merged revisions 920637 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r920637 | dkulp | 2010-03-08 22:15:00 -0500 (Mon, 08 Mar 2010) | 1 line
  
  [CXF-2698] Fix mapping to non-primitive types
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java?rev=920639&r1=920638&r2=920639&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java Tue Mar  9 03:19:31 2010
@@ -223,7 +223,7 @@ public class URIMappingInterceptor exten
             if (type != null && type.isPrimitive() && queries.get(key) != null) {
                 param = PrimitiveUtils.read(queries.get(key), type);
             } else {
-                param = queries.get(key);
+                param = readType(queries.get(key), type);
             }
             parameters.set(idx, param);
             
@@ -231,7 +231,27 @@ public class URIMappingInterceptor exten
         }
         return parameters;
     }
-    
+    private Object readType(String value, Class<?> type) {
+        Object ret = value;
+        if (Integer.class == type) {
+            ret = Integer.valueOf(value);
+        } else if (Byte.class == type) {
+            ret = Byte.valueOf(value);
+        } else if (Short.class == type) {
+            ret = Short.valueOf(value);
+        } else if (Long.class == type) {
+            ret = Long.valueOf(value);
+        } else if (Float.class == type) {
+            ret = Float.valueOf(value);
+        } else if (Double.class == type) { 
+            ret = Double.valueOf(value);
+        } else if (Boolean.class == type) { 
+            ret = Boolean.valueOf(value);
+        } else if (Character.class == type) { 
+            ret = value.charAt(0); 
+        }
+        return ret;
+    }
     private String uriDecode(String query) {
         try {
             query = URLDecoder.decode(query, "UTF-8");