[
https://issues.apache.org/jira/browse/CXF-2726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12848117#action_12848117
]
Sergey Beryozkin commented on CXF-2726:
---------------------------------------
It was an unfortunate bug indeed, fixed in 2.2.6, please see
https://issues.apache.org/jira/browse/CXF-2556
> UnsupportedOperationException in WadlGenerator.handleRequest
> ------------------------------------------------------------
>
> Key: CXF-2726
> URL: https://issues.apache.org/jira/browse/CXF-2726
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 2.2.5
> Environment: CXF 2.2.5
> on Suse 10 (I think)
> ora...@altweb01:~> uname -s
> Linux
> ora...@altweb01:~> uname -r
> 2.6.5-7.244-smp
> ora...@altweb01:~> uname -i
> x86_64
> ora...@altweb01:~> uname -o
> GNU/Linux
> Reporter: Einar Valen
> Priority: Minor
>
> UnsupportedOperationException in WadlGenerator.handleRequest
> Stack trace:
> Caused by: java.lang.UnsupportedOperationException
> at java.util.AbstractCollection.add(AbstractCollection.java:221)
> at java.util.AbstractCollection.addAll(AbstractCollection.java:305)
> at org.apache.cxf.jaxb.JAXBUtils.scanPackages(JAXBUtils.java:811)
> at
> org.apache.cxf.jaxrs.model.wadl.WadlGenerator.createJaxbContext(WadlGenerator.java:498)
> at
> org.apache.cxf.jaxrs.model.wadl.WadlGenerator.handleRequest(WadlGenerator.java:123)
> at
> org.apache.cxf.jaxrs.impl.RequestPreprocessor.checkMetadataRequest(RequestPreprocessor.java:164)
> at
> org.apache.cxf.jaxrs.impl.RequestPreprocessor.preprocess(RequestPreprocessor.java:74)
> at
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:87)
> at
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:63)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> Looking at the sources reveals this:
>
> org.apache.cxf.jaxrs.model.wadl.WadlGenerator.handleRequest(WadlGenerator.java:123)
>
> public Response handleRequest(Message m, ClassResourceInfo
> resource) {
> ...
> Set<Class<?>> jaxbTypes =
> ResourceUtils.getAllRequestResponseTypes(cris, true).keySet();
> JAXBContext context = createJaxbContext(jaxbTypes);
> ...
> }
>
> at
> org.apache.cxf.jaxrs.model.wadl.WadlGenerator.createJaxbContext(WadlGenerator.java:498)
>
> private JAXBContext createJaxbContext(Set<Class<?>> classes) {
> UnsupportedOperationException in WadlGenerator.handleRequest
> ...
> JAXBUtils.scanPackages(classes, null);
> ...
> }
> at org.apache.cxf.jaxb.JAXBUtils.scanPackages(JAXBUtils.java:811)
>
> public static void scanPackages(Set<Class<?>> classes,
> Map<Package, CachedClass> objectFactoryCache) {
> ...
> classes.addAll(objectFactories);
> ...
> }
>
>
> The classes variable passed to scanPackages appears to be immutable, and
> eventually fails with an UnsupportedOperationException.
> A quick suggestion to a fix:
> Modify the line in WadlGenerator.handleRequest() that reads
> Set<Class<?>> jaxbTypes = ResourceUtils.getAllRequestResponseTypes(cris,
> true).keySet();
> to
> Set<Class<?>> jaxbTypes = new HashSet(
> ResourceUtils.getAllRequestResponseTypes(cris, true).keySet() );
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.