struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject [2/2] struts git commit: Minor code improvements's in the cdi, convention, jasperreports, junit, rest and sitemesh plugin
Date Tue, 16 Jun 2015 18:37:17 GMT
Minor code improvements's in the cdi, convention, jasperreports, junit, rest and sitemesh plugin

- Use Java 7 features like diamond operator
- Improve some logging message and don't check LOG.isXxx if not necessary
- Fix some typos
- Use BooleanUtils.toBoolean(string) instead of "true".isEquals to be more robust


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/5a835cf6
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/5a835cf6
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/5a835cf6

Branch: refs/heads/master
Commit: 5a835cf6ac85a630704d52128ba0cbb58f03182a
Parents: 2e9df57
Author: Johannes Geppert <jogep@apache.org>
Authored: Tue Jun 16 20:37:20 2015 +0200
Committer: Johannes Geppert <jogep@apache.org>
Committed: Tue Jun 16 20:37:20 2015 +0200

----------------------------------------------------------------------
 .../apache/struts2/cdi/CdiObjectFactory.java    |  18 +--
 .../struts2/convention/ActionConfigBuilder.java |   2 +-
 .../ClasspathConfigurationProvider.java         |  14 +-
 .../convention/ConventionUnknownHandler.java    |  60 +++-----
 .../convention/ConventionsServiceImpl.java      |   2 +-
 .../DefaultInterceptorMapBuilder.java           |  26 ++--
 .../convention/DefaultResultMapBuilder.java     |  18 +--
 .../PackageBasedActionConfigBuilder.java        | 153 ++++++++-----------
 .../struts2/convention/ReflectionTools.java     |  16 +-
 .../apache/struts2/convention/StringTools.java  |  12 +-
 .../ConventionUnknownHandlerTest.java           |   8 +-
 .../convention/DefaultResultMapBuilderTest.java |  37 ++---
 .../PackageBasedActionConfigBuilderTest.java    |  54 ++-----
 .../jasperreports/JasperReportsResult.java      |  42 ++---
 .../jasperreports/ValueStackShadowMap.java      |   2 +-
 .../apache/struts2/StrutsJUnit4TestCase.java    |  15 +-
 .../rest/DefaultContentTypeHandlerManager.java  |   4 +-
 .../org/apache/struts2/rest/HttpHeaders.java    |   2 +-
 .../struts2/rest/RestActionInvocation.java      |  49 +++---
 .../apache/struts2/rest/RestActionMapper.java   |  36 ++---
 .../struts2/rest/RestWorkflowInterceptor.java   |  11 +-
 .../sitemesh/FreemarkerDecoratorServlet.java    |  31 ++--
 .../struts2/sitemesh/StrutsSiteMeshFactory.java |   8 +-
 .../sitemesh/VelocityDecoratorServlet.java      |  14 +-
 24 files changed, 235 insertions(+), 399 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/cdi/src/main/java/org/apache/struts2/cdi/CdiObjectFactory.java
----------------------------------------------------------------------
diff --git a/plugins/cdi/src/main/java/org/apache/struts2/cdi/CdiObjectFactory.java b/plugins/cdi/src/main/java/org/apache/struts2/cdi/CdiObjectFactory.java
index 08a5ffa..91601b3 100644
--- a/plugins/cdi/src/main/java/org/apache/struts2/cdi/CdiObjectFactory.java
+++ b/plugins/cdi/src/main/java/org/apache/struts2/cdi/CdiObjectFactory.java
@@ -21,8 +21,8 @@ package org.apache.struts2.cdi;
 
 import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.inject.Inject;
-import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.BeanManager;
@@ -114,14 +114,10 @@ public class CdiObjectFactory extends ObjectFactory {
 				bm = lookup(initialContext, CDI_JNDIKEY_BEANMANAGER_COMP_ENV);
 			}
 			if (bm == null) {
-				if (LOG.isErrorEnabled()) {
-					LOG.error("[findBeanManager]: Could not find BeanManager instance for any given JNDI key, giving up");
-				}
+				LOG.error("[findBeanManager]: Could not find BeanManager instance for any given JNDI key, giving up");
 			}
 		} catch ( NamingException e ) {
-			if (LOG.isErrorEnabled()) {
-				LOG.error("[findBeanManager]: Unable to get InitialContext for BeanManager lookup", e);
-			}
+			LOG.error("[findBeanManager]: Unable to get InitialContext for BeanManager lookup", e);
 		}
 		return bm;
 	}
@@ -135,16 +131,12 @@ public class CdiObjectFactory extends ObjectFactory {
 	 * @return the BeanManager, if found; <tt>null</tt> if not found or {@link javax.naming.NamingException} was thrown.
 	 */
 	protected BeanManager lookup( Context context, String jndiKeyToCheck ) {
-		if (LOG.isInfoEnabled()) {
-			LOG.info("[lookup]: Checking for BeanManager under JNDI key " + jndiKeyToCheck);
-		}
+		LOG.info("[lookup]: Checking for BeanManager under JNDI key {}", jndiKeyToCheck);
 		BeanManager result = null;
 		try {
 			result = (BeanManager) context.lookup(jndiKeyToCheck);
 		} catch ( NamingException e ) {
-			if (LOG.isDebugEnabled()) {
-				LOG.debug("[lookup]: BeanManager lookup failed for JNDI key " + jndiKeyToCheck, e);
-			}
+			LOG.debug("[lookup]: BeanManager lookup failed for JNDI key {}", jndiKeyToCheck, e);
 		}
 		return result;
 	}

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/convention/src/main/java/org/apache/struts2/convention/ActionConfigBuilder.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/ActionConfigBuilder.java b/plugins/convention/src/main/java/org/apache/struts2/convention/ActionConfigBuilder.java
index 71ec481..0d45590 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/ActionConfigBuilder.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/ActionConfigBuilder.java
@@ -32,7 +32,7 @@ package org.apache.struts2.convention;
 public interface ActionConfigBuilder {
     /**
      * Builds all the action configurations and stores them into the XWork configuration instance
-     * via XWork dependency injetion.
+     * via XWork dependency injection.
      */
     void buildActionConfigs();
 

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java b/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java
index 153986e..f5e7973 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/ClasspathConfigurationProvider.java
@@ -23,13 +23,14 @@ package org.apache.struts2.convention;
 import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationException;
 import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.ContainerBuilder;
 import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.util.location.LocatableProperties;
-import org.apache.struts2.dispatcher.DispatcherListener;
-import org.apache.struts2.dispatcher.Dispatcher;
+import org.apache.commons.lang3.BooleanUtils;
 import org.apache.struts2.StrutsConstants;
+import org.apache.struts2.dispatcher.Dispatcher;
+import org.apache.struts2.dispatcher.DispatcherListener;
 
 /**
  * <p>
@@ -49,20 +50,21 @@ public class ClasspathConfigurationProvider implements ConfigurationProvider, Di
 
     @Inject(StrutsConstants.STRUTS_DEVMODE)
     public void setDevMode(String mode) {
-        this.devMode = "true".equals(mode);
+        this.devMode = BooleanUtils.toBoolean(mode);
     }
 
     @Inject("struts.convention.classes.reload")
     public void setReload(String reload) {
-        this.reload = "true".equals(reload);
+        this.reload = BooleanUtils.toBoolean(reload);
     }
 
     /**
      * Not used.
      */
     public void destroy() {
-        if (this.listeningToDispatcher)
+        if (this.listeningToDispatcher) {
             Dispatcher.removeDispatcherListener(this);
+        }
         actionConfigBuilder.destroy();
     }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java b/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java
index 4ba807b..bacc30d 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java
@@ -20,34 +20,21 @@
  */
 package org.apache.struts2.convention;
 
-import com.opensymphony.xwork2.Action;
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionSupport;
-import com.opensymphony.xwork2.ObjectFactory;
-import com.opensymphony.xwork2.Result;
-import com.opensymphony.xwork2.UnknownHandler;
-import com.opensymphony.xwork2.XWorkException;
+import com.opensymphony.xwork2.*;
 import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationException;
-import com.opensymphony.xwork2.config.entities.ActionConfig;
-import com.opensymphony.xwork2.config.entities.InterceptorMapping;
-import com.opensymphony.xwork2.config.entities.PackageConfig;
-import com.opensymphony.xwork2.config.entities.ResultConfig;
-import com.opensymphony.xwork2.config.entities.ResultTypeConfig;
+import com.opensymphony.xwork2.config.entities.*;
 import com.opensymphony.xwork2.config.providers.InterceptorBuilder;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
-import org.apache.logging.log4j.Logger;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 import javax.servlet.ServletContext;
 import java.net.MalformedURLException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * <p>
@@ -172,7 +159,7 @@ public class ConventionUnknownHandler implements UnknownHandler {
 
             // try to find index action in current namespace or in default one
             if (actionConfig == null) {
-                LOG.trace("Looking for action named [index] in namespace [#0] or in default namespace", namespace);
+                LOG.trace("Looking for action named [index] in namespace [{}] or in default namespace", namespace);
                 actionConfig = configuration.getRuntimeConfiguration().getActionConfig(namespace, "index");
             }
         }
@@ -197,9 +184,7 @@ public class ConventionUnknownHandler implements UnknownHandler {
                     return new Resource(canonicalPath, ext);
                 }
             } catch (MalformedURLException e) {
-                if (LOG.isErrorEnabled()) {
-                    LOG.error("Unable to parse path to the web application resource {} skipping...", canonicalPath);
-                }
+                LOG.error("Unable to parse path to the web application resource {} skipping...", canonicalPath);
             }
         }
 
@@ -215,8 +200,8 @@ public class ConventionUnknownHandler implements UnknownHandler {
     }
 
     protected ActionConfig buildActionConfig(String path, ResultTypeConfig resultTypeConfig) {
-        Map<String, ResultConfig> results = new HashMap<String, ResultConfig>();
-        HashMap<String, String> params = new HashMap<String, String>();
+        Map<String, ResultConfig> results = new HashMap<>();
+        HashMap<String, String> params = new HashMap<>();
         if (resultTypeConfig.getParams() != null) {
             params.putAll(resultTypeConfig.getParams());
         }
@@ -240,7 +225,7 @@ public class ConventionUnknownHandler implements UnknownHandler {
             if (LOG.isTraceEnabled()) {
                 String fqan = ns + "/" + actionName;
                 LOG.trace("Trying to locate the correct result for the FQ action [{}]"
-                        + " with an file extension of [#1] in the directory [{}] " + "and a result code of [{}]",
+                        + " with an file extension of [{}] in the directory [{}] " + "and a result code of [{}]",
                         fqan, ext, pathPrefix, resultCode);
             }
 
@@ -306,10 +291,7 @@ public class ConventionUnknownHandler implements UnknownHandler {
             String chainedTo = actionName + nameSeparator + resultCode;
             ActionConfig chainedToConfig = pkg.getActionConfigs().get(chainedTo);
             if (chainedToConfig != null) {
-                if (LOG.isTraceEnabled()) {
-                    LOG.trace("Action [{}] used as chain result for [{}] and result [{}]", chainedTo, actionName, resultCode);
-                }
-
+                LOG.trace("Action [{}] used as chain result for [{}] and result [{}]", chainedTo, actionName, resultCode);
                 ResultTypeConfig chainResultType = pkg.getAllResultTypeConfigs().get("chain");
                 result = buildResult(chainedTo, resultCode, chainResultType, actionContext);
             }
@@ -321,28 +303,22 @@ public class ConventionUnknownHandler implements UnknownHandler {
     protected Result findResult(String path, String resultCode, String ext, ActionContext actionContext,
                                 Map<String, ResultTypeConfig> resultsByExtension) {
         try {
-            boolean traceEnabled = LOG.isTraceEnabled();
-            if (traceEnabled)
-                LOG.trace("Checking ServletContext for {}", path);
+            LOG.trace("Checking ServletContext for {}", path);
 
             if (servletContext.getResource(path) != null) {
-                if (traceEnabled)
-                    LOG.trace("Found");
+                LOG.trace("Found");
                 return buildResult(path, resultCode, resultsByExtension.get(ext), actionContext);
             }
 
-            if (traceEnabled)
-                LOG.trace("Checking ClasLoader for {}", path);
+            LOG.trace("Checking ClassLoader for {}", path);
 
             String classLoaderPath = path.startsWith("/") ? path.substring(1, path.length()) : path;
             if (ClassLoaderUtil.getResource(classLoaderPath, getClass()) != null) {
-                if (traceEnabled)
-                    LOG.trace("Found");
+                LOG.trace("Found");
                 return buildResult(path, resultCode, resultsByExtension.get(ext), actionContext);
             }
         } catch (MalformedURLException e) {
-            if (LOG.isErrorEnabled())
-                LOG.error("Unable to parse template path: {} skipping...", path);
+            LOG.error("Unable to parse template path: {} skipping...", path);
         }
 
         return null;
@@ -351,7 +327,7 @@ public class ConventionUnknownHandler implements UnknownHandler {
     protected Result buildResult(String path, String resultCode, ResultTypeConfig config, ActionContext invocationContext) {
         String resultClass = config.getClassName();
 
-        Map<String, String> params = new LinkedHashMap<String, String>();
+        Map<String, String> params = new LinkedHashMap<>();
         if (config.getParams() != null) {
             params.putAll(config.getParams());
         }
@@ -389,7 +365,7 @@ public class ConventionUnknownHandler implements UnknownHandler {
             finalPrefix += "/";
         }
 
-        if (namespace == null || "/".equals(namespace)) {
+        if (StringUtils.equals(namespace,"/" )) {
             namespace = "";
         }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java b/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java
index 56815a6..1a8af90 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionsServiceImpl.java
@@ -107,7 +107,7 @@ public class ConventionsServiceImpl implements ConventionsService {
     public Map<String, ResultTypeConfig> getResultTypesByExtension(PackageConfig packageConfig) {
         Map<String, ResultTypeConfig> results = packageConfig.getAllResultTypeConfigs();
 
-        Map<String, ResultTypeConfig> resultsByExtension = new HashMap<String, ResultTypeConfig>();
+        Map<String, ResultTypeConfig> resultsByExtension = new HashMap<>();
         resultsByExtension.put("jsp", results.get("dispatcher"));
         resultsByExtension.put("jspf", results.get("dispatcher"));
         resultsByExtension.put("jspx", results.get("dispatcher"));

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java b/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java
index 0e9edd8..6ebce88 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java
@@ -27,8 +27,8 @@ import com.opensymphony.xwork2.config.entities.PackageConfig;
 import com.opensymphony.xwork2.config.providers.InterceptorBuilder;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.AnnotationUtils;
-import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.convention.annotation.Action;
 import org.apache.struts2.convention.annotation.InterceptorRef;
 import org.apache.struts2.convention.annotation.InterceptorRefs;
@@ -50,7 +50,7 @@ public class DefaultInterceptorMapBuilder implements InterceptorMapBuilder {
 
 	public List<InterceptorMapping> build(Class<?> actionClass, PackageConfig.Builder builder,
 			String actionName, Action annotation) {
-		List<InterceptorMapping> interceptorList = new ArrayList<InterceptorMapping>(
+		List<InterceptorMapping> interceptorList = new ArrayList<>(
 				10);
 
 		//from @InterceptorRefs annotation
@@ -75,27 +75,19 @@ public class DefaultInterceptorMapBuilder implements InterceptorMapBuilder {
 	}
 
 	protected List<InterceptorMapping> build(InterceptorRef[] interceptors, String actionName, PackageConfig.Builder builder) {
-	    List<InterceptorMapping> interceptorList = new ArrayList<InterceptorMapping>(
-                10);
+	    List<InterceptorMapping> interceptorList = new ArrayList<>(10);
 	    for (InterceptorRef interceptor : interceptors) {
-            if (LOG.isTraceEnabled())
-                LOG.trace("Adding interceptor [{}] to [{}]",
-                        interceptor.value(), actionName);
-            Map<String, String> params = StringTools.createParameterMap(interceptor
-                    .params());
-            interceptorList.addAll(buildInterceptorList(builder,
-                    interceptor, params));
+            LOG.trace("Adding interceptor [{}] to [{}]", interceptor.value(), actionName);
+            Map<String, String> params = StringTools.createParameterMap(interceptor.params());
+            interceptorList.addAll(buildInterceptorList(builder, interceptor, params));
         }
 
 	    return interceptorList;
 	}
 
-	protected List<InterceptorMapping> buildInterceptorList(
-			PackageConfig.Builder builder, InterceptorRef ref, Map params) {
-		return InterceptorBuilder.constructInterceptorReference(builder, ref
-				.value(), params, builder.build().getLocation(),
-                configuration.getContainer().getInstance(
-						ObjectFactory.class));
+	protected List<InterceptorMapping> buildInterceptorList(PackageConfig.Builder builder, InterceptorRef ref, Map params) {
+		return InterceptorBuilder.constructInterceptorReference(builder, ref.value(), params, builder.build().getLocation(),
+                configuration.getContainer().getInstance(ObjectFactory.class));
 	}
 
 	@Inject

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java b/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
index d27381d..767b534 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
@@ -32,21 +32,17 @@ import com.opensymphony.xwork2.util.finder.ClassLoaderInterface;
 import com.opensymphony.xwork2.util.finder.ClassLoaderInterfaceDelegate;
 import com.opensymphony.xwork2.util.finder.ResourceFinder;
 import com.opensymphony.xwork2.util.finder.Test;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.convention.annotation.Result;
 import org.apache.struts2.convention.annotation.Results;
 
 import javax.servlet.ServletContext;
 import java.io.IOException;
 import java.net.URL;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 /**
  * <p>
@@ -135,7 +131,7 @@ public class DefaultResultMapBuilder implements ResultMapBuilder {
     public DefaultResultMapBuilder(ServletContext servletContext, Container container,
             @Inject("struts.convention.relative.result.types") String relativeResultTypes) {
         this.servletContext = servletContext;
-        this.relativeResultTypes = new HashSet<String>(Arrays.asList(relativeResultTypes.split("\\s*[,]\\s*")));
+        this.relativeResultTypes = new HashSet<>(Arrays.asList(relativeResultTypes.split("\\s*[,]\\s*")));
         this.conventionsService = container.getInstance(ConventionsService.class, container.getInstance(String.class, ConventionConstants.CONVENTION_CONVENTIONS_SERVICE));
     }
 
@@ -184,7 +180,7 @@ public class DefaultResultMapBuilder implements ResultMapBuilder {
         String resultPrefix = defaultResultPath + actionName;
 
         //results from files
-        Map<String, ResultConfig> results = new HashMap<String, ResultConfig>();
+        Map<String, ResultConfig> results = new HashMap<>();
         Map<String, ResultTypeConfig> resultsByExtension = conventionsService.getResultTypesByExtension(packageConfig);
         createFromResources(actionClass, results, defaultResultPath, resultPrefix, actionName,
             packageConfig, resultsByExtension);
@@ -318,7 +314,7 @@ public class DefaultResultMapBuilder implements ResultMapBuilder {
         if (ctx != null)
             classLoaderInterface = (ClassLoaderInterface) ctx.get(ClassLoaderInterface.CLASS_LOADER_INTERFACE);
 
-        return (ClassLoaderInterface) ObjectUtils.defaultIfNull(classLoaderInterface, new ClassLoaderInterfaceDelegate(Thread.currentThread().getContextClassLoader()));
+        return ObjectUtils.defaultIfNull(classLoaderInterface, new ClassLoaderInterfaceDelegate(Thread.currentThread().getContextClassLoader()));
 
     }
 
@@ -448,7 +444,7 @@ public class DefaultResultMapBuilder implements ResultMapBuilder {
         }
 
         // Add the default parameters for the result type config (if any)
-        HashMap<String, String> params = new HashMap<String, String>();
+        HashMap<String, String> params = new HashMap<>();
         if (resultTypeConfig.getParams() != null) {
             params.putAll(resultTypeConfig.getParams());
         }

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java b/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
index 702e1d3..cac3566 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
@@ -26,52 +26,28 @@ import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationException;
-import com.opensymphony.xwork2.config.entities.ActionConfig;
-import com.opensymphony.xwork2.config.entities.ExceptionMappingConfig;
-import com.opensymphony.xwork2.config.entities.InterceptorMapping;
-import com.opensymphony.xwork2.config.entities.PackageConfig;
-import com.opensymphony.xwork2.config.entities.ResultConfig;
+import com.opensymphony.xwork2.config.entities.*;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.AnnotationUtils;
 import com.opensymphony.xwork2.util.TextParseUtil;
 import com.opensymphony.xwork2.util.WildcardHelper;
 import com.opensymphony.xwork2.util.classloader.ReloadingClassLoader;
-import com.opensymphony.xwork2.util.finder.ClassFinder;
-import com.opensymphony.xwork2.util.finder.ClassFinderFactory;
-import com.opensymphony.xwork2.util.finder.DefaultClassFinder;
-import com.opensymphony.xwork2.util.finder.ClassLoaderInterface;
-import com.opensymphony.xwork2.util.finder.ClassLoaderInterfaceDelegate;
-import com.opensymphony.xwork2.util.finder.Test;
-import com.opensymphony.xwork2.util.finder.UrlSet;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
+import com.opensymphony.xwork2.util.finder.*;
+import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.StrutsException;
-import org.apache.struts2.convention.annotation.Action;
-import org.apache.struts2.convention.annotation.Actions;
-import org.apache.struts2.convention.annotation.DefaultInterceptorRef;
-import org.apache.struts2.convention.annotation.ExceptionMapping;
-import org.apache.struts2.convention.annotation.ExceptionMappings;
-import org.apache.struts2.convention.annotation.Namespace;
-import org.apache.struts2.convention.annotation.Namespaces;
-import org.apache.struts2.convention.annotation.ParentPackage;
+import org.apache.struts2.convention.annotation.*;
 
 import java.io.IOException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.regex.Pattern;
 
 /**
@@ -101,7 +77,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
     private String actionSuffix = "Action";
     private boolean checkImplementsAction = true;
     private boolean mapAllMatches = false;
-    private Set<String> loadedFileUrls = new HashSet<String>();
+    private Set<String> loadedFileUrls = new HashSet<>();
     private boolean devMode;
     private ReloadingClassLoader reloadingClassLoader;
     private boolean reload;
@@ -151,7 +127,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
 
     @Inject(StrutsConstants.STRUTS_DEVMODE)
     public void setDevMode(String mode) {
-        this.devMode = "true".equals(mode);
+        this.devMode = BooleanUtils.toBoolean(mode);
     }
 
     /**
@@ -160,13 +136,13 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
      */
     @Inject("struts.convention.classes.reload")
     public void setReload(String reload) {
-        this.reload = "true".equals(reload);
+        this.reload = BooleanUtils.toBoolean(reload);
     }
 
 
     @Inject(StrutsConstants.STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES)
     public void setSlashesInActionNames(String slashesInActionNames) {
-        this.slashesInActionNames = "true".equals(slashesInActionNames);
+        this.slashesInActionNames = BooleanUtils.toBoolean(slashesInActionNames);
     }
 
     /**
@@ -174,7 +150,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
      */
     @Inject("struts.convention.exclude.parentClassLoader")
     public void setExcludeParentClassLoader(String exclude) {
-        this.excludeParentClassLoader = "true".equals(exclude);
+        this.excludeParentClassLoader = BooleanUtils.toBoolean(exclude);
     }
 
     /**
@@ -183,7 +159,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
      */
     @Inject("struts.convention.action.alwaysMapExecute")
     public void setAlwaysMapExecute(String alwaysMapExecute) {
-        this.alwaysMapExecute = "true".equals(alwaysMapExecute);
+        this.alwaysMapExecute = BooleanUtils.toBoolean(alwaysMapExecute);
     }
 
     /**
@@ -202,7 +178,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
      */
     @Inject(value = "struts.convention.action.disableScanning", required = false)
     public void setDisableActionScanning(String disableActionScanning) {
-        this.disableActionScanning = "true".equals(disableActionScanning);
+        this.disableActionScanning = BooleanUtils.toBoolean(disableActionScanning);
     }
 
     /**
@@ -219,7 +195,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
      */
     @Inject(value = "struts.convention.package.locators.disable", required = false)
     public void setDisablePackageLocatorsScanning(String disablePackageLocatorsScanning) {
-        this.disablePackageLocatorsScanning = "true".equals(disablePackageLocatorsScanning);
+        this.disablePackageLocatorsScanning = BooleanUtils.toBoolean(disablePackageLocatorsScanning);
     }
 
     /**
@@ -239,7 +215,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
      */
     @Inject(value = "struts.convention.action.checkImplementsAction", required = false)
     public void setCheckImplementsAction(String checkImplementsAction) {
-        this.checkImplementsAction = "true".equals(checkImplementsAction);
+        this.checkImplementsAction = BooleanUtils.toBoolean(checkImplementsAction);
     }
 
     /**
@@ -288,7 +264,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
      */
     @Inject(value = "struts.convention.action.mapAllMatches", required = false)
     public void setMapAllMatches(String mapAllMatches) {
-        this.mapAllMatches = "true".equals(mapAllMatches);
+        this.mapAllMatches = BooleanUtils.toBoolean(mapAllMatches);
     }
 
     /**
@@ -297,7 +273,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
      */
     @Inject(value = "struts.convention.action.eagerLoading", required = false)
     public void setEagerLoading(String eagerLoading) {
-        this.eagerLoading = "true".equals(eagerLoading);
+        this.eagerLoading = BooleanUtils.toBoolean(eagerLoading);
     }
 
     @Inject
@@ -343,12 +319,15 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
 
             if (LOG.isTraceEnabled()) {
                 LOG.trace("Loading action configurations");
-                if (actionPackages != null)
-                    LOG.trace("Actions being loaded from action packages " + Arrays.asList(actionPackages));
-                if (packageLocators != null)
-                    LOG.trace("Actions being loaded using package locators " + Arrays.asList(packageLocators));
-                if (excludePackages != null)
-                    LOG.trace("Excluding actions from packages " + Arrays.asList(excludePackages));
+                if (actionPackages != null) {
+                    LOG.trace("Actions being loaded from action packages: {}", actionPackages);
+                }
+                if (packageLocators != null) {
+                    LOG.trace("Actions being loaded using package locator's: {}", packageLocators);
+                }
+                if (excludePackages != null) {
+                    LOG.trace("Excluding actions from packages: {}", excludePackages);
+                }
             }
 
             Set<Class> classes = findActions();
@@ -357,8 +336,9 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
     }
 
     protected ClassLoaderInterface getClassLoaderInterface() {
-        if (isReloadEnabled())
+        if (isReloadEnabled()) {
             return new ClassLoaderInterfaceDelegate(this.reloadingClassLoader);
+        }
         else {
             /*
             if there is a ClassLoaderInterface in the context, use it, otherwise
@@ -370,9 +350,9 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
             */
             ClassLoaderInterface classLoaderInterface = null;
             ActionContext ctx = ActionContext.getContext();
-            if (ctx != null)
+            if (ctx != null) {
                 classLoaderInterface = (ClassLoaderInterface) ctx.get(ClassLoaderInterface.CLASS_LOADER_INTERFACE);
-
+            }
             return ObjectUtils.defaultIfNull(classLoaderInterface, new ClassLoaderInterfaceDelegate(getClassLoader()));
         }
     }
@@ -383,7 +363,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
 
     @SuppressWarnings("unchecked")
     protected Set<Class> findActions() {
-        Set<Class> classes = new HashSet<Class>();
+        Set<Class> classes = new HashSet<>();
         try {
             if (actionPackages != null || (packageLocators != null && !disablePackageLocatorsScanning)) {
 
@@ -400,8 +380,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
                 classes.addAll(finder.findClasses(test));
             }
         } catch (Exception ex) {
-            if (LOG.isErrorEnabled())
-                LOG.error("Unable to scan named packages", ex);
+            LOG.error("Unable to scan named packages", ex);
         }
 
         return classes;
@@ -418,7 +397,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
     }
 
     private List<URL> readUrls() throws IOException {
-        List<URL> resourceUrls = new ArrayList<URL>();
+        List<URL> resourceUrls = new ArrayList<>();
         // Usually the "classes" dir.
         ArrayList<URL> classesList = Collections.list(getClassLoaderInterface().getResources(""));
         for (URL url : classesList) {
@@ -437,7 +416,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
             //exclude parent of classloaders
             ClassLoaderInterface parent = classLoaderInterface.getParent();
             //if reload is enabled, we need to step up one level, otherwise the UrlSet will be empty
-            //this happens because the parent of the realoding class loader is the web app classloader
+            //this happens because the parent of the reloading class loader is the web app classloader
             if (parent != null && isReloadEnabled())
                 parent = parent.getParent();
 
@@ -450,8 +429,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
                 urlSet = urlSet.exclude(new ClassLoaderInterfaceDelegate(systemClassLoader.getParent()));
 
             } catch (SecurityException e) {
-                if (LOG.isWarnEnabled())
-                    LOG.warn("Could not get the system classloader due to security constraints, there may be improper urls left to scan");
+                LOG.warn("Could not get the system classloader due to security constraints, there may be improper urls left to scan");
             }
         }
 
@@ -469,8 +447,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
         	urlSet = urlSet.excludeJavaHome();
         } catch (NullPointerException e) {
         	// This happens in GAE since the sandbox contains no java.home directory
-            if (LOG.isWarnEnabled())
-        	    LOG.warn("Could not exclude JAVA_HOME, is this a sandbox jvm?");
+      	    LOG.warn("Could not exclude JAVA_HOME, is this a sandbox jvm?");
         }
         urlSet = urlSet.excludePaths(System.getProperty("sun.boot.class.path", ""));
         urlSet = urlSet.exclude(".*/JavaVM.framework/.*");
@@ -482,12 +459,12 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
                 LOG.debug("jar urls regexes were specified: {}", Arrays.asList(includeJars));
             }
             List<URL> rawIncludedUrls = urlSet.getUrls();
-            Set<URL> includeUrls = new HashSet<URL>();
+            Set<URL> includeUrls = new HashSet<>();
             boolean[] patternUsed = new boolean[includeJars.length];
 
             for (URL url : rawIncludedUrls) {
                 if (fileProtocols.contains(url.getProtocol())) {
-                    //it is a jar file, make sure it macthes at least a url regex
+                    //it is a jar file, make sure it matches at least a url regex
                     for (int i = 0; i < includeJars.length; i++) {
                         String includeJar = includeJars[i];
                         if (Pattern.matches(includeJar, url.toExternalForm())) {
@@ -544,7 +521,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
             WildcardHelper wildcardHelper = new WildcardHelper();
 
             //we really don't care about the results, just the boolean
-            Map<String, String> matchMap = new HashMap<String, String>();
+            Map<String, String> matchMap = new HashMap<>();
 
             for(String packageExclude : excludePackages) {
                 int[] packagePattern = wildcardHelper.compilePattern(packageExclude);
@@ -566,9 +543,9 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
         if (actionPackages != null) {
             for (String packageName : actionPackages) {
                 String strictPackageName = packageName + ".";
-                if (classPackageName.equals(packageName)
-                        || classPackageName.startsWith(strictPackageName))
+                if (classPackageName.equals(packageName) || classPackageName.startsWith(strictPackageName)) {
                     return true;
+                }
             }
         }
         return false;
@@ -587,8 +564,9 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
             for (String packageLocator : packageLocators) {
                 String[] splitted = classPackageName.split("\\.");
 
-                if (StringTools.contains(splitted, packageLocator, false))
+                if (StringTools.contains(splitted, packageLocator, false)) {
                     return true;
+                }
             }
         }
         return false;
@@ -638,7 +616,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
                 try {
                     return inPackage && (nameMatches || (checkImplementsAction && com.opensymphony.xwork2.Action.class.isAssignableFrom(classInfo.get())));
                 } catch (ClassNotFoundException ex) {
-                    LOG.error("Unable to load class [{}]", ex, classInfo.getName());
+                    LOG.error("Unable to load class [{}]", classInfo.getName(), ex);
                     return false;
                 }
             }
@@ -647,7 +625,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
 
     @SuppressWarnings("unchecked")
     protected void buildConfiguration(Set<Class> classes) {
-        Map<String, PackageConfig.Builder> packageConfigs = new HashMap<String, PackageConfig.Builder>();
+        Map<String, PackageConfig.Builder> packageConfigs = new HashMap<>();
 
         for (Class<?> actionClass : classes) {
             Actions actionsAnnotation = actionClass.getAnnotation(Actions.class);
@@ -664,16 +642,14 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
                 try {
                     objectFactory.getClassInstance(actionClass.getName());
                 } catch (ClassNotFoundException e) {
-                    LOG.error("Object Factory was unable to load class [{}]", e, actionClass.getName());
+                    LOG.error("Object Factory was unable to load class [{}]", actionClass.getName(), e);
                     throw new StrutsException("Object Factory was unable to load class " + actionClass.getName(), e);
                 }
             }
 
             // Determine the action package
             String actionPackage = actionClass.getPackage().getName();
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Processing class [{}] in package [{}]", actionClass.getName(), actionPackage);
-            }
+            LOG.debug("Processing class [{}] in package [{}]", actionClass.getName(), actionPackage);
 
             // Determine the default namespace and action name
             List<String> namespaces = determineActionNamespace(actionClass);
@@ -685,7 +661,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
                 // Verify that the annotations have no errors and also determine if the default action
                 // configuration should still be built or not.
                 Map<String, List<Action>> map = getActionAnnotations(actionClass);
-                Set<String> actionNames = new HashSet<String>();
+                Set<String> actionNames = new HashSet<>();
                 boolean hasDefaultMethod = ReflectionTools.containsMethod(actionClass, DEFAULT_METHOD);
                 if (!map.containsKey(DEFAULT_METHOD)
                         && hasDefaultMethod
@@ -781,7 +757,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
      * @return The namespace or an empty string.
      */
     protected List<String> determineActionNamespace(Class<?> actionClass) {
-        List<String> namespaces = new ArrayList<String>();
+        List<String> namespaces = new ArrayList<>();
 
         // Check if there is a class or package level annotation for the namespace
         //single namespace
@@ -803,8 +779,9 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
                 LOG.trace("Using non-default action namespaces from Namespaces annotation of [{}]", sb.toString());
             }
 
-            for (Namespace namespace : namespacesAnnotation.value())
+            for (Namespace namespace : namespacesAnnotation.value()) {
                 namespaces.add(namespace.value());
+            }
         }
 
         //don't use default if there are annotations
@@ -869,7 +846,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
      */
     protected Map<String, List<Action>> getActionAnnotations(Class<?> actionClass) {
         Method[] methods = actionClass.getMethods();
-        Map<String, List<Action>> map = new HashMap<String, List<Action>>();
+        Map<String, List<Action>> map = new HashMap<>();
         for (Method method : methods) {
             Actions actionsAnnotation = method.getAnnotation(Actions.class);
             if (actionsAnnotation != null) {
@@ -894,13 +871,12 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
     protected List<Action> checkActionsAnnotation(Actions actionsAnnotation) {
         Action[] actionArray = actionsAnnotation.value();
         boolean valuelessSeen = false;
-        List<Action> actions = new ArrayList<Action>();
+        List<Action> actions = new ArrayList<>();
         for (Action ann : actionArray) {
             if (ann.value().equals(Action.DEFAULT_VALUE) && !valuelessSeen) {
                 valuelessSeen = true;
             } else if (ann.value().equals(Action.DEFAULT_VALUE)) {
-                throw new ConfigurationException("You may only add a single Action " +
-                        "annotation that has no value parameter.");
+                throw new ConfigurationException("You may only add a single Action annotation that has no value parameter.");
             }
 
             actions.add(ann);
@@ -980,7 +956,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
     }
 
     protected List<ExceptionMappingConfig> buildExceptionMappings(ExceptionMapping[] exceptions, String actionName) {
-        List<ExceptionMappingConfig> exceptionMappings = new ArrayList<ExceptionMappingConfig>();
+        List<ExceptionMappingConfig> exceptionMappings = new ArrayList<>();
 
         for (ExceptionMapping exceptionMapping : exceptions) {
             LOG.trace("Mapping exception [{}] to result [{}] for action [{}]", exceptionMapping.exception(),
@@ -1062,7 +1038,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
      * @param packageConfigs Used to store the actions.
      */
     protected void buildIndexActions(Map<String, PackageConfig.Builder> packageConfigs) {
-        Map<String, PackageConfig.Builder> byNamespace = new HashMap<String, PackageConfig.Builder>();
+        Map<String, PackageConfig.Builder> byNamespace = new HashMap<>();
         Collection<PackageConfig.Builder> values = packageConfigs.values();
         for (PackageConfig.Builder packageConfig : values) {
             byNamespace.put(packageConfig.getNamespace(), packageConfig);
@@ -1095,18 +1071,15 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
                         if (parent.build().getAllActionConfigs().get(parentAction) == null) {
                             parent.addActionConfig(parentAction, indexActionConfig);
                         }
-                    } else if (LOG.isTraceEnabled()) {
-                        LOG.trace("The parent namespace [{}] already contains " +
-                                "an action [{}]", parentNamespace, parentAction);
+                    } else {
+                        LOG.trace("The parent namespace [{}] already contains an action [{}]", parentNamespace, parentAction);
                     }
                 }
             }
 
             // Step #3
             if (pkgConfig.build().getAllActionConfigs().get("") == null) {
-                LOG.trace("Creating index ActionConfig with an action name of [] for the action " +
-                            "class [{}]", indexActionConfig.getClassName());
-
+                LOG.trace("Creating index ActionConfig with an action name of [] for the action class [{}]", indexActionConfig.getClassName());
                 pkgConfig.addActionConfig("", indexActionConfig);
             }
         }
@@ -1120,15 +1093,15 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
         if (devMode && reload) {
             for (String url : loadedFileUrls) {
                 if (fileManager.fileNeedsReloading(url)) {
-                    if (LOG.isDebugEnabled())
-                        LOG.debug("File [{}] changed, configuration will be reloaded", url);
+                    LOG.debug("File [{}] changed, configuration will be reloaded", url);
                     return true;
                 }
             }
 
             return false;
-        } else
+        } else {
             return false;
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/convention/src/main/java/org/apache/struts2/convention/ReflectionTools.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/ReflectionTools.java b/plugins/convention/src/main/java/org/apache/struts2/convention/ReflectionTools.java
index 1128635..7140fe9 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/ReflectionTools.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/ReflectionTools.java
@@ -22,8 +22,8 @@ package org.apache.struts2.convention;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * <p>
@@ -34,14 +34,14 @@ public class ReflectionTools {
     /**
      * Determines if the class given contains the method.
      *
-     * @param   klass The class to check for the method.
+     * @param   clazz The class to check for the method.
      * @param   method The method name.
      * @param   parameterTypes The parameter types of the method.
      * @return  True if the method exists, false if not.
      */
-    public static boolean containsMethod(Class<?> klass, String method, Class<?>... parameterTypes) {
+    public static boolean containsMethod(Class<?> clazz, String method, Class<?>... parameterTypes) {
         try {
-            klass.getMethod(method, parameterTypes);
+            clazz.getMethod(method, parameterTypes);
             return true;
         } catch (NoSuchMethodException e) {
             return false;
@@ -51,14 +51,14 @@ public class ReflectionTools {
     /**
      * Retrieves the annotation from the given method in the given class.
      *
-     * @param   klass The class.
+     * @param   clazz The class.
      * @param   methodName The method.
      * @param   annotationClass The annotation to get.
      * @return  The annotation or null if it doesn't exist.
      */
-    public static <T extends Annotation> T getAnnotation(Class<?> klass, String methodName, Class<T> annotationClass) {
+    public static <T extends Annotation> T getAnnotation(Class<?> clazz, String methodName, Class<T> annotationClass) {
         try {
-            Method method = klass.getMethod(methodName);
+            Method method = clazz.getMethod(methodName);
             return method.getAnnotation(annotationClass);
         } catch (NoSuchMethodException e) {
             throw new RuntimeException(e);
@@ -71,7 +71,7 @@ public class ReflectionTools {
      * @return hierarchy of classes
      */
     public static List<Class<?>> getClassHierarchy(Class<?> clazz) {
-        List<Class<?>> classes = new ArrayList<Class<?>>();
+        List<Class<?>> classes = new ArrayList<>();
         while (clazz != null) {
             classes.add(0, clazz);
             clazz = clazz.getSuperclass();

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/convention/src/main/java/org/apache/struts2/convention/StringTools.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/StringTools.java b/plugins/convention/src/main/java/org/apache/struts2/convention/StringTools.java
index 651575a..dbe53bb 100644
--- a/plugins/convention/src/main/java/org/apache/struts2/convention/StringTools.java
+++ b/plugins/convention/src/main/java/org/apache/struts2/convention/StringTools.java
@@ -42,9 +42,9 @@ public class StringTools {
         return false;
     }
 
-    public static Map<String, String> createParameterMap(String[] parms) {
-        Map<String, String> map = new HashMap<String, String>();
-        int subtract = parms.length % 2;
+    public static Map<String, String> createParameterMap(String[] params) {
+        Map<String, String> map = new HashMap<>();
+        int subtract = params.length % 2;
         if (subtract != 0) {
             throw new ConfigurationException(
                     "'params' is a string array "
@@ -53,9 +53,9 @@ public class StringTools {
                             + " (e.g. params = {\"key\", \"value\"})");
         }
 
-        for (int i = 0; i < parms.length; i = i + 2) {
-            String key = parms[i];
-            String value = parms[i + 1];
+        for (int i = 0; i < params.length; i = i + 2) {
+            String key = params[i];
+            String value = params[i + 1];
             map.put(key, value);
         }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/convention/src/test/java/org/apache/struts2/convention/ConventionUnknownHandlerTest.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/test/java/org/apache/struts2/convention/ConventionUnknownHandlerTest.java b/plugins/convention/src/test/java/org/apache/struts2/convention/ConventionUnknownHandlerTest.java
index e3a51c8..10733af 100644
--- a/plugins/convention/src/test/java/org/apache/struts2/convention/ConventionUnknownHandlerTest.java
+++ b/plugins/convention/src/test/java/org/apache/struts2/convention/ConventionUnknownHandlerTest.java
@@ -38,11 +38,7 @@ import java.util.Map;
 import java.util.Set;
 
 import static org.easymock.EasyMock.expect;
-import static org.easymock.classextension.EasyMock.createMock;
-import static org.easymock.classextension.EasyMock.createNiceMock;
-import static org.easymock.classextension.EasyMock.createStrictMock;
-import static org.easymock.classextension.EasyMock.replay;
-import static org.easymock.classextension.EasyMock.verify;
+import static org.easymock.classextension.EasyMock.*;
 
 public class ConventionUnknownHandlerTest extends TestCase {
 
@@ -161,7 +157,7 @@ public class ConventionUnknownHandlerTest extends TestCase {
 
         ActionConfig actionConfig = null;
         expect(service.determineResultPath(actionConfig)).andReturn("");
-        Map<String, ResultTypeConfig> results = new HashMap<String, ResultTypeConfig>();
+        Map<String, ResultTypeConfig> results = new HashMap<>();
         results.put("jsp", new ResultTypeConfig.Builder("dispatcher", ServletDispatcherResult.class.getName()).build());
         expect(service.getResultTypesByExtension(packageConfiguration)).andReturn(results);
 

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java b/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java
index de7ab16..502b202 100644
--- a/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java
+++ b/plugins/convention/src/test/java/org/apache/struts2/convention/DefaultResultMapBuilderTest.java
@@ -26,16 +26,7 @@ import com.opensymphony.xwork2.config.entities.ResultTypeConfig;
 import com.opensymphony.xwork2.inject.Container;
 import junit.framework.TestCase;
 import org.apache.struts2.convention.actions.NoAnnotationAction;
-import org.apache.struts2.convention.actions.result.ActionLevelResultAction;
-import org.apache.struts2.convention.actions.result.ActionLevelResultsAction;
-import org.apache.struts2.convention.actions.result.ClassLevelResultAction;
-import org.apache.struts2.convention.actions.result.ClassLevelResultsAction;
-import org.apache.struts2.convention.actions.result.GlobalResultAction;
-import org.apache.struts2.convention.actions.result.GlobalResultOverrideAction;
-import org.apache.struts2.convention.actions.result.InheritedResultExtends;
-import org.apache.struts2.convention.actions.result.InheritedResultsExtends;
-import org.apache.struts2.convention.actions.result.OverrideInheritedResultExtends;
-import org.apache.struts2.convention.actions.result.OverrideResultAction;
+import org.apache.struts2.convention.actions.result.*;
 import org.apache.struts2.convention.actions.resultpath.ClassLevelResultPathAction;
 import org.apache.struts2.convention.annotation.Action;
 import org.apache.struts2.dispatcher.ServletDispatcherResult;
@@ -121,7 +112,7 @@ public class DefaultResultMapBuilderTest extends TestCase {
         ServletContext context = EasyMock.createStrictMock(ServletContext.class);
         String resultPath = "/WEB-INF/location";
         // Setup some mock jsps
-        Set<String> resources = new HashSet<String>();
+        Set<String> resources = new HashSet<>();
         resources.add(resultPath + "/namespace/action.jsp");
         resources.add(resultPath + "/namespace/action-success.jsp");
         resources.add(resultPath + "/namespace/action-error.jsp");
@@ -179,7 +170,7 @@ public class DefaultResultMapBuilderTest extends TestCase {
         ServletContext context = EasyMock.createStrictMock(ServletContext.class);
 
         // Setup some mock jsps
-        Set<String> resources = new HashSet<String>();
+        Set<String> resources = new HashSet<>();
         resources.add("/WEB-INF/location/namespace/.something");
         resources.add("/WEB-INF/location/namespace/.somethingelse/");
         EasyMock.expect(context.getResourcePaths("/WEB-INF/location/namespace/")).andReturn(resources);
@@ -199,7 +190,7 @@ public class DefaultResultMapBuilderTest extends TestCase {
         ServletContext context = EasyMock.createStrictMock(ServletContext.class);
 
         // Setup some mock jsps
-        Set<String> resources = new HashSet<String>();
+        Set<String> resources = new HashSet<>();
         resources.add("/WEB-INF/location/namespace/no-annotation.ftl");
         resources.add("/WEB-INF/location/namespace/no-annotation-success.jsp");
         resources.add("/WEB-INF/location/namespace/no-annotation-failure.jsp");
@@ -233,7 +224,7 @@ public class DefaultResultMapBuilderTest extends TestCase {
         ServletContext context = EasyMock.createStrictMock(ServletContext.class);
 
         // Setup some mock jsps
-        Set<String> resources = new HashSet<String>();
+        Set<String> resources = new HashSet<>();
         resources.add("/WEB-INF/location/namespace/no-annotation/index.ftl");
         resources.add("/WEB-INF/location/namespace/no-annotation/success.jsp");
         resources.add("/WEB-INF/location/namespace/no-annotation/failure.jsp");
@@ -269,7 +260,7 @@ public class DefaultResultMapBuilderTest extends TestCase {
         ServletContext context = EasyMock.createStrictMock(ServletContext.class);
 
         // Setup some mock jsps
-        Set<String> resources = new HashSet<String>();
+        Set<String> resources = new HashSet<>();
         resources.add("/WEB-INF/location/namespace/no-annotation/.svn");
         resources.add("/WEB-INF/location/namespace/no-annotation-success.jsp");
         EasyMock.expect(context.getResourcePaths("/WEB-INF/location/namespace/")).andReturn(resources);
@@ -293,7 +284,7 @@ public class DefaultResultMapBuilderTest extends TestCase {
         ServletContext context = EasyMock.createStrictMock(ServletContext.class);
 
         // Setup some mock jsps
-        Set<String> resources = new HashSet<String>();
+        Set<String> resources = new HashSet<>();
         EasyMock.expect(context.getResourcePaths("/WEB-INF/location/namespace/")).andReturn(resources);
         EasyMock.replay(context);
 
@@ -316,7 +307,7 @@ public class DefaultResultMapBuilderTest extends TestCase {
         ServletContext context = EasyMock.createStrictMock(ServletContext.class);
 
         // Setup some mock jsps
-        Set<String> resources = new HashSet<String>();
+        Set<String> resources = new HashSet<>();
         EasyMock.expect(context.getResourcePaths("/WEB-INF/location/namespace/")).andReturn(resources);
         EasyMock.replay(context);
 
@@ -339,7 +330,7 @@ public class DefaultResultMapBuilderTest extends TestCase {
         ServletContext context = EasyMock.createStrictMock(ServletContext.class);
 
         // Setup some mock jsps
-        Set<String> resources = new HashSet<String>();
+        Set<String> resources = new HashSet<>();
         EasyMock.expect(context.getResourcePaths("/WEB-INF/location/namespace/")).andReturn(resources);
         EasyMock.replay(context);
 
@@ -364,7 +355,7 @@ public class DefaultResultMapBuilderTest extends TestCase {
         ServletContext context = EasyMock.createStrictMock(ServletContext.class);
 
         // Setup some mock jsps
-        Set<String> resources = new HashSet<String>();
+        Set<String> resources = new HashSet<>();
         EasyMock.expect(context.getResourcePaths("/WEB-INF/location/namespace/")).andReturn(resources);
         EasyMock.replay(context);
 
@@ -403,7 +394,7 @@ public class DefaultResultMapBuilderTest extends TestCase {
         ServletContext context = EasyMock.createStrictMock(ServletContext.class);
 
         // Setup some mock jsps
-        Set<String> resources = new HashSet<String>();
+        Set<String> resources = new HashSet<>();
         EasyMock.expect(context.getResourcePaths("/WEB-INF/location/namespace/")).andReturn(resources);
         EasyMock.replay(context);
 
@@ -442,7 +433,7 @@ public class DefaultResultMapBuilderTest extends TestCase {
         ServletContext context = EasyMock.createStrictMock(ServletContext.class);
 
         // Setup some mock jsps
-        Set<String> resources = new HashSet<String>();
+        Set<String> resources = new HashSet<>();
         EasyMock.expect(context.getResourcePaths("/WEB-INF/location/namespace/")).andReturn(resources);
         EasyMock.replay(context);
 
@@ -465,7 +456,7 @@ public class DefaultResultMapBuilderTest extends TestCase {
         ServletContext context = EasyMock.createStrictMock(ServletContext.class);
 
         // Setup some mock jsps
-        Set<String> resources = new HashSet<String>();
+        Set<String> resources = new HashSet<>();
         EasyMock.expect(context.getResourcePaths("/WEB-INF/location/namespace/")).andReturn(resources);
         EasyMock.replay(context);
 
@@ -544,7 +535,7 @@ public class DefaultResultMapBuilderTest extends TestCase {
         ServletContext context = EasyMock.createStrictMock(ServletContext.class);
 
         // Setup some mock jsps
-        Set<String> resources = new HashSet<String>();
+        Set<String> resources = new HashSet<>();
         resources.add(resultPath + "/namespace/action.jsp");
         resources.add(resultPath + "/namespace/action-success.jsp");
         resources.add(resultPath + "/namespace/action-failure.jsp");

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java
----------------------------------------------------------------------
diff --git a/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java b/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java
index 76d232e..7fbd420 100644
--- a/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java
+++ b/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java
@@ -20,21 +20,9 @@
  */
 package org.apache.struts2.convention;
 
-import com.opensymphony.xwork2.ActionChainResult;
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.FileManager;
-import com.opensymphony.xwork2.FileManagerFactory;
-import com.opensymphony.xwork2.ObjectFactory;
-import com.opensymphony.xwork2.Result;
+import com.opensymphony.xwork2.*;
 import com.opensymphony.xwork2.config.Configuration;
-import com.opensymphony.xwork2.config.entities.ActionConfig;
-import com.opensymphony.xwork2.config.entities.ExceptionMappingConfig;
-import com.opensymphony.xwork2.config.entities.InterceptorConfig;
-import com.opensymphony.xwork2.config.entities.InterceptorMapping;
-import com.opensymphony.xwork2.config.entities.InterceptorStackConfig;
-import com.opensymphony.xwork2.config.entities.PackageConfig;
-import com.opensymphony.xwork2.config.entities.ResultConfig;
-import com.opensymphony.xwork2.config.entities.ResultTypeConfig;
+import com.opensymphony.xwork2.config.entities.*;
 import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
 import com.opensymphony.xwork2.factory.DefaultInterceptorFactory;
 import com.opensymphony.xwork2.factory.DefaultResultFactory;
@@ -48,16 +36,7 @@ import junit.framework.TestCase;
 import org.apache.struts2.convention.actions.DefaultResultPathAction;
 import org.apache.struts2.convention.actions.NoAnnotationAction;
 import org.apache.struts2.convention.actions.Skip;
-import org.apache.struts2.convention.actions.action.ActionNameAction;
-import org.apache.struts2.convention.actions.action.ActionNamesAction;
-import org.apache.struts2.convention.actions.action.ClassLevelAnnotationAction;
-import org.apache.struts2.convention.actions.action.ClassLevelAnnotationDefaultMethodAction;
-import org.apache.struts2.convention.actions.action.ClassLevelAnnotationsAction;
-import org.apache.struts2.convention.actions.action.ClassLevelAnnotationsDefaultMethodAction;
-import org.apache.struts2.convention.actions.action.ClassNameAction;
-import org.apache.struts2.convention.actions.action.SingleActionNameAction;
-import org.apache.struts2.convention.actions.action.TestAction;
-import org.apache.struts2.convention.actions.action.TestExtends;
+import org.apache.struts2.convention.actions.action.*;
 import org.apache.struts2.convention.actions.chain.ChainedAction;
 import org.apache.struts2.convention.actions.defaultinterceptor.SingleActionNameAction2;
 import org.apache.struts2.convention.actions.exception.ExceptionsActionLevelAction;
@@ -78,14 +57,7 @@ import org.apache.struts2.convention.actions.parentpackage.ClassLevelParentPacka
 import org.apache.struts2.convention.actions.parentpackage.PackageLevelParentPackageAction;
 import org.apache.struts2.convention.actions.parentpackage.sub.ClassLevelParentPackageChildAction;
 import org.apache.struts2.convention.actions.parentpackage.sub.PackageLevelParentPackageChildAction;
-import org.apache.struts2.convention.actions.result.ActionLevelResultAction;
-import org.apache.struts2.convention.actions.result.ActionLevelResultsAction;
-import org.apache.struts2.convention.actions.result.ClassLevelResultAction;
-import org.apache.struts2.convention.actions.result.ClassLevelResultsAction;
-import org.apache.struts2.convention.actions.result.GlobalResultAction;
-import org.apache.struts2.convention.actions.result.GlobalResultOverrideAction;
-import org.apache.struts2.convention.actions.result.InheritedResultExtends;
-import org.apache.struts2.convention.actions.result.OverrideResultAction;
+import org.apache.struts2.convention.actions.result.*;
 import org.apache.struts2.convention.actions.resultpath.ClassLevelResultPathAction;
 import org.apache.struts2.convention.actions.resultpath.PackageLevelResultPathAction;
 import org.apache.struts2.convention.actions.skip.Index;
@@ -98,18 +70,10 @@ import org.easymock.EasyMock;
 
 import javax.servlet.ServletContext;
 import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 import static org.apache.struts2.convention.ReflectionTools.getAnnotation;
-import static org.easymock.EasyMock.checkOrder;
-import static org.easymock.EasyMock.createStrictMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.verify;
+import static org.easymock.EasyMock.*;
 
 /**
  * <p>
@@ -144,13 +108,13 @@ public class PackageBasedActionConfigBuilderTest extends TestCase {
 
     private void run(String actionPackages, String packageLocators, String excludePackages) throws MalformedURLException {
         //setup interceptors
-        List<InterceptorConfig> defaultInterceptors = new ArrayList<InterceptorConfig>();
+        List<InterceptorConfig> defaultInterceptors = new ArrayList<>();
         defaultInterceptors.add(makeInterceptorConfig("interceptor-1"));
         defaultInterceptors.add(makeInterceptorConfig("interceptor-2"));
         defaultInterceptors.add(makeInterceptorConfig("interceptor-3"));
 
         //setup interceptor stacks
-        List<InterceptorStackConfig> defaultInterceptorStacks = new ArrayList<InterceptorStackConfig>();
+        List<InterceptorStackConfig> defaultInterceptorStacks = new ArrayList<>();
         InterceptorMapping interceptor1 = new InterceptorMapping("interceptor-1", new TestInterceptor());
         InterceptorMapping interceptor2 = new InterceptorMapping("interceptor-2", new TestInterceptor());
         defaultInterceptorStacks.add(makeInterceptorStackConfig("stack-1", interceptor1, interceptor2));
@@ -224,7 +188,7 @@ public class PackageBasedActionConfigBuilderTest extends TestCase {
 
         ResultMapBuilder resultMapBuilder = createStrictMock(ResultMapBuilder.class);
         checkOrder(resultMapBuilder, false);
-        Map<String, ResultConfig> results = new HashMap<String, ResultConfig>();
+        Map<String, ResultConfig> results = new HashMap<>();
 
         /* org.apache.struts2.convention.actions.action */
         expect(resultMapBuilder.build(ActionNameAction.class, getAnnotation(ActionNameAction.class, "run1", Action.class), "action1", actionPkg)).andReturn(results);

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportsResult.java
----------------------------------------------------------------------
diff --git a/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportsResult.java b/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportsResult.java
index f5794f8..d113a39 100644
--- a/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportsResult.java
+++ b/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/JasperReportsResult.java
@@ -23,25 +23,12 @@ package org.apache.struts2.views.jasperreports;
 
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
-import net.sf.jasperreports.engine.JRException;
-import net.sf.jasperreports.engine.JRExporter;
-import net.sf.jasperreports.engine.JRExporterParameter;
-import net.sf.jasperreports.engine.JRParameter;
-import net.sf.jasperreports.engine.JasperFillManager;
-import net.sf.jasperreports.engine.JasperPrint;
-import net.sf.jasperreports.engine.JasperReport;
-import net.sf.jasperreports.engine.export.JRCsvExporter;
-import net.sf.jasperreports.engine.export.JRCsvExporterParameter;
-import net.sf.jasperreports.engine.export.JRHtmlExporter;
-import net.sf.jasperreports.engine.export.JRHtmlExporterParameter;
-import net.sf.jasperreports.engine.export.JRPdfExporter;
-import net.sf.jasperreports.engine.export.JRRtfExporter;
-import net.sf.jasperreports.engine.export.JRXlsExporter;
-import net.sf.jasperreports.engine.export.JRXmlExporter;
+import net.sf.jasperreports.engine.*;
+import net.sf.jasperreports.engine.export.*;
 import net.sf.jasperreports.engine.util.JRLoader;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.dispatcher.StrutsResultSupport;
 
@@ -249,9 +236,7 @@ public class JasperReportsResult extends StrutsResultSupport implements JasperRe
         // Will throw a runtime exception if no "datasource" property. TODO Best place for that is...?
         initializeProperties(invocation);
 
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Creating JasperReport for dataSource = " + dataSource + ", format = " + format);
-        }
+        LOG.debug("Creating JasperReport for dataSource = {}, format = {}", dataSource, format);
 
         HttpServletRequest request = (HttpServletRequest) invocation.getInvocationContext().get(ServletActionContext.HTTP_REQUEST);
         HttpServletResponse response = (HttpServletResponse) invocation.getInvocationContext().get(ServletActionContext.HTTP_RESPONSE);
@@ -311,9 +296,7 @@ public class JasperReportsResult extends StrutsResultSupport implements JasperRe
         // Add any report parameters from action to param map.
         Map reportParams = (Map) stack.findValue(reportParameters);
         if (reportParams != null) {
-            if (LOG.isDebugEnabled()) {
         	LOG.debug("Found report parameters; adding to parameters...");
-            }
             parameters.putAll(reportParams);
         }
 
@@ -323,12 +306,14 @@ public class JasperReportsResult extends StrutsResultSupport implements JasperRe
         // Fill the report and produce a print object
         try {
             JasperReport jasperReport = (JasperReport) JRLoader.loadObject(systemId);
-            if (conn == null)
+            if (conn == null) {
                 jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, stackDataSource);
-            else
+            }
+            else {
                 jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn);
+            }
         } catch (JRException e) {
-            LOG.error("Error building report for uri " + systemId, e);
+            LOG.error("Error building report for uri {}", systemId, e);
             throw new ServletException(e.getMessage(), e);
         }
 
@@ -386,16 +371,13 @@ public class JasperReportsResult extends StrutsResultSupport implements JasperRe
 
             Map exportParams = (Map) stack.findValue(exportParameters);
             if (exportParams != null) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Found export parameters; adding to exporter parameters...");
-                }
+                LOG.debug("Found export parameters; adding to exporter parameters...");
                 exporter.getParameters().putAll(exportParams);
             }
 
             output = exportReportToBytes(jasperPrint, exporter);
         } catch (JRException e) {
-            String message = "Error producing " + format + " report for uri " + systemId;
-            LOG.error(message, e);
+            LOG.error("Error producing {} report for uri {}", format, systemId, e);
             throw new ServletException(e.getMessage(), e);
         }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/ValueStackShadowMap.java
----------------------------------------------------------------------
diff --git a/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/ValueStackShadowMap.java b/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/ValueStackShadowMap.java
index 204f6a6..fa9c35f 100644
--- a/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/ValueStackShadowMap.java
+++ b/plugins/jasperreports/src/main/java/org/apache/struts2/views/jasperreports/ValueStackShadowMap.java
@@ -60,7 +60,7 @@ public class ValueStackShadowMap extends HashMap {
      * Implementation of containsKey(), overriding HashMap implementation.
      *
      * @param key - The key to check in HashMap and if not found to check on valueStack.
-     * @return <tt>true</tt>, if conatins key, <tt>false</tt> otherwise.
+     * @return <tt>true</tt>, if contains key, <tt>false</tt> otherwise.
      * @see java.util.HashMap#containsKey
      */
     public boolean containsKey(Object key) {

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/junit/src/main/java/org/apache/struts2/StrutsJUnit4TestCase.java
----------------------------------------------------------------------
diff --git a/plugins/junit/src/main/java/org/apache/struts2/StrutsJUnit4TestCase.java b/plugins/junit/src/main/java/org/apache/struts2/StrutsJUnit4TestCase.java
index 46d2e99..026a4f0 100644
--- a/plugins/junit/src/main/java/org/apache/struts2/StrutsJUnit4TestCase.java
+++ b/plugins/junit/src/main/java/org/apache/struts2/StrutsJUnit4TestCase.java
@@ -21,16 +21,11 @@
 
 package org.apache.struts2;
 
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionProxy;
-import com.opensymphony.xwork2.ActionProxyFactory;
-import com.opensymphony.xwork2.ValidationAware;
-import com.opensymphony.xwork2.XWorkJUnit4TestCase;
+import com.opensymphony.xwork2.*;
 import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.interceptor.annotations.After;
 import com.opensymphony.xwork2.interceptor.annotations.Before;
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
-import org.apache.logging.log4j.LogManager;
 import com.opensymphony.xwork2.util.logging.jdk.JdkLoggerFactory;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.struts2.dispatcher.Dispatcher;
@@ -53,11 +48,7 @@ import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Formatter;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
+import java.util.logging.*;
 
 import static org.junit.Assert.assertNotNull;
 
@@ -242,7 +233,7 @@ public abstract class StrutsJUnit4TestCase<T> extends XWorkJUnit4TestCase {
 
     protected void initDispatcherParams() {
         if (StringUtils.isNotBlank(getConfigPath())) {
-            dispatcherInitParams = new HashMap<String, String>();
+            dispatcherInitParams = new HashMap<>();
             dispatcherInitParams.put("config", "struts-default.xml," + getConfigPath());
         }
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/rest/src/main/java/org/apache/struts2/rest/DefaultContentTypeHandlerManager.java
----------------------------------------------------------------------
diff --git a/plugins/rest/src/main/java/org/apache/struts2/rest/DefaultContentTypeHandlerManager.java b/plugins/rest/src/main/java/org/apache/struts2/rest/DefaultContentTypeHandlerManager.java
index b1bcffc..2e3201a 100644
--- a/plugins/rest/src/main/java/org/apache/struts2/rest/DefaultContentTypeHandlerManager.java
+++ b/plugins/rest/src/main/java/org/apache/struts2/rest/DefaultContentTypeHandlerManager.java
@@ -42,9 +42,9 @@ import java.util.Set;
 public class DefaultContentTypeHandlerManager implements ContentTypeHandlerManager {
 
     /** ContentTypeHandlers keyed by the extension */
-    Map<String,ContentTypeHandler> handlersByExtension = new HashMap<String,ContentTypeHandler>();
+    Map<String,ContentTypeHandler> handlersByExtension = new HashMap<>();
     /** ContentTypeHandlers keyed by the content-type */
-    Map<String,ContentTypeHandler> handlersByContentType = new HashMap<String,ContentTypeHandler>();
+    Map<String,ContentTypeHandler> handlersByContentType = new HashMap<>();
 
     private String defaultExtension;
 

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/rest/src/main/java/org/apache/struts2/rest/HttpHeaders.java
----------------------------------------------------------------------
diff --git a/plugins/rest/src/main/java/org/apache/struts2/rest/HttpHeaders.java b/plugins/rest/src/main/java/org/apache/struts2/rest/HttpHeaders.java
index 83a928c..4541676 100644
--- a/plugins/rest/src/main/java/org/apache/struts2/rest/HttpHeaders.java
+++ b/plugins/rest/src/main/java/org/apache/struts2/rest/HttpHeaders.java
@@ -25,7 +25,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 /**
- * Type-safe rest-related informtion to apply to a response
+ * Type-safe rest-related information to apply to a response
  */
 public interface HttpHeaders {
 

http://git-wip-us.apache.org/repos/asf/struts/blob/5a835cf6/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionInvocation.java
----------------------------------------------------------------------
diff --git a/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionInvocation.java b/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionInvocation.java
index 6574cbe..06f52a8 100644
--- a/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionInvocation.java
+++ b/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionInvocation.java
@@ -21,19 +21,15 @@
 
 package org.apache.struts2.rest;
 
-import com.opensymphony.xwork2.Action;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.DefaultActionInvocation;
-import com.opensymphony.xwork2.ModelDriven;
-import com.opensymphony.xwork2.Result;
-import com.opensymphony.xwork2.ValidationAware;
+import com.opensymphony.xwork2.*;
 import com.opensymphony.xwork2.config.ConfigurationException;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.config.entities.ResultConfig;
 import com.opensymphony.xwork2.inject.Inject;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
 import com.opensymphony.xwork2.util.profiling.UtilTimerStack;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.dispatcher.HttpHeaderResult;
 import org.apache.struts2.rest.handler.ContentTypeHandler;
@@ -71,29 +67,29 @@ public class RestActionInvocation extends DefaultActionInvocation {
     }
 
     @Inject("struts.rest.logger")
-    public void setLogger(String value) {
-        logger = Boolean.valueOf(value);
+    public void setLogger(String logger) {
+        this.logger = BooleanUtils.toBoolean(logger);
     }
 
     @Inject("struts.rest.defaultErrorResultName")
-    public void setDefaultErrorResultName(String value) {
-        defaultErrorResultName = value;
+    public void setDefaultErrorResultName(String defaultErrorResultName) {
+        this.defaultErrorResultName = defaultErrorResultName;
     }
 
     /**
      * If set to true (by default) blocks returning content from any other methods than GET,
      * if set to false, the content can be returned for any kind of method
      * 
-     * @param value true or false
+     * @param restrictToGet true or false
      */
     @Inject(value = "struts.rest.content.restrictToGET", required = false)
-    public void setRestrictToGet(String value) {
-        restrictToGet = "true".equalsIgnoreCase(value);
+    public void setRestrictToGet(String restrictToGet) {
+        this.restrictToGet = BooleanUtils.toBoolean(restrictToGet);
     }
 
     @Inject
-    public void setMimeTypeHandlerSelector(ContentTypeHandlerManager sel) {
-        this.handlerSelector = sel;
+    public void setMimeTypeHandlerSelector(ContentTypeHandlerManager selector) {
+        this.handlerSelector = selector;
     }
 
     /**
@@ -149,7 +145,7 @@ public class RestActionInvocation extends DefaultActionInvocation {
 
             } catch (Exception e) {
 
-                // Error proccesing the result
+                // Error processing the result
                 LOG.error("Exception processing the result.", e);
 
                 if (!ServletActionContext.getResponse().isCommitted()) {
@@ -196,9 +192,7 @@ public class RestActionInvocation extends DefaultActionInvocation {
             if (httpHeaders.getStatus() != HttpServletResponse.SC_NOT_MODIFIED ) {
                 executeResult();
             } else {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Result not processed because the status code is not modified.");
-                }
+                LOG.debug("Result not processed because the status code is not modified.");
             }
 
         } finally {
@@ -229,20 +223,15 @@ public class RestActionInvocation extends DefaultActionInvocation {
         if (handler != null && !(handler instanceof HtmlHandler)) {
 
             // Specific representation (json, xml...)
-            resultCode = handlerSelector.handleResult(
-                    this.getProxy().getConfig(), httpHeaders, target);
-
+            resultCode = handlerSelector.handleResult(this.getProxy().getConfig(), httpHeaders, target);
         } else {
-
             // Normal struts execution (html o other struts result)
             findResult();
             if (result != null) {
                 this.result.execute(this);
-
             } else {
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug("No result returned for action " + getAction().getClass().getName()
-                            + " at " + proxy.getConfig().getLocation());
+                    LOG.debug("No result returned for action {} at {}", getAction().getClass().getName(), proxy.getConfig().getLocation());
                 }
             }
         }
@@ -289,9 +278,7 @@ public class RestActionInvocation extends DefaultActionInvocation {
             ResultConfig resultConfig = this.proxy.getConfig().getResults().get(defaultErrorResultName);
             if (resultConfig != null) {
                 this.result = objectFactory.buildResult(resultConfig, invocationContext.getContextMap());
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Found default error result.");
-                }
+                LOG.debug("Found default error result.");
             }
         }
 


Mime
View raw message