Author: dkulp Date: Tue Aug 23 17:19:06 2011 New Revision: 1160817 URL: http://svn.apache.org/viewvc?rev=1160817&view=rev Log: Merged revisions 1160810 via svnmerge from https://svn.us.apache.org/repos/asf/cxf/branches/2.4.x-fixes
................ r1160810 | dkulp | 2011-08-23 13:12:03 -0400 (Tue, 23 Aug 2011) | 10 lines Merged revisions 1160775 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1160775 | dkulp | 2011-08-23 12:21:25 -0400 (Tue, 23 Aug 2011) | 2 lines [CXF-3750] More fixes for one-ways to make sure the stream is closed and thus properly deleted ........ ................ Modified: cxf/branches/2.3.x-fixes/ (props changed) cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java Propchange: cxf/branches/2.3.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java?rev=1160817&r1=1160816&r2=1160817&view=diff ============================================================================== --- cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java (original) +++ cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java Tue Aug 23 17:19:06 2011 @@ -20,6 +20,7 @@ package org.apache.cxf.interceptor; import java.io.IOException; +import java.io.InputStream; import java.util.concurrent.Executor; import java.util.concurrent.RejectedExecutionException; import java.util.logging.Logger; @@ -51,7 +52,21 @@ public class OneWayProcessorInterceptor public OneWayProcessorInterceptor(String phase) { super(phase); } - + public void handleFault(Message message) { + if (message.getExchange().isOneWay() + && !isRequestor(message)) { + //in a one way, if an exception is thrown, the stream needs to be closed + InputStream in = message.getContent(InputStream.class); + if (in != null) { + try { + in.close(); + } catch (IOException e) { + //ignore + } + } + + } + } public void handleMessage(Message message) throws Fault { if (message.getExchange().isOneWay() @@ -90,10 +105,12 @@ public class OneWayProcessorInterceptor Conduit conduit = message.getExchange().getDestination() .getBackChannel(message, null, null); if (conduit != null) { + message.getExchange().setInMessage(null); //for a one-way, the back channel could be //null if it knows it cannot send anything. conduit.prepare(partial); conduit.close(partial); + message.getExchange().setInMessage(message); } } catch (IOException e) { //IGNORE
