cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r900904 - in /cxf/branches/2.2.x-fixes: ./ api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java
Date Tue, 19 Jan 2010 18:49:41 GMT
Author: dkulp
Date: Tue Jan 19 18:49:41 2010
New Revision: 900904

URL: http://svn.apache.org/viewvc?rev=900904&view=rev
Log:
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.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/
------------------------------------------------------------------------------
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=900904&r1=900903&r2=900904&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
Tue Jan 19 18:49:41 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;
         }
     }
     



Mime
View raw message