cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1127855 - in /cxf/branches/2.3.x-fixes: ./ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/ systests/databinding/src/test/java/org/apache/cxf/systest/aegis/
Date Thu, 26 May 2011 10:13:33 GMT
Author: ffang
Date: Thu May 26 10:13:32 2011
New Revision: 1127855

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

........
  r1127829 | ffang | 2011-05-26 16:52:56 +0800 (四, 26  5 2011) | 1 line
  
  [CXF-3527]NPE while use generic in collections with aegis databinding
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
    cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
    cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java
    cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java

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

Modified: cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java?rev=1127855&r1=1127854&r2=1127855&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
Thu May 26 10:13:32 2011
@@ -22,6 +22,7 @@ import java.beans.PropertyDescriptor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
 import java.util.Collection;
 import java.util.Map;
 
@@ -103,12 +104,14 @@ public abstract class AbstractTypeCreato
     }
 
     public AegisType createTypeForClass(TypeClassInfo info) {
-
+        
         Class javaClass = TypeUtil.getTypeRelatedClass(info.getType());
         AegisType result = null;
         boolean newType = true;
-
-        if (info.getAegisTypeClass() != null) {
+        if (info.getType() instanceof TypeVariable) {
+            //it's the generic type
+            result = getOrCreateGenericType(info);
+        } else if (info.getAegisTypeClass() != null) {
             result = createUserType(info);
         } else if (isArray(javaClass)) {
             result = createArrayType(info);

Modified: cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java?rev=1127855&r1=1127854&r2=1127855&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
Thu May 26 10:13:32 2011
@@ -22,6 +22,7 @@ package org.apache.cxf.systest.aegis;
 
 import java.lang.reflect.Method;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
@@ -178,6 +179,21 @@ public class AegisClientServerTest exten
         assertEquals(result.toString(), "{key1={1=3}}");
     }
     
+    @Test
+    public void testGenericCollection() throws Exception {
+        AegisDatabinding aegisBinding = new AegisDatabinding();
+        JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
+        proxyFactory.setDataBinding(aegisBinding);
+        proxyFactory.setServiceClass(SportsService.class);
+        proxyFactory.setAddress("http://localhost:" + PORT + "/jaxwsAndAegisSports");
+        proxyFactory.getInInterceptors().add(new LoggingInInterceptor());
+        proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor());
+        SportsService service = (SportsService) proxyFactory.create();
+        List<String> list = new ArrayList<String>();
+        list.add("ffang");
+        String ret = service.getGeneric(list);
+        assertEquals(ret, "ffang");
+    }
           
     @Test
     public void testDynamicClient() throws Exception {

Modified: cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java?rev=1127855&r1=1127854&r2=1127855&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsService.java
Thu May 26 10:13:32 2011
@@ -43,4 +43,6 @@ public interface SportsService {
     }
 
     Map<String, Map<Integer, Integer>> testComplexMapResult();
+    
+    <T> T getGeneric(Collection<T> collection);
 }

Modified: cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java?rev=1127855&r1=1127854&r2=1127855&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java
Thu May 26 10:13:32 2011
@@ -22,6 +22,7 @@ package org.apache.cxf.systest.aegis;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -60,5 +61,16 @@ public class SportsServiceImpl implement
         return result;
 
     }
+
+   
+    public <T> T getGeneric(Collection<T> collection) {
+        Iterator<T> iter = collection.iterator();
+        
+        T ret = null;
+        if (iter.hasNext()) {
+            ret = iter.next();
+        }
+        return ret;
+    }
       
 }



Mime
View raw message