You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/01/29 20:23:01 UTC
svn commit: r904601 - in /cxf/branches/2.2.x-fixes: ./
api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java
Author: dkulp
Date: Fri Jan 29 19:23:00 2010
New Revision: 904601
URL: http://svn.apache.org/viewvc?rev=904601&view=rev
Log:
Merged revisions 904597 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r904597 | dkulp | 2010-01-29 14:15:51 -0500 (Fri, 29 Jan 2010) | 2 lines
Fix an issue where one-way requests may mess up the input stream for
other requests
........
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java
Propchange: cxf/branches/2.2.x-fixes/
('svn:mergeinfo' removed)
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java?rev=904601&r1=904600&r2=904601&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java (original)
+++ cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java Fri Jan 29 19:23:00 2010
@@ -19,6 +19,7 @@
package org.apache.cxf.io;
+import java.io.ByteArrayInputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -26,12 +27,10 @@
import org.apache.cxf.helpers.IOUtils;
public class DelegatingInputStream extends FilterInputStream {
- private InputStream origIn;
- private boolean cached;
+ protected boolean cached;
public DelegatingInputStream(InputStream is) {
super(is);
- origIn = is;
}
@@ -42,14 +41,6 @@
return in;
}
-
- public void close() throws IOException {
- super.close();
- if (in != origIn) {
- origIn.close();
- }
- }
-
/**
* Read the entire original input stream and cache it. Useful
* if switching threads or doing something where the original
@@ -59,11 +50,15 @@
if (!cached) {
CachedOutputStream cache = new CachedOutputStream();
try {
+ InputStream origIn = in;
IOUtils.copy(in, cache);
if (cache.size() > 0) {
in = cache.getInputStream();
+ } else {
+ in = new ByteArrayInputStream(new byte[0]);
}
cache.close();
+ origIn.close();
} catch (IOException e) {
//ignore
}