You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2007/10/19 05:43:31 UTC
svn commit: r586247 -
/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SerializeNode.java
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()) {