Author: ilgrosso
Date: Tue Nov 27 17:02:10 2012
New Revision: 1414263
URL: http://svn.apache.org/viewvc?rev=1414263&view=rev
Log:
White noise again, please ignore
Modified:
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/CachingPipeline.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompleteCacheValue.java
cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java
cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/SpringComponentProvider.java
cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/AbstractSitemapNode.java
cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/ErrorNode.java
cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelineNode.java
cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelinesNode.java
cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/Sitemap.java
cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/util/ExceptionHandler.java
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/CachingPipeline.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/CachingPipeline.java?rev=1414263&r1=1414262&r2=1414263&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/CachingPipeline.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/CachingPipeline.java Tue Nov 27 17:02:10 2012
@@ -111,7 +111,7 @@ public class CachingPipeline<T extends P
@Override
public void execute() throws Exception {
- LOG.debug("Used cache: " + this.cache);
+ LOG.debug("Used cache: {}", this.cache);
// checked for a cached value first
final CacheValue cachedValue = this.getCachedValue(this.cacheKey);
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompleteCacheValue.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompleteCacheValue.java?rev=1414263&r1=1414262&r2=1414263&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompleteCacheValue.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/CompleteCacheValue.java Tue Nov 27 17:02:10 2012
@@ -28,13 +28,13 @@ import org.slf4j.LoggerFactory;
public class CompleteCacheValue extends AbstractCacheValue {
- private static final long serialVersionUID = 1L;
-
/**
* Logger.
*/
private static final Logger LOG = LoggerFactory.getLogger(CompleteCacheValue.class);
+ private static final long serialVersionUID = 7956334917534138387L;
+
private byte[] content;
public CompleteCacheValue(final byte[] content, final CacheKey cacheKey) {
Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java?rev=1414263&r1=1414262&r2=1414263&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/InvocationImpl.java Tue Nov 27 17:02:10 2012
@@ -52,7 +52,7 @@ public class InvocationImpl implements I
private static final Pattern PARAMETER_PATTERN = Pattern.compile("\\{([a-zA-Z\\-]+):([^\\{]*)\\}");
- private List<Action> actions = new LinkedList<Action>();
+ private final List<Action> actions = new LinkedList<Action>();
private ComponentProvider componentProvider;
@@ -81,39 +81,35 @@ public class InvocationImpl implements I
/**
* Create a {@link InvocationImpl} object using the given output stream.
*
- * @param outputStream The {@link OutputStream} where the result is written
- * to.
+ * @param outputStream The {@link OutputStream} where the result is written to.
*/
- public InvocationImpl(OutputStream outputStream) {
+ public InvocationImpl(final OutputStream outputStream) {
super();
this.outputStream = outputStream;
}
/**
- * Create a {@link InvocationImpl} object using the given output stream and
- * requestURI.
+ * Create a {@link InvocationImpl} object using the given output stream and requestURI.
*
- * @param outputStream The {@link OutputStream} where the result is written
- * to.
+ * @param outputStream The {@link OutputStream} where the result is written to.
* @param requestURI The requested path.
*/
- public InvocationImpl(OutputStream outputStream, String requestURI) {
+ public InvocationImpl(final OutputStream outputStream, final String requestURI) {
super();
this.outputStream = outputStream;
this.requestURI = requestURI;
}
/**
- * Create a {@link InvocationImpl} object using the given output stream,
- * requestURI and parameters.
+ * Create a {@link InvocationImpl} object using the given output stream, requestURI and parameters.
*
- * @param outputStream The {@link OutputStream} where the result is written
- * to.
+ * @param outputStream The {@link OutputStream} where the result is written to.
* @param requestURI The requested path.
- * @param parameters A {@link Map} of parameters that are used when the
- * pipeline is being executed.
+ * @param parameters A {@link Map} of parameters that are used when the pipeline is being executed.
*/
- public InvocationImpl(OutputStream outputStream, String requestURI, Map<String, Object> parameters) {
+ public InvocationImpl(final OutputStream outputStream, final String requestURI,
+ final Map<String, Object> parameters) {
+
super();
this.outputStream = outputStream;
this.requestURI = requestURI;
@@ -125,6 +121,7 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#reset()
*/
+ @Override
public void reset() {
this.actions.clear();
this.hasFinisher = false;
@@ -135,6 +132,7 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#execute()
*/
+ @Override
public void execute() throws Exception {
if (this.pipeline == null) {
throw new IllegalStateException("InvocationImpl has been executed without having a pipeline.");
@@ -168,6 +166,7 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#getOutputStream()
*/
+ @Override
public OutputStream getOutputStream() {
return this.outputStream;
}
@@ -177,7 +176,8 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#getParameter(java.lang.String)
*/
- public Object getParameter(String name) {
+ @Override
+ public Object getParameter(final String name) {
if (this.parameters == null) {
return null;
}
@@ -189,6 +189,7 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#getParameters()
*/
+ @Override
public Map<String, Object> getParameters() {
return this.parameters;
}
@@ -198,6 +199,7 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#getRequestURI()
*/
+ @Override
public String getRequestURI() {
return this.requestURI;
}
@@ -207,6 +209,7 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#getThrowable()
*/
+ @Override
public Throwable getThrowable() {
return ParameterHelper.getThrowable(this.parameters);
}
@@ -216,6 +219,7 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#hasCompletePipeline()
*/
+ @Override
public boolean hasCompletePipeline() {
return this.hasFinisher;
}
@@ -225,13 +229,14 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#installAction(java.lang.String)
*/
- public void installAction(String type, Map<String, ? extends Object> parameters) {
+ @Override
+ public void installAction(final String type, final Map<String, ? extends Object> parameters) {
if (this.pipeline == null) {
throw new IllegalStateException("Action cannot be installed without having a pipeline.");
}
- Action action = this.componentProvider.createAction(type);
- Map<String, ? extends Object> resolvedParameters = this.resolveParameters(parameters);
+ final Action action = this.componentProvider.createAction(type);
+ final Map<String, ? extends Object> resolvedParameters = this.resolveParameters(parameters);
action.setConfiguration(resolvedParameters);
this.actions.add(action);
}
@@ -239,16 +244,16 @@ public class InvocationImpl implements I
/**
* {@inheritDoc}
*
- * @see org.apache.cocoon.sitemap.Invocation#installComponent(java.lang.String,
- * java.util.Map)
+ * @see org.apache.cocoon.sitemap.Invocation#installComponent(java.lang.String, java.util.Map)
*/
- public void installComponent(String type, Map<String, ? extends Object> componentParameters) {
+ @Override
+ public void installComponent(final String type, final Map<String, ? extends Object> componentParameters) {
if (this.pipeline == null) {
throw new IllegalStateException("Pipeline component cannot be installed without having a pipeline.");
}
- PipelineComponent component = this.componentProvider.createComponent(type);
- Map<String, ? extends Object> resolvedParameters = this.resolveParameters(componentParameters);
+ final PipelineComponent component = this.componentProvider.createComponent(type);
+ final Map<String, ? extends Object> resolvedParameters = this.resolveParameters(componentParameters);
component.setConfiguration(resolvedParameters);
this.pipeline.addComponent(component);
@@ -260,15 +265,17 @@ public class InvocationImpl implements I
/**
* {@inheritDoc}
*
- * @see org.apache.cocoon.sitemap.Invocation#installPipeline(java.lang.String,
- * java.util.Map)
+ * @see org.apache.cocoon.sitemap.Invocation#installPipeline(java.lang.String, java.util.Map)
*/
- public void installPipeline(String type, boolean internalOnly, Map<String, ? extends Object> componentParameters) {
+ @Override
+ public void installPipeline(final String type, final boolean internalOnly,
+ final Map<String, ? extends Object> componentParameters) {
+
this.pipeline = this.componentProvider.createPipeline(type);
- Map<String, ? extends Object> resolvedParameters = this.resolveParameters(componentParameters);
+ final Map<String, ? extends Object> resolvedParameters = this.resolveParameters(componentParameters);
this.pipeline.setConfiguration(resolvedParameters);
- this.internalOnly = internalOnly;
+ this.internalOnly = internalOnly;
}
/**
@@ -276,6 +283,7 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#isErrorInvocation()
*/
+ @Override
public boolean isErrorInvocation() {
return this.getThrowable() != null;
}
@@ -285,6 +293,7 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#popSitemapParameters()
*/
+ @Override
public void popSitemapParameters() {
this.objectModel.getSitemapParameters().popParameters();
}
@@ -292,10 +301,10 @@ public class InvocationImpl implements I
/**
* {@inheritDoc}
*
- * @see org.apache.cocoon.sitemap.Invocation#pushSitemapParameters(java.lang.String,
- * java.util.Map)
+ * @see org.apache.cocoon.sitemap.Invocation#pushSitemapParameters(java.lang.String, java.util.Map)
*/
- public void pushSitemapParameters(String nodeName, Map<String, ? extends Object> sitemapParameters) {
+ @Override
+ public void pushSitemapParameters(final String nodeName, final Map<String, ? extends Object> sitemapParameters) {
this.objectModel.getSitemapParameters().pushParameters(nodeName, sitemapParameters);
}
@@ -304,7 +313,8 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#resolve(java.lang.String)
*/
- public URL resolve(String resource) {
+ @Override
+ public URL resolve(final String resource) {
try {
return new URL(this.baseURL, resource);
} catch (MalformedURLException e) {
@@ -312,7 +322,7 @@ public class InvocationImpl implements I
}
}
- public void setComponentProvider(ComponentProvider componentProvider) {
+ public void setComponentProvider(final ComponentProvider componentProvider) {
this.componentProvider = componentProvider;
}
@@ -321,7 +331,8 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#setOutputStream(java.io.OutputStream)
*/
- public void setOutputStream(OutputStream outputStream) {
+ @Override
+ public void setOutputStream(final OutputStream outputStream) {
this.outputStream = outputStream;
}
@@ -330,11 +341,12 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#setParameters(java.util.Map)
*/
- public void setParameters(Map<String, Object> parameters) {
+ @Override
+ public void setParameters(final Map<String, Object> parameters) {
this.parameters = parameters;
}
- public void setRequestURI(String requestURI) {
+ public void setRequestURI(final String requestURI) {
this.requestURI = requestURI;
}
@@ -343,6 +355,7 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#setThrowable(java.lang.Throwable)
*/
+ @Override
public void setThrowable(final Throwable throwable) {
Throwable cause = ExceptionHandler.getCause(throwable);
// settings might be null when this instance is not managed by Spring
@@ -360,7 +373,7 @@ public class InvocationImpl implements I
this.objectModel.getCocoonObject().put("exception", cause);
ParameterHelper.setThrowable(this.parameters, cause);
- String message = "Error while executing the sitemap. [request-uri=" + this.getRequestURI() + "]";
+ final String message = "Error while executing the sitemap. [request-uri=" + this.getRequestURI() + "]";
ERROR_LOG.error(message, throwable);
}
@@ -373,6 +386,7 @@ public class InvocationImpl implements I
*
* @see org.apache.cocoon.sitemap.Invocation#resolveParameter(java.lang.String)
*/
+ @Override
public Object resolveParameter(final String parameter) {
if (parameter == null) {
return null;
@@ -415,9 +429,7 @@ public class InvocationImpl implements I
private Map<String, ? extends Object> resolveParameters(final Map<String, ? extends Object> componentParameters) {
final Map<String, Object> resolvedParameters = new HashMap<String, Object>();
- for (Map.Entry <String, ? extends Object> entry :
- componentParameters.entrySet()) {
-
+ for (Map.Entry<String, ? extends Object> entry : componentParameters.entrySet()) {
if (entry.getValue() instanceof String) {
resolvedParameters.put(entry.getKey(),
this.resolveParameter((String) entry.getValue()));
@@ -430,29 +442,29 @@ public class InvocationImpl implements I
return resolvedParameters;
}
- public void setBaseURL(URL baseURL) {
+ public void setBaseURL(final URL baseURL) {
this.baseURL = baseURL;
}
- public void setObjectModel(ObjectModel objectModel) {
+ public void setObjectModel(final ObjectModel objectModel) {
this.objectModel = objectModel;
}
public class UnsupportedExpressionLanguageException extends RuntimeException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1640324819576902297L;
- public UnsupportedExpressionLanguageException(String msg) {
+ public UnsupportedExpressionLanguageException(final String msg) {
super(msg);
}
}
public class VariableNotFoundException extends RuntimeException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 5762006616607282174L;
- public VariableNotFoundException(String msg) {
+ public VariableNotFoundException(final String msg) {
super(msg);
}
}
-}
\ No newline at end of file
+}
Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/SpringComponentProvider.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/SpringComponentProvider.java?rev=1414263&r1=1414262&r2=1414263&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/SpringComponentProvider.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/SpringComponentProvider.java Tue Nov 27 17:02:10 2012
@@ -39,48 +39,52 @@ public class SpringComponentProvider imp
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.sitemap.ComponentProvider#createAction(java.lang.String)
*/
- public synchronized Action createAction(String type) {
+ @Override
+ public synchronized Action createAction(final String type) {
return this.actionFactory.createAction(type);
}
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.sitemap.ComponentProvider#createComponent(java.lang.String)
*/
- public synchronized PipelineComponent createComponent(String type) {
+ @Override
+ public synchronized PipelineComponent createComponent(final String type) {
return this.pipelineComponentFactory.createComponent(type);
}
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.sitemap.ComponentProvider#createPipeline(java.lang.String)
*/
- public synchronized Pipeline<PipelineComponent> createPipeline(String type) {
+ @Override
+ public synchronized Pipeline<PipelineComponent> createPipeline(final String type) {
return this.pipelineFactory.createPipeline(type);
}
- public synchronized LanguageInterpreter getLanguageInterpreter(String language) {
+ @Override
+ public synchronized LanguageInterpreter getLanguageInterpreter(final String language) {
return this.languageInterpreterFactory.getLanguageInterpreter(language);
}
- public void setActionFactory(ActionFactory actionFactory) {
+ public void setActionFactory(final ActionFactory actionFactory) {
this.actionFactory = actionFactory;
}
- public void setLanguageInterpreterFactory(LanguageInterpreterFactory languageInterpreterFactory) {
+ public void setLanguageInterpreterFactory(final LanguageInterpreterFactory languageInterpreterFactory) {
this.languageInterpreterFactory = languageInterpreterFactory;
}
- public void setPipelineComponentFactory(PipelineComponentFactory pipelineComponentFactory) {
+ public void setPipelineComponentFactory(final PipelineComponentFactory pipelineComponentFactory) {
this.pipelineComponentFactory = pipelineComponentFactory;
}
- public void setPipelineFactory(PipelineFactory pipelineFactory) {
+ public void setPipelineFactory(final PipelineFactory pipelineFactory) {
this.pipelineFactory = pipelineFactory;
}
}
Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/AbstractSitemapNode.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/AbstractSitemapNode.java?rev=1414263&r1=1414262&r2=1414263&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/AbstractSitemapNode.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/AbstractSitemapNode.java Tue Nov 27 17:02:10 2012
@@ -23,10 +23,8 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.apache.cocoon.sitemap.Invocation;
import org.apache.cocoon.sitemap.node.annotations.NodeChild;
import org.apache.cocoon.sitemap.node.annotations.Parameter;
@@ -39,28 +37,32 @@ public abstract class AbstractSitemapNod
/**
* Logger.
*/
- private static final Logger LOG =
- LoggerFactory.getLogger(AbstractSitemapNode.class);
-
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractSitemapNode.class);
+
+ private static final String BASE_URL = "baseUrl";
+
private final List<SitemapNode> children = new LinkedList<SitemapNode>();
private final Map<String, String> parameters = new HashMap<String, String>();
private SitemapNode parent;
- public void addChild(SitemapNode child) {
+ @Override
+ public void addChild(final SitemapNode child) {
if (child == null) {
- throw new IllegalArgumentException(("Node of class " + this.getClass().getName() + " received null child."));
+ throw new IllegalArgumentException("Node of class " + this.getClass().getName() + " received null child.");
}
if (child.getType().equals(ParameterNode.class)) {
// ParameterNode are to be translated into parameters...
- ParameterNode parameterNode = (ParameterNode) SpringProxyHelper.unpackProxy(child);
+ final ParameterNode parameterNode = (ParameterNode) SpringProxyHelper.unpackProxy(child);
this.processParameter(parameterNode.getName(), parameterNode.getValue());
} else {
// check whether there is a special field for this child
- Field childField = this.getChildField(SpringProxyHelper.unpackProxy(child));
- if (childField != null) {
+ final Field childField = this.getChildField(SpringProxyHelper.unpackProxy(child));
+ if (childField == null) {
+ this.children.add(child);
+ } else {
childField.setAccessible(true);
try {
childField.set(this, SpringProxyHelper.unpackProxy(child));
@@ -69,8 +71,6 @@ public abstract class AbstractSitemapNod
} catch (IllegalAccessException e) {
LOG.error("Failed to set child field for child class '" + child.getClass().getName(), e);
}
- } else {
- this.children.add(child);
}
}
@@ -81,23 +81,23 @@ public abstract class AbstractSitemapNod
return this.parameters;
}
+ @Override
public SitemapNode getParent() {
return this.parent;
}
- public InvocationResult invoke(Invocation invocation) {
+ @Override
+ public InvocationResult invoke(final Invocation invocation) {
InvocationResult result = InvocationResult.NONE;
for (SitemapNode child : this.children) {
- if (LOG.isDebugEnabled()) {
- LOG.debug(child + ".invoke(" + invocation.getRequestURI() + ")");
- }
+ LOG.debug(child + ".invoke(" + invocation.getRequestURI() + ")");
// aggregate the results of child invocations, the overall result is
// the maximum of all individual results
// this is done based on the ordering of the enumeration values
// which is significant to java.lang.Comparable
- InvocationResult currentResult = child.invoke(invocation);
+ final InvocationResult currentResult = child.invoke(invocation);
if (currentResult.compareTo(result) > 0) {
result = currentResult;
}
@@ -110,29 +110,30 @@ public abstract class AbstractSitemapNod
return result;
}
- public void setParameters(Map<String, String> parameters) {
+ @Override
+ public void setParameters(final Map<String, String> parameters) {
if (parameters == null || parameters.isEmpty()) {
// nothing to do
return;
}
// check for special parameter fields
- Map<String, Field> parameterFields = this.getParameterFields();
- for (Entry<String, String> entry : parameters.entrySet()) {
- String key = entry.getKey();
- String value = entry.getValue();
+ final Map<String, Field> parameterFields = this.getParameterFields();
+ for (Map.Entry<String, String> entry : parameters.entrySet()) {
+ final String key = entry.getKey();
+ final String value = entry.getValue();
- Field parameterField = parameterFields.get(key);
+ final Field parameterField = parameterFields.get(key);
if (parameterField != null) {
parameterField.setAccessible(true);
try {
parameterField.set(this, value);
} catch (IllegalArgumentException e) {
- String message = "Failed to set parameter field " + key;
+ final String message = "Failed to set parameter field " + key;
LOG.error(message, e);
throw new RuntimeException(message, e);
} catch (IllegalAccessException e) {
- String message = "Failed to set parameter field " + key;
+ final String message = "Failed to set parameter field " + key;
LOG.error(message, e);
throw new RuntimeException(message, e);
}
@@ -144,7 +145,8 @@ public abstract class AbstractSitemapNod
}
}
- public void setParent(SitemapNode parent) {
+ @Override
+ public void setParent(final SitemapNode parent) {
this.parent = parent;
}
@@ -153,18 +155,19 @@ public abstract class AbstractSitemapNod
return this.getClass().getSimpleName();
}
- protected void processParameter(String key, String value) {
+ protected void processParameter(final String key, final String value) {
this.parameters.put(key, value);
}
- private Field getChildField(SitemapNode child) {
+ private Field getChildField(final SitemapNode child) {
Class<?> currentClass = this.getClass();
while (currentClass != null) {
- Field[] declaredFields = currentClass.getDeclaredFields();
+ final Field[] declaredFields = currentClass.getDeclaredFields();
for (Field declaredField : declaredFields) {
if (declaredField.isAnnotationPresent(NodeChild.class)
&& declaredField.getType().isAssignableFrom(child.getClass())) {
+
return declaredField;
}
}
@@ -176,14 +179,14 @@ public abstract class AbstractSitemapNod
}
private Map<String, Field> getParameterFields() {
- Map<String, Field> parameterFields = new HashMap<String, Field>();
+ final Map<String, Field> parameterFields = new HashMap<String, Field>();
Class<?> currentClass = this.getClass();
while (currentClass != null) {
- Field[] declaredFields = currentClass.getDeclaredFields();
+ final Field[] declaredFields = currentClass.getDeclaredFields();
for (Field declaredField : declaredFields) {
if (declaredField.isAnnotationPresent(Parameter.class)) {
- String fieldName = convertCamelCase(declaredField.getName());
+ final String fieldName = convertCamelCase(declaredField.getName());
parameterFields.put(fieldName, declaredField);
}
}
@@ -194,12 +197,12 @@ public abstract class AbstractSitemapNod
return parameterFields;
}
- private static String convertCamelCase(String name) {
- Pattern camelCasePattern = Pattern.compile("(.)([A-Z])");
- Matcher matcher = camelCasePattern.matcher(name);
+ private static String convertCamelCase(final String name) {
+ final Pattern camelCasePattern = Pattern.compile("(.)([A-Z])");
+ final Matcher matcher = camelCasePattern.matcher(name);
int lastMatch = 0;
- StringBuilder result = new StringBuilder();
+ final StringBuilder result = new StringBuilder();
while (matcher.find()) {
result.append(name.substring(lastMatch, matcher.start()));
result.append(matcher.group(1));
@@ -212,35 +215,31 @@ public abstract class AbstractSitemapNod
return result.toString();
}
-
- protected InvocationResult invoke(final String src, final String type,
+
+ protected InvocationResult invoke(final String src, final String type,
final Invocation invocation) {
-
- final Map<String, Object> invocationParams =
- new HashMap<String, Object>(this.getParameters());
- for (String key: invocationParams.keySet()) {
+ final Map<String, Object> invocationParams = new HashMap<String, Object>(this.getParameters());
+
+ for (Map.Entry<String, Object> entry : invocationParams.entrySet()) {
//overwrite the key with substituted value
- invocationParams.put(key, invocation.resolveParameter(invocationParams.get(key).toString()));
+ invocationParams.put(entry.getKey(), invocation.resolveParameter(entry.getValue().toString()));
}
-
if (src != null) {
final Object resolvedSource = invocation.resolveParameter(src);
if (!(resolvedSource instanceof String)) {
- throw new IllegalArgumentException(
- "Only strings can be resolved as URLs");
+ throw new IllegalArgumentException("Only strings can be resolved as URLs");
}
- invocationParams.put("source",
- invocation.resolve((String) resolvedSource));
+ invocationParams.put("source", invocation.resolve((String) resolvedSource));
}
// set the baseUrl
- if (!invocationParams.containsKey("baseUrl")) {
- invocationParams.put("baseUrl", invocation.resolve(""));
- } else {
- invocationParams.put("baseUrl", invocation.resolve(invocationParams.get("baseUrl").toString()));
+ if (invocationParams.containsKey(BASE_URL)) {
+ invocationParams.put(BASE_URL, invocation.resolve(invocationParams.get(BASE_URL).toString()));
+ } else {
+ invocationParams.put(BASE_URL, invocation.resolve(""));
}
// install the component
Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/ErrorNode.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/ErrorNode.java?rev=1414263&r1=1414262&r2=1414263&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/ErrorNode.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/ErrorNode.java Tue Nov 27 17:02:10 2012
@@ -24,7 +24,7 @@ import org.apache.cocoon.sitemap.Invocat
public class ErrorNode extends PipelineNode {
@Override
- public InvocationResult invoke(Invocation invocation) {
+ public InvocationResult invoke(final Invocation invocation) {
if (!invocation.isErrorInvocation()) {
// we're not responsible for non-error-invocations
return InvocationResult.NONE;
@@ -38,7 +38,7 @@ public class ErrorNode extends PipelineN
/**
* {@inheritDoc}
- *
+ *
* @see org.apache.cocoon.sitemap.node.SitemapNode#getType()
*/
@Override
Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelineNode.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelineNode.java?rev=1414263&r1=1414262&r2=1414263&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelineNode.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelineNode.java Tue Nov 27 17:02:10 2012
@@ -42,6 +42,7 @@ public class PipelineNode extends Abstra
*
* @see org.apache.cocoon.sitemap.node.SitemapNode#getType()
*/
+ @Override
public Class<?> getType() {
return PipelineNode.class;
}
@@ -52,7 +53,7 @@ public class PipelineNode extends Abstra
* @see org.apache.cocoon.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.sitemap.Invocation)
*/
@Override
- public InvocationResult invoke(Invocation invocation) {
+ public InvocationResult invoke(final Invocation invocation) {
this.installPipeline(invocation);
clearActions(invocation);
@@ -74,7 +75,7 @@ public class PipelineNode extends Abstra
}
}
- private static void clearActions(Invocation invocation) {
+ private static void clearActions(final Invocation invocation) {
invocation.reset();
}
@@ -88,10 +89,10 @@ public class PipelineNode extends Abstra
return "PipelineNode(" + this.type + ", internalOnly=" + "true".equalsIgnoreCase(this.internalOnly) + ")";
}
- private InvocationResult handleException(Invocation invocation, Exception ex) {
+ private InvocationResult handleException(final Invocation invocation, final Exception exception) {
if (this.errorNode != null) {
// try to recover from the exception, using our error node
- invocation.setThrowable(ExceptionHandler.getCause(ex));
+ invocation.setThrowable(ExceptionHandler.getCause(exception));
if (this.errorNode.invoke(invocation).isCompleted()) {
// indicate that we handled this successfully
return InvocationResult.COMPLETED;
@@ -100,10 +101,10 @@ public class PipelineNode extends Abstra
// no error-handling configured or error-handling itself failed
// -> let the parent handle this
- throw ExceptionHandler.getInvocationException(ex);
+ throw ExceptionHandler.getInvocationException(exception);
}
- protected void installPipeline(Invocation invocation) {
+ protected void installPipeline(final Invocation invocation) {
invocation.installPipeline(PIPELINE_CATEGORY + this.type, "true".equalsIgnoreCase(this.internalOnly),
this.getParameters());
}
Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelinesNode.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelinesNode.java?rev=1414263&r1=1414262&r2=1414263&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelinesNode.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/PipelinesNode.java Tue Nov 27 17:02:10 2012
@@ -34,6 +34,7 @@ public class PipelinesNode extends Abstr
*
* @see org.apache.cocoon.sitemap.node.SitemapNode#getType()
*/
+ @Override
public Class<?> getType() {
return PipelinesNode.class;
}
@@ -44,7 +45,7 @@ public class PipelinesNode extends Abstr
* @see org.apache.cocoon.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.sitemap.Invocation)
*/
@Override
- public InvocationResult invoke(Invocation invocation) {
+ public InvocationResult invoke(final Invocation invocation) {
try {
if (super.invoke(invocation).isContinued()) {
// signal that we handled this successfully
@@ -52,15 +53,16 @@ public class PipelinesNode extends Abstr
}
// none of our children was responsible
- throw new NoMatchingPipelineException("No pipeline matched the request '" + invocation.getRequestURI() + "'");
+ throw new NoMatchingPipelineException(
+ "No pipeline matched the request '" + invocation.getRequestURI() + "'");
} catch (Exception ex) {
return this.handleException(invocation, ex);
}
}
- private InvocationResult handleException(Invocation invocation, Exception ex) {
+ private InvocationResult handleException(final Invocation invocation, final Exception exception) {
if (this.errorNode != null) {
- invocation.setThrowable(ExceptionHandler.getCause(ex));
+ invocation.setThrowable(ExceptionHandler.getCause(exception));
if (this.errorNode.invoke(invocation).isCompleted()) {
// signal that we handled this successfully
return InvocationResult.COMPLETED;
@@ -69,6 +71,6 @@ public class PipelinesNode extends Abstr
// no error-handling configured or error-handling itself failed
// -> let the parent handle this
- throw ExceptionHandler.getInvocationException(ex);
+ throw ExceptionHandler.getInvocationException(exception);
}
}
Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/Sitemap.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/Sitemap.java?rev=1414263&r1=1414262&r2=1414263&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/Sitemap.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/node/Sitemap.java Tue Nov 27 17:02:10 2012
@@ -28,6 +28,7 @@ public class Sitemap extends AbstractSit
*
* @see org.apache.cocoon.sitemap.node.SitemapNode#getType()
*/
+ @Override
public Class<?> getType() {
return Sitemap.class;
}
@@ -38,7 +39,7 @@ public class Sitemap extends AbstractSit
* @see org.apache.cocoon.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.sitemap.Invocation)
*/
@Override
- public InvocationResult invoke(Invocation invocation) {
+ public InvocationResult invoke(final Invocation invocation) {
return super.invoke(invocation);
}
}
Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/util/ExceptionHandler.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/util/ExceptionHandler.java?rev=1414263&r1=1414262&r2=1414263&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/util/ExceptionHandler.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/util/ExceptionHandler.java Tue Nov 27 17:02:10 2012
@@ -20,18 +20,18 @@ package org.apache.cocoon.sitemap.util;
import org.apache.cocoon.sitemap.InvocationException;
-public class ExceptionHandler {
+public final class ExceptionHandler {
/**
- * Wraps the given <code>throwable</code> into an {@link InvocationException}, if that is necessary.<br>
- * <br>
- * If the given <code>throwable</code> is already an instance of {@link InvocationException}, the given
+ * Wraps the given
+ * <code>throwable</code> into an {@link InvocationException}, if that is necessary.<br> <br> If the given
+ * <code>throwable</code> is already an instance of {@link InvocationException}, the given
* <code>throwable</code> is returned.
- *
+ *
* @param throwable The throwable to wrap inside an {@link InvocationException}.
* @return The (possibly) wrapped <code>throwable</code>.
*/
- public static InvocationException getInvocationException(Throwable throwable) {
+ public static InvocationException getInvocationException(final Throwable throwable) {
if (throwable instanceof InvocationException) {
return (InvocationException) throwable;
}
@@ -40,21 +40,19 @@ public class ExceptionHandler {
}
/**
- * Get the underlying cause of the given <code>exception</code>.<br>
- * <br>
- * Technically this unwraps the given <code>exception</code> until one of the following happens
- * <ul>
- * <li>there is no more underlying cause</li>
- * <li>an Exception other than {@link InvocationException} or one of its subclasses is encountered
- * </ul>
- * <br>
- * This method will return <code>null</code> if and only if the given <code>exception</code> is
+ * Get the underlying cause of the given
+ * <code>exception</code>.<br> <br> Technically this unwraps the given
+ * <code>exception</code> until one of the following happens <ul> <li>there is no more underlying cause</li> <li>an
+ * Exception other than {@link InvocationException} or one of its subclasses is encountered </ul> <br> This method
+ * will return
+ * <code>null</code> if and only if the given
+ * <code>exception</code> is
* <code>null</code>.
- *
+ *
* @param throwable The {@link Throwable} to get the cause for.
* @return The underlying cause.
*/
- public static Throwable getCause(Throwable throwable) {
+ public static Throwable getCause(final Throwable throwable) {
if (throwable == null) {
return null;
}
@@ -71,4 +69,10 @@ public class ExceptionHandler {
return currentThrowable;
}
+
+ /**
+ * Private constructor, suggested for classes with static methods only.
+ */
+ private ExceptionHandler() {
+ }
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.