Author: dkulp Date: Tue Jan 19 19:02:20 2010 New Revision: 900909 URL: http://svn.apache.org/viewvc?rev=900909&view=rev Log: Merged revisions 900904 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes
................ r900904 | dkulp | 2010-01-19 13:49:41 -0500 (Tue, 19 Jan 2010) | 9 lines Merged revisions 900900 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r900900 | dkulp | 2010-01-19 13:45:53 -0500 (Tue, 19 Jan 2010) | 1 line Slight Optimization ........ ................ Modified: cxf/branches/2.1.x-fixes/ (props changed) cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java Propchange: cxf/branches/2.1.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java?rev=900909&r1=900908&r2=900909&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java (original) +++ cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java Tue Jan 19 19:02:20 2010 @@ -27,6 +27,7 @@ public class DelegatingInputStream extends FilterInputStream { private InputStream origIn; + private boolean cached; public DelegatingInputStream(InputStream is) { super(is); @@ -55,15 +56,18 @@ * stream may not be valid by the time the next read() occurs */ public void cacheInput() { - if (in != origIn) { + if (!cached) { CachedOutputStream cache = new CachedOutputStream(); try { - IOUtils.copy(in, cache); - in = cache.getInputStream(); + IOUtils.copy(in, cache); + if (cache.size() > 0) { + in = cache.getInputStream(); + } cache.close(); } catch (IOException e) { //ignore } + cached = true; } }
