Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 38056 invoked from network); 18 Nov 2008 07:10:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Nov 2008 07:10:06 -0000 Received: (qmail 924 invoked by uid 500); 18 Nov 2008 07:10:14 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 862 invoked by uid 500); 18 Nov 2008 07:10:14 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 852 invoked by uid 99); 18 Nov 2008 07:10:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Nov 2008 23:10:14 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Nov 2008 07:09:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 460202388975; Mon, 17 Nov 2008 23:09:45 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@cxf.apache.org From: ningjiang@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081118070945.460202388975@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 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)getTypeClass().newInstance(); + values = (Collection)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 @@ + + + + + + + + + \ 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 doublesList); - String takeSortedStrings(@WebParam(name = "strings")SortedSet strings); + String takeSortedStrings(SortedSet strings); + + //CHECKSTYLE:OFF + String takeUnsortedSet(HashSet strings); + String takeStack(Stack strings); + String takeArrayList(ArrayList strings); + //CHECKSTYLE:ON + + void method1(List 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 @@ + + + + + + + + + \ 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 hashedSet = new HashSet(); + 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 strings) { return strings.first(); } + + public String takeStack(Stack strings) { + return strings.firstElement(); + } + + //CHECKSTYLE:OFF + public String takeUnsortedSet(HashSet strings) { + return String.valueOf(strings.size()); + } + + public String takeArrayList(ArrayList strings) { + return strings.get(0); + } + //CHECKSTYLE:ON + + public void method1(List headers1) { + // Do nothing here + } + } }