Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 49857D98D for ; Tue, 23 Oct 2012 20:13:38 +0000 (UTC) Received: (qmail 33421 invoked by uid 500); 23 Oct 2012 20:13:38 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 33372 invoked by uid 500); 23 Oct 2012 20:13:38 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 33364 invoked by uid 99); 23 Oct 2012 20:13:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Oct 2012 20:13:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Oct 2012 20:13:36 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 26B4023888CD; Tue, 23 Oct 2012 20:12:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1401429 - in /cxf/branches/2.5.x-fixes: ./ api/src/main/java/org/apache/cxf/io/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/transports/local/src/main/java/org/apache/cxf/transport/local/ systests/jaxrs/src/test/java/org/apache/cxf... Date: Tue, 23 Oct 2012 20:12:52 -0000 To: commits@cxf.apache.org From: ay@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121023201253.26B4023888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ay Date: Tue Oct 23 20:12:51 2012 New Revision: 1401429 URL: http://svn.apache.org/viewvc?rev=1401429&view=rev Log: Merged revisions 1401292 via svn merge from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes ........ r1401292 | ay | 2012-10-23 15:30:47 +0200 (Tue, 23 Oct 2012) | 9 lines Merged revisions 1400811 via svn merge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1400811 | ay | 2012-10-22 11:10:11 +0200 (Mon, 22 Oct 2012) | 1 line [CXF-4592] Some tests are failing when COS's file caching is enforced ........ ........ Modified: cxf/branches/2.5.x-fixes/ (props changed) cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java cxf/branches/2.5.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java cxf/branches/2.5.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java Propchange: cxf/branches/2.5.x-fixes/ ('svn:mergeinfo' removed) Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java?rev=1401429&r1=1401428&r2=1401429&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java (original) +++ cxf/branches/2.5.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java Tue Oct 23 20:12:51 2012 @@ -89,8 +89,7 @@ public class CachedOutputStream extends } public CachedOutputStream() { - currentStream = new LoadingByteArrayOutputStream(2048); - inmem = true; + this(defaultThreshold); } public CachedOutputStream(long threshold) { Modified: cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java?rev=1401429&r1=1401428&r2=1401429&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java (original) +++ cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java Tue Oct 23 20:12:51 2012 @@ -27,6 +27,7 @@ import org.apache.cxf.common.injection.N import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.helpers.IOUtils; import org.apache.cxf.io.CachedOutputStream; +import org.apache.cxf.io.DelegatingInputStream; import org.apache.cxf.message.Message; import org.apache.cxf.phase.Phase; @@ -133,12 +134,21 @@ public class LoggingInInterceptor extend bos.setThreshold(threshold); } try { - IOUtils.copy(is, bos); - + // use the appropriate input stream and restore it later + InputStream bis = is instanceof DelegatingInputStream + ? ((DelegatingInputStream)is).getInputStream() : is; + + IOUtils.copyAndCloseInput(bis, bos); bos.flush(); - is.close(); + bis = bos.getInputStream(); + + // restore the delegating input stream or the input stream + if (is instanceof DelegatingInputStream) { + ((DelegatingInputStream)is).setInputStream(bis); + } else { + message.setContent(InputStream.class, bis); + } - message.setContent(InputStream.class, bos.getInputStream()); if (bos.getTempFile() != null) { //large thing on disk... buffer.getMessage().append("\nMessage (saved to tmp file):\n"); Modified: cxf/branches/2.5.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java?rev=1401429&r1=1401428&r2=1401429&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java (original) +++ cxf/branches/2.5.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java Tue Oct 23 20:12:51 2012 @@ -65,6 +65,7 @@ public class LocalConduit extends Abstra message.setContent(OutputStream.class, stream); //save the original stream message.put(CachedOutputStream.class, stream); + stream.holdTempFile(); } } @@ -98,7 +99,8 @@ public class LocalConduit extends Abstra CachedOutputStream stream = message.get(CachedOutputStream.class); copy.setContent(InputStream.class, stream.getInputStream()); copy.removeContent(CachedOutputStream.class); - + stream.releaseTempFileHold(); + // Create a new incoming exchange and store the original exchange for the response ExchangeImpl ex = new ExchangeImpl(); ex.setInMessage(copy); Modified: cxf/branches/2.5.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java?rev=1401429&r1=1401428&r2=1401429&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java (original) +++ cxf/branches/2.5.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java Tue Oct 23 20:12:51 2012 @@ -121,6 +121,7 @@ public class LocalDestination extends Ab CachedOutputStream stream = new CachedOutputStream(); message.setContent(OutputStream.class, stream); message.setContent(CachedOutputStream.class, stream); + stream.holdTempFile(); } } @@ -136,6 +137,7 @@ public class LocalDestination extends Ab message.setContent(OutputStream.class, stream); MessageImpl.copyContent(message, copy); copy.setContent(InputStream.class, stream.getInputStream()); + stream.releaseTempFileHold(); if (exchange != null && exchange.getInMessage() == null) { exchange.setInMessage(copy); } Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1401429&r1=1401428&r2=1401429&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Tue Oct 23 20:12:51 2012 @@ -1868,9 +1868,10 @@ public class JAXRSClientServerBookTest e private String getStringFromInputStream(InputStream in) throws Exception { CachedOutputStream bos = new CachedOutputStream(); IOUtils.copy(in, bos); + String str = new String(bos.getBytes()); in.close(); bos.close(); - return bos.getOut().toString(); + return str; } public static class ReplaceContentTypeInterceptor extends AbstractPhaseInterceptor { Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java?rev=1401429&r1=1401428&r2=1401429&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java Tue Oct 23 20:12:51 2012 @@ -219,9 +219,10 @@ public class JAXRSClientServerNonSpringB private String getStringFromInputStream(InputStream in) throws Exception { CachedOutputStream bos = new CachedOutputStream(); IOUtils.copy(in, bos); + String str = new String(bos.getBytes()); in.close(); bos.close(); - return bos.getOut().toString(); + return str; } } Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java?rev=1401429&r1=1401428&r2=1401429&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java Tue Oct 23 20:12:51 2012 @@ -156,10 +156,10 @@ public class JAXRSClientServerProxySprin private String getStringFromInputStream(InputStream in) throws Exception { CachedOutputStream bos = new CachedOutputStream(); IOUtils.copy(in, bos); + String str = new String(bos.getBytes()); in.close(); bos.close(); - //System.out.println(bos.getOut().toString()); - return bos.getOut().toString(); + return str; } } Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java?rev=1401429&r1=1401428&r2=1401429&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java Tue Oct 23 20:12:51 2012 @@ -106,10 +106,10 @@ public class JAXRSClientServerResourceCr private String getStringFromInputStream(InputStream in) throws Exception { CachedOutputStream bos = new CachedOutputStream(); IOUtils.copy(in, bos); + String str = new String(bos.getBytes()); in.close(); bos.close(); - //System.out.println(bos.getOut().toString()); - return bos.getOut().toString(); + return str; } } Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java?rev=1401429&r1=1401428&r2=1401429&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java Tue Oct 23 20:12:51 2012 @@ -97,10 +97,10 @@ public class JAXRSClientServerResourceCr private String getStringFromInputStream(InputStream in) throws Exception { CachedOutputStream bos = new CachedOutputStream(); IOUtils.copy(in, bos); + String str = new String(bos.getBytes()); in.close(); bos.close(); - //System.out.println(bos.getOut().toString()); - return bos.getOut().toString(); + return str; } } Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java?rev=1401429&r1=1401428&r2=1401429&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java Tue Oct 23 20:12:51 2012 @@ -667,9 +667,10 @@ public class JAXRSClientServerSpringBook private String getStringFromInputStream(InputStream in) throws Exception { CachedOutputStream bos = new CachedOutputStream(); IOUtils.copy(in, bos); + String str = new String(bos.getBytes()); in.close(); bos.close(); - return bos.getOut().toString(); + return str; } Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java?rev=1401429&r1=1401428&r2=1401429&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java Tue Oct 23 20:12:51 2012 @@ -741,9 +741,10 @@ public class JAXRSMultipartTest extends private String getStringFromInputStream(InputStream in) throws Exception { CachedOutputStream bos = new CachedOutputStream(); IOUtils.copy(in, bos); + String str = new String(bos.getBytes()); in.close(); bos.close(); - return bos.getOut().toString(); + return str; } private Book readBookFromInputStream(InputStream is) throws Exception { Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java?rev=1401429&r1=1401428&r2=1401429&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java Tue Oct 23 20:12:51 2012 @@ -892,9 +892,10 @@ public class JAXRSSoapBookTest extends A private String getStringFromInputStream(InputStream in) throws Exception { CachedOutputStream bos = new CachedOutputStream(); IOUtils.copy(in, bos); + String str = new String(bos.getBytes()); in.close(); bos.close(); - return bos.getOut().toString(); + return str; } private InputStream getHttpInputStream(String endpointAddress) throws Exception {