cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r360463 - /cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java
Date Sat, 31 Dec 2005 23:57:03 GMT
Author: antonio
Date: Sat Dec 31 15:56:59 2005
New Revision: 360463

URL: http://svn.apache.org/viewcvs?rev=360463&view=rev
Log:
Close stream.

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java?rev=360463&r1=360462&r2=360463&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java
Sat Dec 31 15:56:59 2005
@@ -24,6 +24,7 @@
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.util.Map;
@@ -58,12 +59,14 @@
 
         SourceResolver resolver = null;
         Source src = null;
+        InputStream is = null;
+        InputStreamReader reader = null;
         try {
             resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
             src = resolver.resolveURI("cocoon://" + pipeline);
 
-            InputStream is = src.getInputStream();
-            InputStreamReader reader = new InputStreamReader(is);
+            is = src.getInputStream();
+            reader = new InputStreamReader(is);
             StringBuffer sb = new StringBuffer();
             char[] b = new char[8192];
             int n;
@@ -78,6 +81,12 @@
         } catch (Exception e) {
             throw new CascadingRuntimeException("CocoonPipelineCronJob: " + name + ", raised
an exception: ", e);
         } finally {
+            try {
+                if (reader != null) reader.close();
+                if (is != null) is.close();
+            } catch (IOException e) {
+                throw new CascadingRuntimeException("CocoonPipelineCronJob: " + name + ",
raised an exception: ", e);
+            }
             if (resolver != null) {
                 resolver.release(src);
                 this.manager.release(resolver);



Mime
View raw message