cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r718512 - in /cxf/branches/2.1.x-fixes: ./ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/collection/ rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/
Date Tue, 18 Nov 2008 07:09:44 GMT
Author: ningjiang
Date: Mon Nov 17 23:09:41 2008
New Revision: 718512

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

........
  r714245 | bimargulies | 2008-11-15 20:58:24 +0800 (Sat, 15 Nov 2008) | 3 lines
  
  Fix CXF-1906 and some related issues involving collection subtypes. We still have java.util
namespace bugs 
  lurking, but I'm not chasing them today.
........

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/collection/CollectionType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.aegis.xml
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest$CollectionService.aegis.xml
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 17 23:09:41 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708417,708550,708554,709353-709354,709425,710076,710150,710154,71138
 8,711410,711490,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713804,713899,714167-714168
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708417,708550,708554,709353-709354,709425,710076,710150,710154,71138
 8,711410,711490,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713804,713899,714167-714168,714245

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

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/collection/CollectionType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/collection/CollectionType.java?rev=718512&r1=718511&r2=718512&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/collection/CollectionType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/collection/CollectionType.java
Mon Nov 17 23:09:41 2008
@@ -22,9 +22,11 @@
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 import java.util.SortedSet;
+import java.util.Stack;
 import java.util.TreeSet;
 import java.util.Vector;
 
@@ -57,23 +59,34 @@
     @SuppressWarnings("unchecked")
     protected Collection<Object> createCollection() {
         Collection values = null;
-
-        if (getTypeClass().isAssignableFrom(List.class)) {
+        
+        /*
+         * getTypeClass returns the type of the object. These ifs asked if the proposed
+         * type can be assigned to the object, not the other way around. Thus List before
+         * Vector and Set before SortedSet.
+         */
+        
+        Class userTypeClass = getTypeClass();
+        if (userTypeClass.isAssignableFrom(List.class)) {
             values = new ArrayList();
-        } else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
-            values = new TreeSet();
-        } else if (getTypeClass().isAssignableFrom(Set.class)) {
+        } else if (userTypeClass.isAssignableFrom(LinkedList.class)) {
+            values = new LinkedList();
+        } else if (userTypeClass.isAssignableFrom(Set.class)) {
             values = new HashSet();
-        } else if (getTypeClass().isAssignableFrom(Vector.class)) {
+        } else if (userTypeClass.isAssignableFrom(SortedSet.class)) {
+            values = new TreeSet();
+        } else if (userTypeClass.isAssignableFrom(Vector.class)) {
             values = new Vector();
-        } else if (getTypeClass().isInterface()) {
+        } else if (userTypeClass.isAssignableFrom(Stack.class)) {
+            values = new Stack();
+        } else if (userTypeClass.isInterface()) {
             values = new ArrayList();
         } else {
             try {
-                values = (Collection<Object>)getTypeClass().newInstance();
+                values = (Collection<Object>)userTypeClass.newInstance();
             } catch (Exception e) {
                 throw new DatabindingException("Could not create map implementation: "
-                                               + getTypeClass().getName(), e);
+                                               + userTypeClass.getName(), e);
             }
         }
 

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.aegis.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.aegis.xml?rev=718512&r1=718511&r2=718512&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.aegis.xml
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.aegis.xml
Mon Nov 17 23:09:41 2008
@@ -9,5 +9,14 @@
         <method name="takeSortedStrings">
         	<parameter index="0" mappedName="strings"/>
         </method>
+        <method name="takeUnsortedSet">
+        	<parameter index="0" mappedName="strings"/>
+        </method>
+        <method name="takeStack">
+        	<parameter index="0" mappedName="strings"/>
+        </method>
+        <method name="takeArrayList">
+        	<parameter index="0" mappedName="strings"/>
+        </method>
 	</mapping>
 </mappings>
\ No newline at end of file

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java?rev=718512&r1=718511&r2=718512&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java
Mon Nov 17 23:09:41 2008
@@ -18,11 +18,13 @@
  */
 package org.apache.cxf.aegis.type.java5;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
 import java.util.SortedSet;
+import java.util.Stack;
 
-import javax.jws.WebParam;
 
 public interface CollectionServiceInterface {
 
@@ -36,6 +38,14 @@
 
     void takeDoubleList(List<Double> doublesList);
 
-    String takeSortedStrings(@WebParam(name = "strings")SortedSet<String> strings);
+    String takeSortedStrings(SortedSet<String> strings);
+
+    //CHECKSTYLE:OFF
+    String takeUnsortedSet(HashSet<String> strings);
+    String takeStack(Stack<String> strings);
+    String takeArrayList(ArrayList<String> strings);
+    //CHECKSTYLE:ON
+    
+    void method1(List<String> headers1);
 
 }

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest$CollectionService.aegis.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest%24CollectionService.aegis.xml?rev=718512&r1=718511&r2=718512&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest$CollectionService.aegis.xml
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest$CollectionService.aegis.xml
Mon Nov 17 23:09:41 2008
@@ -9,5 +9,14 @@
         <method name="takeSortedStrings">
         	<parameter index="0" mappedName="strings"/>
         </method>
+        <method name="takeUnsortedSet">
+        	<parameter index="0" mappedName="strings"/>
+        </method>
+        <method name="takeStack">
+        	<parameter index="0" mappedName="strings"/>
+        </method>
+        <method name="takeArrayList">
+        	<parameter index="0" mappedName="strings"/>
+        </method>
 	</mapping>
 </mappings>
\ No newline at end of file

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java?rev=718512&r1=718511&r2=718512&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java
Mon Nov 17 23:09:41 2008
@@ -21,10 +21,13 @@
 import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
 import java.lang.reflect.Method;
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.SortedSet;
+import java.util.Stack;
 import java.util.TreeSet;
 
 import javax.xml.namespace.QName;
@@ -212,7 +215,7 @@
     }
     
     @Test
-    public void testSortedSet() throws Exception {
+    public void testListTypes() throws Exception {
         createService(CollectionService.class, new CollectionService(), null);
         
         ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
@@ -229,6 +232,13 @@
         strings.add("Baker");
         String first = csi.takeSortedStrings(strings);
         assertEquals("Able", first);
+        
+        //CHECKSTYLE:OFF
+        HashSet<String> hashedSet = new HashSet<String>();
+        hashedSet.addAll(strings);
+        String countString = csi.takeUnsortedSet(hashedSet);
+        assertEquals("2", countString);
+        //CHECKSTYLE:ON
     }
 
     public class CollectionService implements CollectionServiceInterface {
@@ -260,5 +270,24 @@
         public String takeSortedStrings(SortedSet<String> strings) {
             return strings.first();
         }
+
+        public String takeStack(Stack<String> strings) {
+            return strings.firstElement();
+        }
+
+        //CHECKSTYLE:OFF
+        public String takeUnsortedSet(HashSet<String> strings) {
+            return String.valueOf(strings.size());
+        }
+
+        public String takeArrayList(ArrayList<String> strings) {
+            return strings.get(0);
+        }
+        //CHECKSTYLE:ON
+
+        public void method1(List<String> headers1) {
+            // Do nothing here
+        }
+
     }
 }



Mime
View raw message