camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1446629 - in /camel/branches/camel-2.10.x: ./ camel-core/src/main/java/org/apache/camel/impl/GzipDataFormat.java
Date Fri, 15 Feb 2013 15:16:51 GMT
Author: davsclaus
Date: Fri Feb 15 15:16:51 2013
New Revision: 1446629

URL: http://svn.apache.org/r1446629
Log:
CAMEL-6081: gzip data format. Ensure streams is closed to avoid locking files on windows.

Modified:
    camel/branches/camel-2.10.x/   (props changed)
    camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/GzipDataFormat.java

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1446627

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/GzipDataFormat.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/GzipDataFormat.java?rev=1446629&r1=1446628&r2=1446629&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/GzipDataFormat.java
(original)
+++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/GzipDataFormat.java
Fri Feb 15 15:16:51 2013
@@ -35,21 +35,24 @@ public class GzipDataFormat implements D
         try {
             IOHelper.copy(is, zipOutput);
         } finally {
+            // must close all input streams
             IOHelper.close(is, zipOutput);
         }
     }
 
     public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
         InputStream is = exchange.getIn().getMandatoryBody(InputStream.class);
-        GZIPInputStream unzipInput = new GZIPInputStream(is);
-        
+        GZIPInputStream unzipInput = null;
+
         // Create an expandable byte array to hold the inflated data
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         try {
+            unzipInput = new GZIPInputStream(is);
             IOHelper.copy(unzipInput, bos);
             return bos.toByteArray();
         } finally {
-            IOHelper.close(unzipInput);
+            // must close all input streams
+            IOHelper.close(unzipInput, is);
         }
     }
 



Mime
View raw message