cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r360464 - /cocoon/blocks/cron/trunk/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java
Date Sun, 01 Jan 2006 00:09:43 GMT
Author: antonio
Date: Sat Dec 31 16:09:37 2005
New Revision: 360464

URL: http://svn.apache.org/viewcvs?rev=360464&view=rev
Log:
Change tabs to spaces and close stream. It is a merge from 2.1 branch

Modified:
    cocoon/blocks/cron/trunk/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java

Modified: cocoon/blocks/cron/trunk/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/cron/trunk/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java?rev=360464&r1=360463&r2=360464&view=diff
==============================================================================
--- cocoon/blocks/cron/trunk/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java
(original)
+++ cocoon/blocks/cron/trunk/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java
Sat Dec 31 16:09:37 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;
@@ -47,55 +48,63 @@
     private String configuredPipeline;
     private String pipeline;
 
-	public void execute(String name) {
+    public void execute(String name) {
 
-		if (getLogger ().isDebugEnabled ()) {
-			getLogger().debug ("CocoonPipelineCronJob: " + name + ", calling pipeline: " + pipeline);
-		}
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("CocoonPipelineCronJob: " + name + ", calling pipeline: " +
pipeline);
+        }
 
         SourceResolver resolver = null;
         Source src = null;
-		try {
-			resolver = (SourceResolver)this.manager.lookup (SourceResolver.ROLE);
-			src = resolver.resolveURI ("cocoon://" + pipeline);
-
-			InputStream is = src.getInputStream();
-			InputStreamReader reader = new InputStreamReader (is);
-			StringBuffer sb = new StringBuffer ();
-			char[] b = new char[8192];
-			int n;
-			while((n = reader.read (b)) > 0) {
-				sb.append (b, 0, n);
-			}
-			reader.close ();
-			if (getLogger ().isInfoEnabled ()) {
-				getLogger ().info ("CocoonPipelineCronJob: " + name + ", called pipeline: " +
-                                   pipeline + ", and received following content:\n" + sb.toString()
);
-			}
-		} catch(Exception e) {
-			throw new CascadingRuntimeException ("CocoonPipelineCronJob: " + name + ", raised an exception:
", e);
-		} finally {
-			if (resolver != null) {
-				resolver.release (src);
-				this.manager.release (resolver);
-				resolver = null;
-				src = null;
-			}
-		}
-	}
-
-	public void configure(final Configuration config) throws ConfigurationException {
-		this.configuredPipeline = config.getChild(PIPELINE_PARAM).getValue(null);
+        InputStream is = null;
+        InputStreamReader reader = null;
+        try {
+            resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
+            src = resolver.resolveURI("cocoon://" + pipeline);
+
+            is = src.getInputStream();
+            reader = new InputStreamReader(is);
+            StringBuffer sb = new StringBuffer();
+            char[] b = new char[8192];
+            int n;
+            while ((n = reader.read (b)) > 0) {
+                sb.append(b, 0, n);
+            }
+            reader.close();
+            if (getLogger().isInfoEnabled()) {
+                getLogger().info("CocoonPipelineCronJob: " + name + ", called pipeline: "
+
+                                   pipeline + ", and received following content:\n" + sb.toString());
+            }
+        } 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);
+                resolver = null;
+                src = null;
+            }
+        }
 	}
 
-	/* (non-Javadoc)
-	 * @see org.apache.cocoon.components.cron.ConfigurableCronJob#setup(org.apache.avalon.framework.parameters.Parameters,
java.util.Map)
-	 */
-	public void setup(Parameters params, Map objects) {
-		if (null != params) {
-			pipeline = params.getParameter(PIPELINE_PARAM, configuredPipeline);
-		} else {
-             pipeline = configuredPipeline;      
+    public void configure(final Configuration config) throws ConfigurationException {
+        this.configuredPipeline = config.getChild(PIPELINE_PARAM).getValue(null);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.components.cron.ConfigurableCronJob#setup(org.apache.avalon.framework.parameters.Parameters,
java.util.Map)
+     */
+    public void setup(Parameters params, Map objects) {
+        if (params != null) {
+            pipeline = params.getParameter(PIPELINE_PARAM, configuredPipeline);
+        } else {
+            pipeline = configuredPipeline;      
         }
-	}
+    }
 }



Mime
View raw message