You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Marcus Christie (JIRA)" <ji...@apache.org> on 2008/11/11 16:38:44 UTC
[jira] Created: (CXF-1906) Unmarshalling Set to TreeSet instead of
HashSet
Unmarshalling Set to TreeSet instead of HashSet
-----------------------------------------------
Key: CXF-1906
URL: https://issues.apache.org/jira/browse/CXF-1906
Project: CXF
Issue Type: Bug
Components: Aegis Databinding
Affects Versions: 2.1.3
Reporter: Marcus Christie
Priority: Critical
When using the Aegis databinding, if you are deserializing to a class that has a Set in it, Aegis is currently instantiating the set as a SortedSet. This fails for cases where the objects being added to the set do not implement Comparable, and is undesired in any case.
The error occurs in CollectionType.java:
{code:java}
protected Collection<Object> createCollection() {
Collection values = null;
if (getTypeClass().isAssignableFrom(List.class)) {
values = new ArrayList();
} else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
values = new TreeSet();
} else if (getTypeClass().isAssignableFrom(Set.class)) {
values = new HashSet();
} else if (getTypeClass().isAssignableFrom(Vector.class)) {
values = new Vector();
} else if (getTypeClass().isInterface()) {
values = new ArrayList();
} else {
....
{code}
If the typeClass is Set, then the second "if" clause evaluates to true since Set is a superclass/superinterface of SortedSet.
I've got a patch I'll submit and I'll explain the fix.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (CXF-1906) Unmarshalling Set to
TreeSet instead of HashSet
Posted by "Marcus Christie (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12646578#action_12646578 ]
marcuschristie edited comment on CXF-1906 at 11/11/08 8:02 AM:
----------------------------------------------------------------
I submitted a patch to fix this bug (I actually submitted the patch twice, but I realized that the first attempt had a problem with it; please disregard it). The bug in CollectionType.createCollection is that Set "isAssignableFrom" SortedSet because it is a supertype of SortedSet, so the SortedSet "if" clause should come after the Set "if" clause. Here is how the code is in that method with the patch applied:
if (getTypeClass().isAssignableFrom(List.class)) {
values = new ArrayList();
} else if (getTypeClass().isAssignableFrom(Set.class)) {
values = new HashSet();
} else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
values = new TreeSet();
} else if (getTypeClass().isAssignableFrom(Vector.class)) {
values = new Vector();
} else if (getTypeClass().isInterface()) {
values = new ArrayList();
} else {
....
This way, if your class has a Set, Aegis will create a HashSet to add values to. In the case that the typeClass if a SortedSet, it will fail the second "if" clause since SortedSet is not a supertype of Set, but will pass the third "if" clause since, obviously, SortedSet "is assignable from" a SortedSet. So the fix is really to just reorder the "if" clauses a bit so that not every Set is treated as a SortedSet.
was (Author: marcuschristie):
I submitted a patch to fix this bug (I actually submitted the patch twice, but I realized that the first attempt had a problem with it; please disregard it). The bug in CollectionType.createCollection is that Set "isAssignableFrom" SortedSet because it is a supertype of SortedSet, so the SortedSet "if" clause should come second. Here is how the code is in that method with the patch applied:
if (getTypeClass().isAssignableFrom(List.class)) {
values = new ArrayList();
} else if (getTypeClass().isAssignableFrom(Set.class)) {
values = new HashSet();
} else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
values = new TreeSet();
} else if (getTypeClass().isAssignableFrom(Vector.class)) {
values = new Vector();
} else if (getTypeClass().isInterface()) {
values = new ArrayList();
} else {
....
This way, if your class has a Set, Aegis will create a HashSet to add values to. In the case that the typeClass if a SortedSet, it will fail the second "if" clause since SortedSet is not a supertype of Set, but will pass the third "if" clause since, obviously, SortedSet "is assignable from" a SortedSet. So the fix is really to just reorder the "if" clauses a bit so that not every Set is treated as a SortedSet.
> Unmarshalling Set to TreeSet instead of HashSet
> -----------------------------------------------
>
> Key: CXF-1906
> URL: https://issues.apache.org/jira/browse/CXF-1906
> Project: CXF
> Issue Type: Bug
> Components: Aegis Databinding
> Affects Versions: 2.1.3
> Reporter: Marcus Christie
> Priority: Critical
> Attachments: CXF-1906_patch.txt, CXF-1906_patch.txt
>
>
> When using the Aegis databinding, if you are deserializing to a class that has a Set in it, Aegis is currently instantiating the set as a SortedSet. This fails for cases where the objects being added to the set do not implement Comparable, and is undesired in any case.
> The error occurs in CollectionType.java:
> {code:java}
> protected Collection<Object> createCollection() {
> Collection values = null;
> if (getTypeClass().isAssignableFrom(List.class)) {
> values = new ArrayList();
> } else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
> values = new TreeSet();
> } else if (getTypeClass().isAssignableFrom(Set.class)) {
> values = new HashSet();
> } else if (getTypeClass().isAssignableFrom(Vector.class)) {
> values = new Vector();
> } else if (getTypeClass().isInterface()) {
> values = new ArrayList();
> } else {
> ....
> {code}
> If the typeClass is Set, then the second "if" clause evaluates to true since Set is a superclass/superinterface of SortedSet.
> I've got a patch I'll submit and I'll explain the fix.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CXF-1906) Unmarshalling Set to TreeSet instead
of HashSet
Posted by "Marcus Christie (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12646578#action_12646578 ]
Marcus Christie commented on CXF-1906:
--------------------------------------
I submitted a patch to fix this bug (I actually submitted the patch twice, but I realized that the first attempt had a problem with it; please disregard it). The bug in CollectionType.createCollection is that Set "isAssignableFrom" SortedSet because it is a supertype of SortedSet, so the SortedSet "if" clause should come second. Here is how the code is in that method with the patch applied:
if (getTypeClass().isAssignableFrom(List.class)) {
values = new ArrayList();
} else if (getTypeClass().isAssignableFrom(Set.class)) {
values = new HashSet();
} else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
values = new TreeSet();
} else if (getTypeClass().isAssignableFrom(Vector.class)) {
values = new Vector();
} else if (getTypeClass().isInterface()) {
values = new ArrayList();
} else {
....
This way, if your class has a Set, Aegis will create a HashSet to add values to. In the case that the typeClass if a SortedSet, it will fail the second "if" clause since SortedSet is not a supertype of Set, but will pass the third "if" clause since, obviously, SortedSet "is assignable from" a SortedSet. So the fix is really to just reorder the "if" clauses a bit so that not every Set is treated as a SortedSet.
> Unmarshalling Set to TreeSet instead of HashSet
> -----------------------------------------------
>
> Key: CXF-1906
> URL: https://issues.apache.org/jira/browse/CXF-1906
> Project: CXF
> Issue Type: Bug
> Components: Aegis Databinding
> Affects Versions: 2.1.3
> Reporter: Marcus Christie
> Priority: Critical
> Attachments: CXF-1906_patch.txt, CXF-1906_patch.txt
>
>
> When using the Aegis databinding, if you are deserializing to a class that has a Set in it, Aegis is currently instantiating the set as a SortedSet. This fails for cases where the objects being added to the set do not implement Comparable, and is undesired in any case.
> The error occurs in CollectionType.java:
> {code:java}
> protected Collection<Object> createCollection() {
> Collection values = null;
> if (getTypeClass().isAssignableFrom(List.class)) {
> values = new ArrayList();
> } else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
> values = new TreeSet();
> } else if (getTypeClass().isAssignableFrom(Set.class)) {
> values = new HashSet();
> } else if (getTypeClass().isAssignableFrom(Vector.class)) {
> values = new Vector();
> } else if (getTypeClass().isInterface()) {
> values = new ArrayList();
> } else {
> ....
> {code}
> If the typeClass is Set, then the second "if" clause evaluates to true since Set is a superclass/superinterface of SortedSet.
> I've got a patch I'll submit and I'll explain the fix.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CXF-1906) Unmarshalling Set to TreeSet instead
of HashSet
Posted by "Marcus Christie (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12646581#action_12646581 ]
Marcus Christie commented on CXF-1906:
--------------------------------------
One other thing, as far as I can tell this bug was introduced in CXF-1770.
> Unmarshalling Set to TreeSet instead of HashSet
> -----------------------------------------------
>
> Key: CXF-1906
> URL: https://issues.apache.org/jira/browse/CXF-1906
> Project: CXF
> Issue Type: Bug
> Components: Aegis Databinding
> Affects Versions: 2.1.3
> Reporter: Marcus Christie
> Priority: Critical
> Attachments: CXF-1906_patch.txt, CXF-1906_patch.txt
>
>
> When using the Aegis databinding, if you are deserializing to a class that has a Set in it, Aegis is currently instantiating the set as a SortedSet. This fails for cases where the objects being added to the set do not implement Comparable, and is undesired in any case.
> The error occurs in CollectionType.java:
> {code:java}
> protected Collection<Object> createCollection() {
> Collection values = null;
> if (getTypeClass().isAssignableFrom(List.class)) {
> values = new ArrayList();
> } else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
> values = new TreeSet();
> } else if (getTypeClass().isAssignableFrom(Set.class)) {
> values = new HashSet();
> } else if (getTypeClass().isAssignableFrom(Vector.class)) {
> values = new Vector();
> } else if (getTypeClass().isInterface()) {
> values = new ArrayList();
> } else {
> ....
> {code}
> If the typeClass is Set, then the second "if" clause evaluates to true since Set is a superclass/superinterface of SortedSet.
> I've got a patch I'll submit and I'll explain the fix.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (CXF-1906) Unmarshalling Set to TreeSet instead of
HashSet
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benson Margulies reassigned CXF-1906:
-------------------------------------
Assignee: Benson Margulies
> Unmarshalling Set to TreeSet instead of HashSet
> -----------------------------------------------
>
> Key: CXF-1906
> URL: https://issues.apache.org/jira/browse/CXF-1906
> Project: CXF
> Issue Type: Bug
> Components: Aegis Databinding
> Affects Versions: 2.1.3
> Reporter: Marcus Christie
> Assignee: Benson Margulies
> Priority: Critical
> Attachments: CXF-1906_patch.txt, CXF-1906_patch.txt
>
>
> When using the Aegis databinding, if you are deserializing to a class that has a Set in it, Aegis is currently instantiating the set as a SortedSet. This fails for cases where the objects being added to the set do not implement Comparable, and is undesired in any case.
> The error occurs in CollectionType.java:
> {code:java}
> protected Collection<Object> createCollection() {
> Collection values = null;
> if (getTypeClass().isAssignableFrom(List.class)) {
> values = new ArrayList();
> } else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
> values = new TreeSet();
> } else if (getTypeClass().isAssignableFrom(Set.class)) {
> values = new HashSet();
> } else if (getTypeClass().isAssignableFrom(Vector.class)) {
> values = new Vector();
> } else if (getTypeClass().isInterface()) {
> values = new ArrayList();
> } else {
> ....
> {code}
> If the typeClass is Set, then the second "if" clause evaluates to true since Set is a superclass/superinterface of SortedSet.
> I've got a patch I'll submit and I'll explain the fix.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CXF-1906) Unmarshalling Set to TreeSet instead of
HashSet
Posted by "Marcus Christie (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marcus Christie updated CXF-1906:
---------------------------------
Attachment: CXF-1906_patch.txt
This is meant to supersede the previous patch attachment.
> Unmarshalling Set to TreeSet instead of HashSet
> -----------------------------------------------
>
> Key: CXF-1906
> URL: https://issues.apache.org/jira/browse/CXF-1906
> Project: CXF
> Issue Type: Bug
> Components: Aegis Databinding
> Affects Versions: 2.1.3
> Reporter: Marcus Christie
> Priority: Critical
> Attachments: CXF-1906_patch.txt, CXF-1906_patch.txt
>
>
> When using the Aegis databinding, if you are deserializing to a class that has a Set in it, Aegis is currently instantiating the set as a SortedSet. This fails for cases where the objects being added to the set do not implement Comparable, and is undesired in any case.
> The error occurs in CollectionType.java:
> {code:java}
> protected Collection<Object> createCollection() {
> Collection values = null;
> if (getTypeClass().isAssignableFrom(List.class)) {
> values = new ArrayList();
> } else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
> values = new TreeSet();
> } else if (getTypeClass().isAssignableFrom(Set.class)) {
> values = new HashSet();
> } else if (getTypeClass().isAssignableFrom(Vector.class)) {
> values = new Vector();
> } else if (getTypeClass().isInterface()) {
> values = new ArrayList();
> } else {
> ....
> {code}
> If the typeClass is Set, then the second "if" clause evaluates to true since Set is a superclass/superinterface of SortedSet.
> I've got a patch I'll submit and I'll explain the fix.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CXF-1906) Unmarshalling Set to TreeSet instead
of HashSet
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648184#action_12648184 ]
Benson Margulies commented on CXF-1906:
---------------------------------------
I expect that Willem will backport it.
> Unmarshalling Set to TreeSet instead of HashSet
> -----------------------------------------------
>
> Key: CXF-1906
> URL: https://issues.apache.org/jira/browse/CXF-1906
> Project: CXF
> Issue Type: Bug
> Components: Aegis Databinding
> Affects Versions: 2.1.3
> Reporter: Marcus Christie
> Assignee: Benson Margulies
> Priority: Critical
> Fix For: 2.2
>
> Attachments: CXF-1906_patch.txt, CXF-1906_patch.txt
>
>
> When using the Aegis databinding, if you are deserializing to a class that has a Set in it, Aegis is currently instantiating the set as a SortedSet. This fails for cases where the objects being added to the set do not implement Comparable, and is undesired in any case.
> The error occurs in CollectionType.java:
> {code:java}
> protected Collection<Object> createCollection() {
> Collection values = null;
> if (getTypeClass().isAssignableFrom(List.class)) {
> values = new ArrayList();
> } else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
> values = new TreeSet();
> } else if (getTypeClass().isAssignableFrom(Set.class)) {
> values = new HashSet();
> } else if (getTypeClass().isAssignableFrom(Vector.class)) {
> values = new Vector();
> } else if (getTypeClass().isInterface()) {
> values = new ArrayList();
> } else {
> ....
> {code}
> If the typeClass is Set, then the second "if" clause evaluates to true since Set is a superclass/superinterface of SortedSet.
> I've got a patch I'll submit and I'll explain the fix.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CXF-1906) Unmarshalling Set to TreeSet instead
of HashSet
Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648526#action_12648526 ]
Willem Jiang commented on CXF-1906:
-----------------------------------
Merged the patch into 2.1.x-fix branch
http://svn.apache.org/viewvc?rev=718512&view=rev
> Unmarshalling Set to TreeSet instead of HashSet
> -----------------------------------------------
>
> Key: CXF-1906
> URL: https://issues.apache.org/jira/browse/CXF-1906
> Project: CXF
> Issue Type: Bug
> Components: Aegis Databinding
> Affects Versions: 2.1.3
> Reporter: Marcus Christie
> Assignee: Willem Jiang
> Priority: Critical
> Fix For: 2.2
>
> Attachments: CXF-1906_patch.txt, CXF-1906_patch.txt
>
>
> When using the Aegis databinding, if you are deserializing to a class that has a Set in it, Aegis is currently instantiating the set as a SortedSet. This fails for cases where the objects being added to the set do not implement Comparable, and is undesired in any case.
> The error occurs in CollectionType.java:
> {code:java}
> protected Collection<Object> createCollection() {
> Collection values = null;
> if (getTypeClass().isAssignableFrom(List.class)) {
> values = new ArrayList();
> } else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
> values = new TreeSet();
> } else if (getTypeClass().isAssignableFrom(Set.class)) {
> values = new HashSet();
> } else if (getTypeClass().isAssignableFrom(Vector.class)) {
> values = new Vector();
> } else if (getTypeClass().isInterface()) {
> values = new ArrayList();
> } else {
> ....
> {code}
> If the typeClass is Set, then the second "if" clause evaluates to true since Set is a superclass/superinterface of SortedSet.
> I've got a patch I'll submit and I'll explain the fix.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CXF-1906) Unmarshalling Set to TreeSet instead of
HashSet
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benson Margulies updated CXF-1906:
----------------------------------
Assignee: Willem Jiang (was: Benson Margulies)
Passing along to the current branch merger.
> Unmarshalling Set to TreeSet instead of HashSet
> -----------------------------------------------
>
> Key: CXF-1906
> URL: https://issues.apache.org/jira/browse/CXF-1906
> Project: CXF
> Issue Type: Bug
> Components: Aegis Databinding
> Affects Versions: 2.1.3
> Reporter: Marcus Christie
> Assignee: Willem Jiang
> Priority: Critical
> Fix For: 2.2
>
> Attachments: CXF-1906_patch.txt, CXF-1906_patch.txt
>
>
> When using the Aegis databinding, if you are deserializing to a class that has a Set in it, Aegis is currently instantiating the set as a SortedSet. This fails for cases where the objects being added to the set do not implement Comparable, and is undesired in any case.
> The error occurs in CollectionType.java:
> {code:java}
> protected Collection<Object> createCollection() {
> Collection values = null;
> if (getTypeClass().isAssignableFrom(List.class)) {
> values = new ArrayList();
> } else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
> values = new TreeSet();
> } else if (getTypeClass().isAssignableFrom(Set.class)) {
> values = new HashSet();
> } else if (getTypeClass().isAssignableFrom(Vector.class)) {
> values = new Vector();
> } else if (getTypeClass().isInterface()) {
> values = new ArrayList();
> } else {
> ....
> {code}
> If the typeClass is Set, then the second "if" clause evaluates to true since Set is a superclass/superinterface of SortedSet.
> I've got a patch I'll submit and I'll explain the fix.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (CXF-1906) Unmarshalling Set to TreeSet instead of
HashSet
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benson Margulies resolved CXF-1906.
-----------------------------------
Resolution: Fixed
Fix Version/s: 2.2
Fix, and unit test extended to cover this as related classes.
> Unmarshalling Set to TreeSet instead of HashSet
> -----------------------------------------------
>
> Key: CXF-1906
> URL: https://issues.apache.org/jira/browse/CXF-1906
> Project: CXF
> Issue Type: Bug
> Components: Aegis Databinding
> Affects Versions: 2.1.3
> Reporter: Marcus Christie
> Assignee: Benson Margulies
> Priority: Critical
> Fix For: 2.2
>
> Attachments: CXF-1906_patch.txt, CXF-1906_patch.txt
>
>
> When using the Aegis databinding, if you are deserializing to a class that has a Set in it, Aegis is currently instantiating the set as a SortedSet. This fails for cases where the objects being added to the set do not implement Comparable, and is undesired in any case.
> The error occurs in CollectionType.java:
> {code:java}
> protected Collection<Object> createCollection() {
> Collection values = null;
> if (getTypeClass().isAssignableFrom(List.class)) {
> values = new ArrayList();
> } else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
> values = new TreeSet();
> } else if (getTypeClass().isAssignableFrom(Set.class)) {
> values = new HashSet();
> } else if (getTypeClass().isAssignableFrom(Vector.class)) {
> values = new Vector();
> } else if (getTypeClass().isInterface()) {
> values = new ArrayList();
> } else {
> ....
> {code}
> If the typeClass is Set, then the second "if" clause evaluates to true since Set is a superclass/superinterface of SortedSet.
> I've got a patch I'll submit and I'll explain the fix.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (CXF-1906) Unmarshalling Set to TreeSet instead of
HashSet
Posted by "Marcus Christie (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marcus Christie updated CXF-1906:
---------------------------------
Attachment: CXF-1906_patch.txt
Patch to fix Set/SortedSet bug.
> Unmarshalling Set to TreeSet instead of HashSet
> -----------------------------------------------
>
> Key: CXF-1906
> URL: https://issues.apache.org/jira/browse/CXF-1906
> Project: CXF
> Issue Type: Bug
> Components: Aegis Databinding
> Affects Versions: 2.1.3
> Reporter: Marcus Christie
> Priority: Critical
> Attachments: CXF-1906_patch.txt
>
>
> When using the Aegis databinding, if you are deserializing to a class that has a Set in it, Aegis is currently instantiating the set as a SortedSet. This fails for cases where the objects being added to the set do not implement Comparable, and is undesired in any case.
> The error occurs in CollectionType.java:
> {code:java}
> protected Collection<Object> createCollection() {
> Collection values = null;
> if (getTypeClass().isAssignableFrom(List.class)) {
> values = new ArrayList();
> } else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
> values = new TreeSet();
> } else if (getTypeClass().isAssignableFrom(Set.class)) {
> values = new HashSet();
> } else if (getTypeClass().isAssignableFrom(Vector.class)) {
> values = new Vector();
> } else if (getTypeClass().isInterface()) {
> values = new ArrayList();
> } else {
> ....
> {code}
> If the typeClass is Set, then the second "if" clause evaluates to true since Set is a superclass/superinterface of SortedSet.
> I've got a patch I'll submit and I'll explain the fix.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (CXF-1906) Unmarshalling Set to TreeSet instead
of HashSet
Posted by "Marcus Christie (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648182#action_12648182 ]
Marcus Christie commented on CXF-1906:
--------------------------------------
Benson,
Thanks for getting on this and resolving it so quickly. One question, will this bug fix make it into 2.1.4? Thanks.
> Unmarshalling Set to TreeSet instead of HashSet
> -----------------------------------------------
>
> Key: CXF-1906
> URL: https://issues.apache.org/jira/browse/CXF-1906
> Project: CXF
> Issue Type: Bug
> Components: Aegis Databinding
> Affects Versions: 2.1.3
> Reporter: Marcus Christie
> Assignee: Benson Margulies
> Priority: Critical
> Fix For: 2.2
>
> Attachments: CXF-1906_patch.txt, CXF-1906_patch.txt
>
>
> When using the Aegis databinding, if you are deserializing to a class that has a Set in it, Aegis is currently instantiating the set as a SortedSet. This fails for cases where the objects being added to the set do not implement Comparable, and is undesired in any case.
> The error occurs in CollectionType.java:
> {code:java}
> protected Collection<Object> createCollection() {
> Collection values = null;
> if (getTypeClass().isAssignableFrom(List.class)) {
> values = new ArrayList();
> } else if (getTypeClass().isAssignableFrom(SortedSet.class)) {
> values = new TreeSet();
> } else if (getTypeClass().isAssignableFrom(Set.class)) {
> values = new HashSet();
> } else if (getTypeClass().isAssignableFrom(Vector.class)) {
> values = new Vector();
> } else if (getTypeClass().isInterface()) {
> values = new ArrayList();
> } else {
> ....
> {code}
> If the typeClass is Set, then the second "if" clause evaluates to true since Set is a superclass/superinterface of SortedSet.
> I've got a patch I'll submit and I'll explain the fix.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.