cziegeler 01/12/27 01:32:33 Modified: src/org/apache/cocoon/acting ScriptAction.java Log: Revised ScriptAction Revision Changes Path 1.7 +22 -13 xml-cocoon2/src/org/apache/cocoon/acting/ScriptAction.java Index: ScriptAction.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/ScriptAction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ScriptAction.java 2001/10/11 07:28:16 1.6 +++ ScriptAction.java 2001/12/27 09:32:33 1.7 @@ -5,7 +5,6 @@ * version 1.1, a copy of which has been included with this distribution in * * the LICENSE file. * *****************************************************************************/ - package org.apache.cocoon.acting; // Cocoon imports @@ -31,27 +30,39 @@ /** * A simple action that executes any script that can be run by the BSF + * + * @author <a href="mailto:[EMAIL PROTECTED]">Jason Foster</a> + * @version CVS $Revision: 1.7 $ $Date: 2001/12/27 09:32:33 $ */ -public class ScriptAction extends ComposerAction implements ThreadSafe { +public class ScriptAction +extends ComposerAction +implements ThreadSafe { - public Map act( Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters par ) throws Exception - { + public Map act( Redirector redirector, + SourceResolver resolver, + Map objectModel, + String source, + Parameters par ) + throws Exception { + Source src = null; try { // Figure out what script to open. A missing script name is caught // by the resolver/SystemId grouping later on and causes an exception String scriptName = source; - getLogger().debug("script source [" + scriptName + "]"); // Locate the appropriate file on the filesytem - Source src = resolver.resolve(scriptName); + src = resolver.resolve(scriptName); String systemID = src.getSystemId(); - getLogger().debug("script resolved to [" + systemID + "]"); + if (this.getLogger().isDebugEnabled() == true) { + getLogger().debug("script source [" + scriptName + "]"); + getLogger().debug("script resolved to [" + systemID + "]"); + } // TODO: why doesn't this work? // Reader in = src.getCharacterStream(); @@ -99,15 +110,13 @@ { return ( null ); } - } catch (FileNotFoundException e) { - throw new ProcessingException( - "Exception in ScriptAction.act()", e); - } catch (BSFException e) { - throw new ProcessingException( - "Exception in ScriptAction.act()", e); + } catch (ProcessingException e) { + throw e; } catch (Exception e) { throw new ProcessingException( "Exception in ScriptAction.act()", e); + } finally { + if (src != null) src.recycle(); } // try/catch } // public Map act(...) } // public class ScriptAction
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]