Skip to content
Permalink
Browse files
[CXF-5546] NPE may be thrown and logged during WS-RM's retransmission
git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1565162 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
elakito committed Feb 6, 2014
1 parent 0bfee67 commit 87d67b928b87adb1e60eb817d1718f405cbc7e3c
Showing 1 changed file with 10 additions and 17 deletions.
@@ -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 @@ private void serverResend(Message message) throws RMException {
}

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 @@ private void resend(Conduit c, Message message) {
}
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 @@ private void resend(Conduit c, Message message) {
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);
}
}

0 comments on commit 87d67b9

Please sign in to comment.