Author: antonio Date: Sun May 1 10:10:25 2005 New Revision: 165525 URL: http://svn.apache.org/viewcvs?rev=165525&view=rev Log: Use SystemUtils (merge from 2.1)
Modified: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/HandleErrorsNode.java Modified: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/HandleErrorsNode.java URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/HandleErrorsNode.java?rev=165525&r1=165524&r2=165525&view=diff ============================================================================== --- cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/HandleErrorsNode.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/HandleErrorsNode.java Sun May 1 10:10:25 2005 @@ -24,6 +24,7 @@ import org.apache.cocoon.components.treeprocessor.InvokeContext; import org.apache.cocoon.components.treeprocessor.ProcessingNode; import org.apache.cocoon.environment.Environment; +import org.apache.commons.lang.SystemUtils; /** * Handles <map:handle-errors> @@ -94,32 +95,31 @@ env.getObjectModel().remove(Constants.NOTIFYING_OBJECT); throw new ProcessingException( "Incomplete pipeline: 'handle-error' without a 'type' must include a generator, at " + - getLocation() + System.getProperty("line.separator") + + getLocation() + SystemUtils.LINE_SEPARATOR + "Either add a generator (preferred) or a type='500' attribute (deprecated) on 'handle-errors'"); } // Rethrow the exception throw e; } + } else { + // A 'type' attribute is present : add the implicit generator + context.getProcessingPipeline().setGenerator("<notifier>", "", Parameters.EMPTY_PARAMETERS, Parameters.EMPTY_PARAMETERS); - } - // A 'type' attribute is present : add the implicit generator - context.getProcessingPipeline().setGenerator("<notifier>", "", Parameters.EMPTY_PARAMETERS, Parameters.EMPTY_PARAMETERS); - - try { - return invokeNodes(this.children, env, context); - } catch (ProcessingException e) { - if (e.getMessage().indexOf("Generator already set") != -1){ - - env.getObjectModel().remove(Constants.NOTIFYING_OBJECT); - throw new ProcessingException( - "Error: 'handle-error' with a 'type' attribute has an implicit generator, at " + - getLocation() + System.getProperty("line.separator") + - "Please remove the 'type' attribute on 'handle-error'"); - } + try { + return invokeNodes(this.children, env, context); + } catch (ProcessingException e) { + if (e.getMessage().indexOf("Generator already set") != -1){ - // Rethrow the exception - throw e; + env.getObjectModel().remove(Constants.NOTIFYING_OBJECT); + throw new ProcessingException( + "Error: 'handle-error' with a 'type' attribute has an implicit generator, at " + + getLocation() + SystemUtils.LINE_SEPARATOR + + "Please remove the 'type' attribute on 'handle-error'"); + } + // Rethrow the exception + throw e; + } } } }