[
https://issues.apache.org/jira/browse/CXF-5763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14007151#comment-14007151
]
Anthony Communier commented on CXF-5763:
----------------------------------------
The allow chunk parameter of httpClientPolicy was set to false
There are different kind of classes that are set into this.wrappedStream :
1/ CachedOutputStream (l 411)
2/ Annonymous OutputStream (l 417)
3/ CacheAndWriteOutputStream (l432) (extending CachedOutputStream)
In close method only CachedOutputStream is considered :
l 396: if ((!this.chunking) && (this.wrappedStream != null))
{
CachedOutputStream out = (CachedOutputStream)this.wrappedStream;
It seems that the code is in the case 2/ => Annonymous OutputStream
There are not so much comments in code in order to understand what has to be
done.
Waht could be done :
1/ Only test if it's this.wrappedStream is an instance of CachedOutputStream
before doing job done in close method
2/ Be sure that this.wrappedStream is always of type :CachedOutputStream
Note that if close occurs during setupWrappedStream this.wrappedStream could
be of 2 types because there is no protection
> ClassCast Exception in AsyncHTTPConduit$AsyncWrappedOutputStream.close()
> method when using async and HttpAsyncClient
> ---------------------------------------------------------------------------------------------------------------------
>
> Key: CXF-5763
> URL: https://issues.apache.org/jira/browse/CXF-5763
> Project: CXF
> Issue Type: Bug
> Components: Transports
> Affects Versions: 3.0.0
> Environment: Linux
> Java 7
> Reporter: Anthony Communier
> Attachments: TestUnsubscribeSM-output.txt
>
>
> Sometimes there is an error on connection close when using async client
> javax.ws.rs.ProcessingException: java.lang.ClassCastException:
> org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit$AsyncWrappedOutputStream$1
> cannot be cast to org.apache.cxf.io.CachedOutputStream
> at
> org.apache.cxf.jaxrs.client.WebClient.handleAsyncResponse(WebClient.java:1010)
> [cxf-rt-rs-client-3.0.0.jar:3.0.0]
> at org.apache.cxf.jaxrs.client.WebClient.access$100(WebClient.java:81)
> [cxf-rt-rs-client-3.0.0.jar:3.0.0]
> at
> org.apache.cxf.jaxrs.client.WebClient$ClientAsyncResponseInterceptor.handleMessage(WebClient.java:1298)
> ~[cxf-rt-rs-client-3.0.0.jar:3.0.0]
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
> ~[cxf-core-3.0.0.jar:3.0.0]
> at
> org.apache.cxf.jaxrs.client.ClientMessageObserver.onMessage(ClientMessageObserver.java:56)
> ~[cxf-rt-rs-client-3.0.0.jar:3.0.0]
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1154)
> ~[cxf-rt-transports-http-3.0.0.jar:3.0.0]
> at
> org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)
> ~[cxf-core-3.0.0.jar:3.0.0]
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> ~[na:1.7.0_25]
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> ~[na:1.7.0_25]
> at
> org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)
> ~[cxf-core-3.0.0.jar:3.0.0]
> at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]
> Caused by: java.lang.ClassCastException:
> org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit$AsyncWrappedOutputStream$1
> cannot be cast to org.apache.cxf.io.CachedOutputStream
> at
> org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit$AsyncWrappedOutputStream.close(AsyncHTTPConduit.java:397)
> ~[cxf-rt-transports-http-hc-3.0.0.jar:3.0.0]
> at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
> ~[cxf-core-3.0.0.jar:3.0.0]
> at
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:638)
> ~[cxf-rt-transports-http-3.0.0.jar:3.0.0]
> at
> org.apache.cxf.endpoint.AbstractConduitSelector.complete(AbstractConduitSelector.java:209)
> ~[cxf-core-3.0.0.jar:3.0.0]
> at
> org.apache.cxf.jaxrs.client.AbstractClient.preProcessResult(AbstractClient.java:534)
> ~[cxf-rt-rs-client-3.0.0.jar:3.0.0]
> at
> org.apache.cxf.jaxrs.client.WebClient.handleAsyncResponse(WebClient.java:1005)
> [cxf-rt-rs-client-3.0.0.jar:3.0.0]
> ... 10 common frames omitted
--
This message was sent by Atlassian JIRA
(v6.2#6252)