cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1565162 - /cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
Date Thu, 06 Feb 2014 10:57:52 GMT
Author: ay
Date: Thu Feb  6 10:57:51 2014
New Revision: 1565162

URL: http://svn.apache.org/r1565162
Log:
[CXF-5546] NPE may be thrown and logged during WS-RM's retransmission

Modified:
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java?rev=1565162&r1=1565161&r2=1565162&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
(original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
Thu Feb  6 10:57:51 2014
@@ -19,13 +19,11 @@
 
 package org.apache.cxf.ws.rm.soap;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.ConnectException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
@@ -390,7 +388,7 @@ public class RetransmissionQueueImpl imp
         }
         
         final String address = to.getValue();
-        LOG.fine("Resending to address: " + address);
+        LOG.log(Level.FINE, "Resending to address: {0}", address);
         final ProtocolVariation protocol = RMContextUtils.getProtocolVariation(message);
         final Endpoint reliableEndpoint = manager.getReliableEndpoint(message).getEndpoint(protocol);
 
@@ -455,15 +453,10 @@ public class RetransmissionQueueImpl imp
             }
             CachedOutputStream content = (CachedOutputStream)message
                 .get(RMMessageConstants.SAVED_CONTENT);
-            InputStream bis = null;
             if (null == content) {
-                byte[] savedbytes = message.getContent(byte[].class);
-                bis = new ByteArrayInputStream(savedbytes); 
-                if (LOG.isLoggable(Level.FINE)) {
-                    LOG.fine("Using saved byte array: " + Arrays.toString(savedbytes));
-                }
+                LOG.log(Level.WARNING, "Assuming the message has been acknowledged and released,
skipping resend.");
             } else {
-                bis = content.getInputStream();
+                InputStream bis = content.getInputStream();
                 if (LOG.isLoggable(Level.FINE)) {
                     if (content.size() < 65536) {
                         LOG.fine("Using saved output stream: " 
@@ -472,17 +465,17 @@ public class RetransmissionQueueImpl imp
                         LOG.fine("Using saved output stream: ...");                     
  
                     }
                 }
-            }
 
-            // copy saved output stream to new output stream in chunks of 1024
-            IOUtils.copyAndCloseInput(bis, os);
-            os.flush();
-            // closing the conduit this way will close the underlining stream that is os.
-            c.close(message);
+                // copy saved output stream to new output stream in chunks of 1024
+                IOUtils.copyAndCloseInput(bis, os);
+                os.flush();
+                // closing the conduit this way will close the underlining stream that is
os.
+                c.close(message);
+            }
         } catch (ConnectException ex) {
             //ignore, we'll just resent again later
         } catch (IOException ex) {
-            LOG.log(Level.SEVERE, "RESEND_FAILED_MSG", ex);
+            LOG.log(Level.WARNING, "RESEND_FAILED_MSG", ex);
         }
     }
 



Mime
View raw message