camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r1205647 - /camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java
Date Wed, 23 Nov 2011 22:57:29 GMT
Author: hadrian
Date: Wed Nov 23 22:57:29 2011
New Revision: 1205647

URL: http://svn.apache.org/viewvc?rev=1205647&view=rev
Log:
Fix logic problem: cannot cast BufferedInputStream to FileInputStream

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java?rev=1205647&r1=1205646&r2=1205647&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java
Wed Nov 23 22:57:29 2011
@@ -40,8 +40,8 @@ public class FileInputStreamCache extend
     
     @Override
     public void close() {
-        if (isSteamOpened()) {
-            IOHelper.close(getInputStream());
+        if (stream != null) {
+            IOHelper.close(stream);
         }
     }
 
@@ -52,7 +52,7 @@ public class FileInputStreamCache extend
             close();
             // reset by creating a new stream based on the file
             stream = new BufferedInputStream(new FileInputStream(file));
-        } catch (Exception e) {
+        } catch (FileNotFoundException e) {
             throw new RuntimeCamelException("Cannot reset stream from file " + file, e);
         }            
     }
@@ -74,13 +74,4 @@ public class FileInputStreamCache extend
     protected InputStream getInputStream() {
         return stream;
     }
-    
-    private boolean isSteamOpened() {
-        if (stream != null && stream instanceof FileInputStream) {
-            return ((FileInputStream) stream).getChannel().isOpen();            
-        } else {
-            return stream != null;
-        }
-    }
-
 }



Mime
View raw message