cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "iris ding (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CXF-5846) ClassCastException in org.apache.cxf.jaxrs.provider.BinaryDataProvider & SourceProvider
Date Tue, 05 Aug 2014 08:27:12 GMT

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

iris ding updated CXF-5846:
---------------------------

    Attachment: cxf-5846.patch

> ClassCastException in  org.apache.cxf.jaxrs.provider.BinaryDataProvider & SourceProvider
> ----------------------------------------------------------------------------------------
>
>                 Key: CXF-5846
>                 URL: https://issues.apache.org/jira/browse/CXF-5846
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 3.0.0
>            Reporter: iris ding
>         Attachments: cxf-5846.patch
>
>
> 1.  Using Reader's Implementation BufferedReader: 
>     @POST
>     @Path("/subclasses/shouldfail")
>     public BufferedReader postReader(BufferedReader br) {
>         return br;
>     }
> Exception stack: 
>   Caused by: java.lang.ClassCastException: Cannot cast class java.io.InputStreamReader
to class java.io.BufferedReader
> 	at java.lang.Class.cast(Class.java:1730)
> 	at org.apache.cxf.jaxrs.provider.BinaryDataProvider.readFrom(BinaryDataProvider.java:77)
> 	at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSUtils.java:1311)
> 	at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1262)
> 	at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:801)
> 	at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:764)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:212)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
> 	... 19 more
> 2. Using ByteArrayInputStream:
> @POST
>     @Path("/subclasses/shouldfail")
>     public ByteArrayInputStream postInputStream(ByteArrayInputStream is) {
>         return is;
>     }
> Exception stack:
> Caused by: java.lang.ClassCastException: Cannot cast class org.apache.cxf.transport.http.AbstractHTTPDestination$1
to class java.io.ByteArrayInputStream
> 	at java.lang.Class.cast(Class.java:1730)
> 	at org.apache.cxf.jaxrs.provider.BinaryDataProvider.readFrom(BinaryDataProvider.java:74)
> 	at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSUtils.java:1311)
> 	at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1262)
> 	at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:801)
> 	at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:764)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:212)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
> 	... 19 more
> 3.  Using Source's implmentation class: 
> public static class UnsupportedSourceSubclass implements Source {
>         public String getSystemId() {
>             return null;
>         }
>         public void setSystemId(String systemId) {
>         }
>     }
>     @POST
>     @Path("/subclasses/shouldfail")
>     public UnsupportedSourceSubclass postReader(UnsupportedSourceSubclass saxSource)
{
>         return saxSource;
>     }
> Exception stack:
> Caused by: java.lang.ClassCastException: Cannot cast class javax.xml.transform.stream.StreamSource
to class com.test.jaxrs.fat.standard.SourceResource$UnsupportedSourceSubclass
> 	at java.lang.Class.cast(Class.java:1730)
> 	at org.apache.cxf.jaxrs.provider.SourceProvider.readFrom(SourceProvider.java:115)
> 	at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSUtils.java:1311)
> 	at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1262)
> 	at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:801)
> 	at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:764)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:212)
> 	at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:76)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
> 	... 19 more



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message