[ 
https://issues.apache.org/jira/browse/CXF-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Kulp resolved CXF-5994.
------------------------------
       Resolution: Fixed
    Fix Version/s: 3.1.9

We believe this has been fixed.   No verification from user though.

>  java.lang.ClassCastException: 
> sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast 
> to java.lang.reflect.TypeVariable
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-5994
>                 URL: https://issues.apache.org/jira/browse/CXF-5994
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.7.11
>         Environment: Wildfly 8.1.0.Final, JDK: 1.8.0_20-b26 64bit
>            Reporter: Yannick Loth
>             Fix For: 3.1.9
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
>  java.lang.ClassCastException: 
> sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast 
> to java.lang.reflect.TypeVariable
>       at 
> org.apache.cxf.jaxb.JAXBContextInitializer.addType(JAXBContextInitializer.java:251)
>  [cxf-rt-databinding-jaxb-2.7.11.jar:2.7.11]
> Happens when the type is a GenericArrayType: then the code assumes that the 
> component in the array type is either a class or a TypeVariable, and the cast 
> into TypeVariable fails.
> During debug sessions, I can see that the actual type is an array of a 
> subtype of ParameterizedType, and obviously the code does not permit this.
> The data types were generated with Maven and cxf-codegen-plugin.  The XSD is 
> from Microsoft Exchange EWS (Exchange Web Service, 2006).  The problematic 
> type is: 
> com.microsoft.schemas.exchange.services._2006.messages.ResponseMessageType[]
> This is blocking as any webservice which uses the data types of EWS fails if 
> called with the standard JAXWS stack in Wildfly 8.1.0.Final.
> For the fix: maybe copying lines 234 to 243 into line 250 may be almost 
> enough (simply add an else-if for ParameterizedType arrays as above, but 
> adapt a little for arrays):
>  
> else if (cls instanceof ParameterizedType) {
>             final ParameterizedType parameterizedType = 
> (ParameterizedType)cls;
>             addType(parameterizedType.getRawType());
>             if (!parameterizedType.getRawType().equals(Enum.class)) {
>                 for (Type t2 : parameterizedType.getActualTypeArguments()) {
>                     if (shouldTypeBeAdded(t2, parameterizedType)) {
>                         addType(t2);
>                     }                }            }
> Thanks



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to