cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Einar Valen (JIRA)" <j...@apache.org>
Subject [jira] Created: (CXF-2726) UnsupportedOperationException in WadlGenerator.handleRequest
Date Mon, 22 Mar 2010 13:05:27 GMT
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)
oracle@altweb01:~> uname -s
Linux
oracle@altweb01:~> uname -r
2.6.5-7.244-smp
oracle@altweb01:~> uname -i
x86_64
oracle@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.


Mime
View raw message