cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r652477 - /cocoon/whiteboard/corona/trunk/corona-pipeline/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java
Date Thu, 01 May 2008 11:41:21 GMT
Author: reinhard
Date: Thu May  1 04:41:20 2008
New Revision: 652477

URL: http://svn.apache.org/viewvc?rev=652477&view=rev
Log:
. close the input stream in a finally clause

Modified:
    cocoon/whiteboard/corona/trunk/corona-pipeline/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java

Modified: cocoon/whiteboard/corona/trunk/corona-pipeline/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-pipeline/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java?rev=652477&r1=652476&r2=652477&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-pipeline/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-pipeline/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java
Thu May  1 04:41:20 2008
@@ -69,17 +69,23 @@
             throw new IllegalArgumentException("FileGenerator has no source.");
         }
 
+        InputStream inputStream = null;
         try {
             XMLReader xmlReader = XMLReaderFactory.createXMLReader();
 
             xmlReader.setContentHandler(this.getXMLConsumer());
             xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", this.getXMLConsumer());
 
-            InputStream inputStream = new BufferedInputStream(this.source.openStream());
+            inputStream = new BufferedInputStream(this.source.openStream());
             xmlReader.parse(new InputSource(inputStream));
-            inputStream.close();
         } catch (Exception e) {
             throw new RuntimeException(e);
+        } finally {
+            try {
+                inputStream.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
         }
     }
 



Mime
View raw message