[ https://issues.apache.org/jira/browse/CXF-2303?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Beryozkin resolved CXF-2303. ----------------------------------- Resolution: Fixed Assignee: Sergey Beryozkin Thanks for spotting it, it was actually not possible to inject a SortedSet with this bug. Fixed now. > InjectionUtils contains unreachable code > ---------------------------------------- > > Key: CXF-2303 > URL: https://issues.apache.org/jira/browse/CXF-2303 > Project: CXF > Issue Type: Bug > Components: REST > Reporter: Andreas Sahlbach > Assignee: Sergey Beryozkin > > During a recent debug session I noticed some IMHO strange code in > org/apache/cxf/jaxrs/utils/InjectionUtils.java. While I was debugging an > outdated version, the current code in trunk seems to have the same errors. > Referring to this version > http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?revision=777126 > Here you can find: > public static boolean isSupportedCollectionOrArray(Class<?> type) { > return List.class.isAssignableFrom(type) > || Set.class.isAssignableFrom(type) > || SortedSet.class.isAssignableFrom(type) > || type.isArray(); > } > and > private static Object injectIntoCollectionOrArray(Class<?> rawType, Type > genericType, > MultivaluedMap<String, String> values, > boolean isbean, boolean decoded, > ParameterType pathParam, Message > message) { > Class<?> type = null; > if (List.class.isAssignableFrom(rawType)) { > type = ArrayList.class; > } else if (Set.class.isAssignableFrom(rawType)) { > type = HashSet.class; > } else if (SortedSet.class.isAssignableFrom(rawType)) { > type = TreeSet.class; > } > [...] > Because Set is a SuperInterface of SortedSet, the boolean of the first > example can be simplified and in the second example the proper clause for > SortedSet is never reached, because the Set clause is always true for Sets > and SortedSets. > At least that's what I think. I have no concrete bug though, just wanted to > report. :-) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.