You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ay...@apache.org on 2012/10/23 15:30:47 UTC
svn commit: r1401292 - in /cxf/branches/2.6.x-fixes: ./
api/src/main/java/org/apache/cxf/interceptor/
api/src/main/java/org/apache/cxf/io/
rt/transports/local/src/main/java/org/apache/cxf/transport/local/
systests/jaxrs/src/test/java/org/apache/cxf/sys...
Author: ay
Date: Tue Oct 23 13:30:47 2012
New Revision: 1401292
URL: http://svn.apache.org/viewvc?rev=1401292&view=rev
Log:
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.6.x-fixes/ (props changed)
cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java
cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java
cxf/branches/2.6.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
cxf/branches/2.6.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java
cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java
cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java?rev=1401292&r1=1401291&r2=1401292&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java (original)
+++ cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java Tue Oct 23 13:30:47 2012
@@ -28,6 +28,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;
@@ -136,12 +137,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.6.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java?rev=1401292&r1=1401291&r2=1401292&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java (original)
+++ cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java Tue Oct 23 13:30:47 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.6.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java?rev=1401292&r1=1401291&r2=1401292&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java (original)
+++ cxf/branches/2.6.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java Tue Oct 23 13:30:47 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.6.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java?rev=1401292&r1=1401291&r2=1401292&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java (original)
+++ cxf/branches/2.6.x-fixes/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java Tue Oct 23 13:30:47 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.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1401292&r1=1401291&r2=1401292&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Tue Oct 23 13:30:47 2012
@@ -1903,9 +1903,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<Message> {
Modified: cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java?rev=1401292&r1=1401291&r2=1401292&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java (original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java Tue Oct 23 13:30:47 2012
@@ -221,9 +221,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.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java?rev=1401292&r1=1401291&r2=1401292&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java (original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerProxySpringBookTest.java Tue Oct 23 13:30:47 2012
@@ -158,10 +158,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.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java?rev=1401292&r1=1401291&r2=1401292&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java (original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java Tue Oct 23 13:30:47 2012
@@ -108,10 +108,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.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java?rev=1401292&r1=1401291&r2=1401292&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java (original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java Tue Oct 23 13:30:47 2012
@@ -99,10 +99,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.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java?rev=1401292&r1=1401291&r2=1401292&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java (original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java Tue Oct 23 13:30:47 2012
@@ -669,9 +669,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.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java?rev=1401292&r1=1401291&r2=1401292&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java (original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java Tue Oct 23 13:30:47 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.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java?rev=1401292&r1=1401291&r2=1401292&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java (original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java Tue Oct 23 13:30:47 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 {