You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2011/08/23 19:12:03 UTC

svn commit: r1160810 - in /cxf/branches/2.4.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java

Author: dkulp
Date: Tue Aug 23 17:12:03 2011
New Revision: 1160810

URL: http://svn.apache.org/viewvc?rev=1160810&view=rev
Log:
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.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java?rev=1160810&r1=1160809&r2=1160810&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java (original)
+++ cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java Tue Aug 23 17:12:03 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