cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r586247 - /cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java
Date Fri, 19 Oct 2007 03:43:31 GMT
Author: joerg
Date: Thu Oct 18 20:43:31 2007
New Revision: 586247

URL: http://svn.apache.org/viewvc?rev=586247&view=rev
Log:
don't resolve status code twice,
use Integer.parseInt(String) instead of new Integer(String).intValue(),
DEFAULT_STATUS_CODE

Modified:
    cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java

Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java?rev=586247&r1=586246&r2=586247&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java
(original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java
Thu Oct 18 20:43:31 2007
@@ -35,6 +35,8 @@
 public class SerializeNode extends PipelineEventComponentProcessingNode
                            implements ParameterizableProcessingNode {
 
+	private static final int DEFAULT_STATUS_CODE = 200;
+
     private String serializerName;
 
     private VariableResolver source;
@@ -126,17 +128,18 @@
 
         // Set status code *only* if there is one - do not override status
         // code if it was set elsewhere.
-        String statusCodeString = this.statusCode.resolve(context, env.getObjectModel());
+        String statusCodeString = this.statusCode.resolve(context, objectModel);
         if (statusCodeString != null) {
-            int statusCodeInt = 200;
+            int statusCodeInt = DEFAULT_STATUS_CODE;
             try {
-                Integer resolvedStatusCode = new Integer(this.statusCode.resolve(context,
env.getObjectModel()));
-                statusCodeInt = resolvedStatusCode.intValue();
+                statusCodeInt = Integer.parseInt(statusCodeString);
             } catch (NumberFormatException e) {
                 getLogger().warn("Status code value '" + statusCodeString + "' is not an
integer. " +
-                                 "Using " + statusCodeInt + " instead.", e);
+                                 "Using " + DEFAULT_STATUS_CODE + " instead.", e);
             }
-            env.setStatus(statusCodeInt);
+			if (statusCodeInt >= 0) {
+				env.setStatus(statusCodeInt);
+			}
         }
 
         if (!context.isBuildingPipelineOnly()) {



Mime
View raw message