Author: dkulp Date: Fri Jun 15 20:12:22 2012 New Revision: 1350774 URL: http://svn.apache.org/viewvc?rev=1350774&view=rev Log: Merged revisions 1350758 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes
........ r1350758 | dkulp | 2012-06-15 15:50:56 -0400 (Fri, 15 Jun 2012) | 18 lines Merged revisions 1350750 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes ........ r1350750 | dkulp | 2012-06-15 15:36:34 -0400 (Fri, 15 Jun 2012) | 10 lines Merged revisions 1350633 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/trunk ........ r1350633 | ay | 2012-06-15 10:09:01 -0400 (Fri, 15 Jun 2012) | 2 lines [CXF-4383] Some temporary files are not deleted after WS-RM scenarios ........ ........ ........ Modified: cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java Modified: cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java?rev=1350774&r1=1350773&r2=1350774&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java (original) +++ cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java Fri Jun 15 20:12:22 2012 @@ -54,6 +54,7 @@ public class RMCaptureInInterceptor exte saved.flush(); is.close(); + saved.lockOutputStream(); message.setContent(InputStream.class, saved.getInputStream()); LOG.fine("Capturing the original RM message"); Modified: cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java?rev=1350774&r1=1350773&r2=1350774&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java (original) +++ cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java Fri Jun 15 20:12:22 2012 @@ -47,6 +47,7 @@ public class RetransmissionCallback impl saved.holdTempFile(); try { cos.writeCacheTo(saved); + saved.lockOutputStream(); } catch (IOException e) { // ignore } Modified: cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java?rev=1350774&r1=1350773&r2=1350774&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java (original) +++ cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java Fri Jun 15 20:12:22 2012 @@ -618,25 +618,37 @@ public class RMTxStore implements RMStor LOG.log(Level.FINE, "Storing {0} message number {1} for sequence {2}, to = {3}", new Object[] {outbound ? "outbound" : "inbound", nr, id, to}); } - PreparedStatement stmt = outbound ? createOutboundMessageStmt : createInboundMessageStmt; - if (null == stmt) { - stmt = connection.prepareStatement(MessageFormat.format(CREATE_MESSAGE_STMT_STR, - outbound ? OUTBOUND_MSGS_TABLE_NAME : INBOUND_MSGS_TABLE_NAME)); - if (outbound) { - createOutboundMessageStmt = stmt; - } else { - createInboundMessageStmt = stmt; + InputStream msgin = null; + try { + msgin = msg.getInputStream(); + PreparedStatement stmt = outbound ? createOutboundMessageStmt : createInboundMessageStmt; + if (null == stmt) { + stmt = connection.prepareStatement(MessageFormat.format(CREATE_MESSAGE_STMT_STR, + outbound ? OUTBOUND_MSGS_TABLE_NAME : INBOUND_MSGS_TABLE_NAME)); + if (outbound) { + createOutboundMessageStmt = stmt; + } else { + createInboundMessageStmt = stmt; + } + } + int i = 1; + stmt.setString(i++, id); + stmt.setLong(i++, nr); + stmt.setString(i++, to); + stmt.setBinaryStream(i++, msgin, (int)msg.getSize()); + stmt.execute(); + if (LOG.isLoggable(Level.FINE)) { + LOG.log(Level.FINE, "Successfully stored {0} message number {1} for sequence {2}", + new Object[] {outbound ? "outbound" : "inbound", nr, id}); + } + } finally { + if (msgin != null) { + try { + msgin.close(); + } catch (IOException e) { + // ignore + } } - } - int i = 1; - stmt.setString(i++, id); - stmt.setLong(i++, nr); - stmt.setString(i++, to); - stmt.setBinaryStream(i++, msg.getInputStream(), msg.getSize()); - stmt.execute(); - if (LOG.isLoggable(Level.FINE)) { - LOG.log(Level.FINE, "Successfully stored {0} message number {1} for sequence {2}", - new Object[] {outbound ? "outbound" : "inbound", nr, id}); } } Modified: cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java?rev=1350774&r1=1350773&r2=1350774&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java (original) +++ cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java Fri Jun 15 20:12:22 2012 @@ -505,6 +505,12 @@ public class RetransmissionQueueImpl imp CachedOutputStream saved = (CachedOutputStream)message.get(RMMessageConstants.SAVED_CONTENT); if (saved != null) { saved.releaseTempFileHold(); + // call close to dispose + try { + saved.close(); + } catch (IOException e) { + // ignore + } } }
