struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject [3/5] struts git commit: Minor code improvements's in the struts core module
Date Mon, 08 Jun 2015 17:27:21 GMT
http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java
index 12aad31..e65973f 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java
@@ -3,31 +3,19 @@ package org.apache.struts2.dispatcher.multipart;
 import com.opensymphony.xwork2.LocaleProvider;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
 import org.apache.commons.fileupload.FileItemIterator;
 import org.apache.commons.fileupload.FileItemStream;
 import org.apache.commons.fileupload.FileUploadBase;
 import org.apache.commons.fileupload.FileUploadBase.FileSizeLimitExceededException;
 import org.apache.commons.fileupload.servlet.ServletFileUpload;
 import org.apache.commons.fileupload.util.Streams;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.StrutsConstants;
 
 import javax.servlet.http.HttpServletRequest;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
+import java.io.*;
+import java.util.*;
 
 /**
  * Multi-part form data request adapter for Jakarta Commons FileUpload package that
@@ -50,22 +38,22 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
     /**
      * Map between file fields and file data.
      */
-    private Map<String, List<FileInfo>> fileInfos = new HashMap<String, List<FileInfo>>();
+    private Map<String, List<FileInfo>> fileInfos = new HashMap<>();
 
     /**
      * Map between non-file fields and values.
      */
-    private Map<String, List<String>> parameters = new HashMap<String, List<String>>();
+    private Map<String, List<String>> parameters = new HashMap<>();
 
     /**
      * Internal list of raised errors to be passed to the the Struts2 framework.
      */
-    private List<String> errors = new ArrayList<String>();
+    private List<String> errors = new ArrayList<>();
 
     /**
      * Internal list of non-critical messages to be passed to the Struts2 framework.
      */
-    private List<String> messages = new ArrayList<String>();
+    private List<String> messages = new ArrayList<>();
 
     /**
      * Specifies the maximum size of the entire request.
@@ -121,8 +109,9 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
             for (FileInfo fileInfo : fileInfos.get(fieldName)) {
                 File file = fileInfo.getFile();
                 LOG.debug("Deleting file '{}'.", file.getName());
-                if (!file.delete())
+                if (!file.delete()) {
                     LOG.warn("There was a problem attempting to delete file '{}'.", file.getName());
+                }
             }
         }
     }
@@ -132,12 +121,14 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
      */
     public String[] getContentType(String fieldName) {
         List<FileInfo> infos = fileInfos.get(fieldName);
-        if (infos == null)
+        if (infos == null) {
             return null;
+        }
 
-        List<String> types = new ArrayList<String>(infos.size());
-        for (FileInfo fileInfo : infos)
+        List<String> types = new ArrayList<>(infos.size());
+        for (FileInfo fileInfo : infos) {
             types.add(fileInfo.getContentType());
+        }
 
         return types.toArray(new String[types.size()]);
     }
@@ -163,12 +154,14 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
      */
     public File[] getFile(String fieldName) {
         List<FileInfo> infos = fileInfos.get(fieldName);
-        if (infos == null)
+        if (infos == null) {
             return null;
+        }
 
-        List<File> files = new ArrayList<File>(infos.size());
-        for (FileInfo fileInfo : infos)
+        List<File> files = new ArrayList<>(infos.size());
+        for (FileInfo fileInfo : infos) {
             files.add(fileInfo.getFile());
+        }
 
         return files.toArray(new File[files.size()]);
     }
@@ -178,12 +171,14 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
      */
     public String[] getFileNames(String fieldName) {
         List<FileInfo> infos = fileInfos.get(fieldName);
-        if (infos == null)
+        if (infos == null) {
             return null;
+        }
 
-        List<String> names = new ArrayList<String>(infos.size());
-        for (FileInfo fileInfo : infos)
+        List<String> names = new ArrayList<>(infos.size());
+        for (FileInfo fileInfo : infos) {
             names.add(getCanonicalName(fileInfo.getOriginalName()));
+        }
 
         return names.toArray(new String[names.size()]);
     }
@@ -200,12 +195,14 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
      */
     public String[] getFilesystemName(String fieldName) {
         List<FileInfo> infos = fileInfos.get(fieldName);
-        if (infos == null)
+        if (infos == null) {
             return null;
+        }
 
-        List<String> names = new ArrayList<String>(infos.size());
-        for (FileInfo fileInfo : infos)
+        List<String> names = new ArrayList<>(infos.size());
+        for (FileInfo fileInfo : infos) {
             names.add(fileInfo.getFile().getName());
+        }
 
         return names.toArray(new String[names.size()]);
     }
@@ -215,8 +212,9 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
      */
     public String getParameter(String name) {
         List<String> values = parameters.get(name);
-        if (values != null && values.size() > 0)
+        if (values != null && values.size() > 0) {
             return values.get(0);
+        }
         return null;
     }
 
@@ -232,24 +230,25 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
      */
     public String[] getParameterValues(String name) {
         List<String> values = parameters.get(name);
-        if (values != null && values.size() > 0)
+        if (values != null && values.size() > 0) {
             return values.toArray(new String[values.size()]);
+        }
         return null;
     }
 
     /* (non-Javadoc)
      * @see org.apache.struts2.dispatcher.multipart.MultiPartRequest#parse(javax.servlet.http.HttpServletRequest, java.lang.String)
      */
-    public void parse(HttpServletRequest request, String saveDir)
-            throws IOException {
+    public void parse(HttpServletRequest request, String saveDir) throws IOException {
         try {
             setLocale(request);
             processUpload(request, saveDir);
         } catch (Exception e) {
-            e.printStackTrace();
+            LOG.warn("Error occurred during parsing of multi part request", e);
             String errorMessage = buildErrorMessage(e, new Object[]{});
-            if (!errors.contains(errorMessage))
+            if (!errors.contains(errorMessage)) {
                 errors.add(errorMessage);
+            }
         }
     }
 
@@ -260,8 +259,9 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
      * @param request
      */
     protected void setLocale(HttpServletRequest request) {
-        if (defaultLocale == null)
+        if (defaultLocale == null) {
             defaultLocale = request.getLocale();
+        }
     }
 
     /**
@@ -271,8 +271,7 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
      * @param saveDir
      * @throws Exception
      */
-    private void processUpload(HttpServletRequest request, String saveDir)
-            throws Exception {
+    private void processUpload(HttpServletRequest request, String saveDir) throws Exception {
 
         // Sanity check that the request is a multi-part/form-data request.
         if (ServletFileUpload.isMultipartContent(request)) {
@@ -313,7 +312,7 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
                         processFileItemStreamAsFileField(itemStream, saveDir);
                     }
                 } catch (IOException e) {
-                    e.printStackTrace();
+                    LOG.warn("Error occurred during process upload", e);
                 }
             }
         }
@@ -329,8 +328,9 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
         // if maxSize is specified as -1, there is no sanity check and it's
         // safe to return true for any request, delegating the failure
         // checks later in the upload process.
-        if (maxSize == -1 || request == null)
+        if (maxSize == -1 || request == null) {
             return true;
+        }
 
         return request.getContentLength() < maxSize;
     }
@@ -343,8 +343,10 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
      */
     private long getRequestSize(HttpServletRequest request) {
         long requestSize = 0;
-        if (request != null)
+        if (request != null) {
             requestSize = request.getContentLength();
+        }
+
         return requestSize;
     }
 
@@ -358,8 +360,9 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
         String exceptionMessage = "Skipped file " + fileName + "; request size limit exceeded.";
         FileSizeLimitExceededException exception = new FileUploadBase.FileSizeLimitExceededException(exceptionMessage, getRequestSize(request), maxSize);
         String message = buildErrorMessage(exception, new Object[]{fileName, getRequestSize(request), maxSize});
-        if (!errors.contains(message))
+        if (!errors.contains(message)) {
             errors.add(message);
+        }
     }
 
     /**
@@ -370,10 +373,10 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
     private void processFileItemStreamAsFormField(FileItemStream itemStream) {
         String fieldName = itemStream.getFieldName();
         try {
-            List<String> values = null;
+            List<String> values;
             String fieldValue = Streams.asString(itemStream.openStream());
             if (!parameters.containsKey(fieldName)) {
-                values = new ArrayList<String>();
+                values = new ArrayList<>();
                 parameters.put(fieldName, values);
             } else {
                 values = parameters.get(fieldName);
@@ -396,8 +399,9 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
             // Create the temporary upload file.
             file = createTemporaryFile(itemStream.getName(), location);
 
-            if (streamFileToDisk(itemStream, file))
+            if (streamFileToDisk(itemStream, file)) {
                 createFileInfoFromItemStream(itemStream, file);
+            }
         } catch (IOException e) {
             if (file != null) {
                 try {
@@ -417,8 +421,7 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
      * @return
      * @throws IOException
      */
-    private File createTemporaryFile(String fileName, String location)
-            throws IOException {
+    private File createTemporaryFile(String fileName, String location) throws IOException {
         String name = fileName
                 .substring(fileName.lastIndexOf('/') + 1)
                 .substring(fileName.lastIndexOf('\\') + 1);
@@ -452,22 +455,23 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
             output = new BufferedOutputStream(new FileOutputStream(file), bufferSize);
             byte[] buffer = new byte[bufferSize];
             LOG.debug("Streaming file using buffer size {}.", bufferSize);
-            for (int length = 0; ((length = input.read(buffer)) > 0); )
+            for (int length = 0; ((length = input.read(buffer)) > 0); ) {
                 output.write(buffer, 0, length);
+            }
             result = true;
         } finally {
             if (output != null) {
                 try {
                     output.close();
                 } catch (IOException e) {
-                    e.printStackTrace();
+                    LOG.warn("Error occurred during closing of OutputStream.", e);
                 }
             }
             if (input != null) {
                 try {
                     input.close();
                 } catch (IOException e) {
-                    e.printStackTrace();
+                    LOG.warn("Error occurred during closing of InputStream.", e);
                 }
             }
         }
@@ -490,7 +494,7 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
         FileInfo fileInfo = new FileInfo(file, itemStream.getContentType(), fileName);
         // append or create new entry.
         if (!fileInfos.containsKey(fieldName)) {
-            List<FileInfo> infos = new ArrayList<FileInfo>();
+            List<FileInfo> infos = new ArrayList<>();
             infos.add(fileInfo);
             fileInfos.put(fieldName, infos);
         } else {
@@ -524,8 +528,7 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
      */
     private String buildErrorMessage(Throwable e, Object[] args) {
         String errorKey = "struts.message.upload.error." + e.getClass().getSimpleName();
-        if (LOG.isDebugEnabled())
-            LOG.debug("Preparing error message for key: [{}]", errorKey);
+        LOG.debug("Preparing error message for key: [{}]", errorKey);
         return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(), args);
     }
 
@@ -538,8 +541,7 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
      */
     private String buildMessage(Throwable e, Object[] args) {
         String messageKey = "struts.message.upload.message." + e.getClass().getSimpleName();
-        if (LOG.isDebugEnabled())
-            LOG.debug("Preparing message for key: [{}]", messageKey);
+        LOG.debug("Preparing message for key: [{}]", messageKey);
         return LocalizedTextUtil.findText(this.getClass(), messageKey, defaultLocale, e.getMessage(), args);
     }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequest.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequest.java b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequest.java
index 082153a..64dfccb 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequest.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequest.java
@@ -108,7 +108,7 @@ public interface MultiPartRequest {
      * Returns a list of error messages that may have occurred while processing the request.
      * If there are no errors, an empty list is returned. If the underlying implementation
      * (ie: pell, cos, jakarta, etc) cannot support providing these errors, an empty list is
-     * also returned. This list of errors is repoted back to the
+     * also returned. This list of errors is reported back to the
      * {@link MultiPartRequestWrapper}'s errors field.
      *
      * @return a list of Strings that represent various errors during parsing

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
index f7d7bb0..3a3539e 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
@@ -21,23 +21,16 @@
 
 package org.apache.struts2.dispatcher.multipart;
 
-import com.opensymphony.xwork2.DefaultLocaleProvider;
 import com.opensymphony.xwork2.LocaleProvider;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
-import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.dispatcher.StrutsRequestWrapper;
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Vector;
+import java.util.*;
 
 
 /**
@@ -76,7 +69,7 @@ public class MultiPartRequestWrapper extends StrutsRequestWrapper {
                                    String saveDir, LocaleProvider provider,
                                    boolean disableRequestAttributeValueStackLookup) {
         super(request, disableRequestAttributeValueStackLookup);
-        errors = new ArrayList<String>();
+        errors = new ArrayList<>();
         multi = multiPartRequest;
         defaultLocale = provider.getLocale();
         setLocale(request);
@@ -86,9 +79,7 @@ public class MultiPartRequestWrapper extends StrutsRequestWrapper {
                 addError(error);
             }
         } catch (IOException e) {
-            if (LOG.isWarnEnabled()) {
-                LOG.warn(e.getMessage(), e);
-            }
+            LOG.warn(e.getMessage(), e);
             addError(buildErrorMessage(e, new Object[] {e.getMessage()}));
         } 
     }
@@ -105,9 +96,7 @@ public class MultiPartRequestWrapper extends StrutsRequestWrapper {
 
     protected String buildErrorMessage(Throwable e, Object[] args) {
         String errorKey = "struts.messages.upload.error." + e.getClass().getSimpleName();
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Preparing error message for key: [{}]", errorKey);
-        }
+        LOG.debug("Preparing error message for key: [{}]", errorKey);
         return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(), args);
     }
 
@@ -194,7 +183,7 @@ public class MultiPartRequestWrapper extends StrutsRequestWrapper {
      * @see javax.servlet.http.HttpServletRequest#getParameterMap()
      */
     public Map getParameterMap() {
-        Map<String, String[]> map = new HashMap<String, String[]>();
+        Map<String, String[]> map = new HashMap<>();
         Enumeration enumeration = getParameterNames();
 
         while (enumeration.hasMoreElements()) {

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/dispatcher/ng/InitOperations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ng/InitOperations.java b/core/src/main/java/org/apache/struts2/dispatcher/ng/InitOperations.java
index e0c4316..470753e 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/ng/InitOperations.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/ng/InitOperations.java
@@ -23,17 +23,11 @@ package org.apache.struts2.dispatcher.ng;
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
-import org.apache.logging.log4j.LogManager;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.dispatcher.Dispatcher;
 import org.apache.struts2.dispatcher.StaticContentLoader;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.regex.Pattern;
 
 /**
@@ -103,7 +97,7 @@ public class InitOperations {
      * Create a {@link Dispatcher}
      */
     private Dispatcher createDispatcher( HostConfig filterConfig ) {
-        Map<String, String> params = new HashMap<String, String>();
+        Map<String, String> params = new HashMap<>();
         for ( Iterator e = filterConfig.getInitParameterNames(); e.hasNext(); ) {
             String name = (String) e.next();
             String value = filterConfig.getInitParameter(name);
@@ -131,7 +125,7 @@ public class InitOperations {
             
     private List<Pattern> buildExcludedPatternsList( String patterns ) {
         if (null != patterns && patterns.trim().length() != 0) {
-            List<Pattern> list = new ArrayList<Pattern>();
+            List<Pattern> list = new ArrayList<>();
             String[] tokens = patterns.split(",");
             for ( String token : tokens ) {
                 list.add(Pattern.compile(token.trim()));

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/dispatcher/ng/PrepareOperations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ng/PrepareOperations.java b/core/src/main/java/org/apache/struts2/dispatcher/ng/PrepareOperations.java
index bb60ce4..6170a54 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/ng/PrepareOperations.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/ng/PrepareOperations.java
@@ -23,8 +23,8 @@ package org.apache.struts2.dispatcher.ng;
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.ValueStackFactory;
-import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.RequestUtils;
 import org.apache.struts2.StrutsException;
 import org.apache.struts2.dispatcher.Dispatcher;
@@ -50,7 +50,6 @@ public class PrepareOperations {
     private Dispatcher dispatcher;
     private static final String STRUTS_ACTION_MAPPING_KEY = "struts.actionMapping";
     public static final String CLEANUP_RECURSION_COUNTER = "__cleanup_recursion_counter";
-    private Logger log = LogManager.getLogger(PrepareOperations.class);
 
     @Deprecated
     public PrepareOperations(ServletContext servletContext, Dispatcher dispatcher) {
@@ -75,7 +74,7 @@ public class PrepareOperations {
         ActionContext oldContext = ActionContext.getContext();
         if (oldContext != null) {
             // detected existing context, so we are probably in a forward
-            ctx = new ActionContext(new HashMap<String, Object>(oldContext.getContextMap()));
+            ctx = new ActionContext(new HashMap<>(oldContext.getContextMap()));
         } else {
             ValueStack stack = dispatcher.getContainer().getInstance(ValueStackFactory.class).createValueStack();
             stack.getContext().putAll(dispatcher.createContextMap(request, response, null));
@@ -95,9 +94,7 @@ public class PrepareOperations {
             counterVal -= 1;
             request.setAttribute(CLEANUP_RECURSION_COUNTER, counterVal);
             if (counterVal > 0 ) {
-                if (log.isDebugEnabled()) {
-                    log.debug("skipping cleanup counter="+counterVal);
-                }
+                LOG.debug("skipping cleanup counter={}", counterVal);
                 return;
             }
         }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsExecuteFilter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsExecuteFilter.java b/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsExecuteFilter.java
index 7f8164f..d2e23c9 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsExecuteFilter.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/ng/filter/StrutsExecuteFilter.java
@@ -27,12 +27,7 @@ import org.apache.struts2.dispatcher.ng.ExecuteOperations;
 import org.apache.struts2.dispatcher.ng.InitOperations;
 import org.apache.struts2.dispatcher.ng.PrepareOperations;
 
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
+import javax.servlet.*;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -80,8 +75,8 @@ public class StrutsExecuteFilter implements StrutsStatics, Filter {
 
         ActionMapping mapping = prepare.findActionMapping(request, response);
 
-        //if recusrion counter is > 1, it means we are in a "forward", in that case a mapping will still be
-        //in the request, if we handle it, it will lead to an infinte loop, see WW-3077
+        //if recursion counter is > 1, it means we are in a "forward", in that case a mapping will still be
+        //in the request, if we handle it, it will lead to an infinite loop, see WW-3077
         Integer recursionCounter = (Integer) request.getAttribute(PrepareOperations.CLEANUP_RECURSION_COUNTER);
 
         if (mapping == null || recursionCounter > 1) {

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java b/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java
index 5628aa4..02f39a8 100644
--- a/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java
+++ b/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java
@@ -5,8 +5,8 @@ import com.opensymphony.xwork2.ActionProxyFactory;
 import com.opensymphony.xwork2.DefaultActionProxyFactory;
 import com.opensymphony.xwork2.inject.Container;
 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 org.apache.struts2.StrutsConstants;
 
 import java.util.HashMap;
@@ -35,7 +35,7 @@ public class PrefixBasedActionProxyFactory extends DefaultActionProxyFactory {
 
     private static final Logger LOG = LogManager.getLogger(PrefixBasedActionProxyFactory.class);
 
-    private Map<String, ActionProxyFactory> actionProxyFactories = new HashMap<String, ActionProxyFactory>();
+    private Map<String, ActionProxyFactory> actionProxyFactories = new HashMap<>();
     private ActionProxyFactory defaultFactory;
 
     @Inject
@@ -54,7 +54,7 @@ public class PrefixBasedActionProxyFactory extends DefaultActionProxyFactory {
             String[] factories = list.split(",");
             for (String factory : factories) {
                 String[] thisFactory = factory.split(":");
-                if ((thisFactory != null) && (thisFactory.length == 2)) {
+                if (thisFactory.length == 2) {
                     String factoryPrefix = thisFactory[0].trim();
                     String factoryName = thisFactory[1].trim();
                     ActionProxyFactory obj = container.getInstance(ActionProxyFactory.class, factoryName);

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java b/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java
index be2f19c..528ee34 100644
--- a/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java
+++ b/core/src/main/java/org/apache/struts2/impl/StrutsObjectFactory.java
@@ -53,7 +53,7 @@ public class StrutsObjectFactory extends ObjectFactory {
             throws ConfigurationException {
         String className = interceptorConfig.getClassName();
 
-        Map<String, String> params = new HashMap<String, String>();
+        Map<String, String> params = new HashMap<>();
         Map typeParams = interceptorConfig.getParams();
         if (typeParams != null && !typeParams.isEmpty())
             params.putAll(typeParams);

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/ActionMappingParametersInteceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/ActionMappingParametersInteceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ActionMappingParametersInteceptor.java
index e2ad74f..ba8389e 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/ActionMappingParametersInteceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/ActionMappingParametersInteceptor.java
@@ -21,16 +21,15 @@
 
 package org.apache.struts2.interceptor;
 
-import com.opensymphony.xwork2.interceptor.ParametersInterceptor;
 import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.interceptor.ParametersInterceptor;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.dispatcher.mapper.ActionMapping;
 
-import java.util.Map;
 import java.util.Collections;
+import java.util.Map;
 import java.util.TreeMap;
 
-import org.apache.struts2.ServletActionContext;
-import org.apache.struts2.dispatcher.mapper.ActionMapping;
-
 /**
  * <!-- START SNIPPET: description -->
  * This interceptor sets all parameters from the action mapping, for this request, on the value stack.  It operates
@@ -75,8 +74,7 @@ public class ActionMappingParametersInteceptor extends ParametersInterceptor {
 
     /**
      * @param ac The action context
-     * @return the parameters from the action mapping in the context.  If none found, returns
-     *         an empty map.
+     * @return the parameters from the action mapping in the context.  If none found, returns an empty map.
      */
     @Override
     protected Map<String, Object> retrieveParameters(ActionContext ac) {
@@ -100,7 +98,7 @@ public class ActionMappingParametersInteceptor extends ParametersInterceptor {
     @Override
     protected void addParametersToContext(ActionContext ac, Map newParams) {
         Map previousParams = ac.getParameters();
-        Map combinedParams = null;
+        Map combinedParams;
         if (previousParams != null) {
             combinedParams = new TreeMap(previousParams);
         } else {

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java
index b6410b8..8fd638b 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java
@@ -22,14 +22,14 @@
 package org.apache.struts2.interceptor;
 
 import com.opensymphony.xwork2.ActionInvocation;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
-import java.util.Map;
-import java.util.Set;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * <!-- START SNIPPET: description -->
@@ -59,7 +59,7 @@ public class CheckboxInterceptor extends AbstractInterceptor {
 
     public String intercept(ActionInvocation ai) throws Exception {
         Map<String, Object> parameters = ai.getInvocationContext().getParameters();
-        Map<String, String[]> newParams = new HashMap<String, String[]>();
+        Map<String, String[]> newParams = new HashMap<>();
         Set<Map.Entry<String, Object>> entries = parameters.entrySet();
 
         for (Iterator<Map.Entry<String, Object>> iterator = entries.iterator(); iterator.hasNext();) {

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/ClearSessionInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/ClearSessionInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ClearSessionInterceptor.java
index cf2d797..aa4f3e5 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/ClearSessionInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/ClearSessionInterceptor.java
@@ -21,13 +21,13 @@
 
 package org.apache.struts2.interceptor;
 
-import java.util.Map;
-
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
-import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.util.Map;
 
 /**
  * <!-- START SNIPPET: description -->
@@ -83,10 +83,8 @@ public class ClearSessionInterceptor extends AbstractInterceptor {
      * @see com.opensymphony.xwork2.interceptor.Interceptor#intercept(com.opensymphony.xwork2.ActionInvocation)
      */
     public String intercept(ActionInvocation invocation) throws Exception {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Clearing HttpSession");
-        }
-        
+        LOG.debug("Clearing HttpSession");
+
         ActionContext ac = invocation.getInvocationContext();
         Map session = ac.getSession();
  

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/CookieInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/CookieInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/CookieInterceptor.java
index 76a4f2c..c25180b 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/CookieInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/CookieInterceptor.java
@@ -29,8 +29,8 @@ import com.opensymphony.xwork2.security.AcceptedPatternsChecker;
 import com.opensymphony.xwork2.security.ExcludedPatternsChecker;
 import com.opensymphony.xwork2.util.TextParseUtil;
 import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.ServletActionContext;
 
 import javax.servlet.http.Cookie;
@@ -195,8 +195,9 @@ public class CookieInterceptor extends AbstractInterceptor {
      * @param cookiesName
      */
     public void setCookiesName(String cookiesName) {
-        if (cookiesName != null)
+        if (cookiesName != null) {
             this.cookiesNameSet = TextParseUtil.commaDelimitedStringToSet(cookiesName);
+        }
     }
 
     /**
@@ -207,8 +208,9 @@ public class CookieInterceptor extends AbstractInterceptor {
      * @param cookiesValue
      */
     public void setCookiesValue(String cookiesValue) {
-        if (cookiesValue != null)
+        if (cookiesValue != null) {
             this.cookiesValueSet = TextParseUtil.commaDelimitedStringToSet(cookiesValue);
+        }
     }
 
     /**
@@ -222,12 +224,10 @@ public class CookieInterceptor extends AbstractInterceptor {
     }
 
     public String intercept(ActionInvocation invocation) throws Exception {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("start interception");
-        }
+        LOG.debug("start interception");
 
         // contains selected cookies
-        final Map<String, String> cookiesMap = new LinkedHashMap<String, String>();
+        final Map<String, String> cookiesMap = new LinkedHashMap<>();
 
         Cookie[] cookies = ServletActionContext.getRequest().getCookies();
         if (cookies != null) {
@@ -239,9 +239,7 @@ public class CookieInterceptor extends AbstractInterceptor {
 
                 if (isAcceptableName(name) && isAcceptableValue(value)) {
                     if (cookiesNameSet.contains("*")) {
-                        if (LOG.isDebugEnabled()) {
-                            LOG.debug("contains cookie name [*] in configured cookies name set, cookie with name [" + name + "] with value [" + value + "] will be injected");
-                        }
+                        LOG.debug("Contains cookie name [*] in configured cookies name set, cookie with name [{}] with value [{}] will be injected", name, value);
                         populateCookieValueIntoStack(name, value, cookiesMap, stack);
                     } else if (cookiesNameSet.contains(cookie.getName())) {
                         populateCookieValueIntoStack(name, value, cookiesMap, stack);
@@ -346,9 +344,7 @@ public class CookieInterceptor extends AbstractInterceptor {
             // if cookiesValues is specified, the cookie's value must match before we
             // inject them into Struts' action
             if (cookiesValueSet.contains(cookieValue)) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("both configured cookie name and value matched, cookie [{}] with value [{}] will be injected", cookieName, cookieValue);
-                }
+                LOG.debug("both configured cookie name and value matched, cookie [{}] with value [{}] will be injected", cookieName, cookieValue);
 
                 cookiesMap.put(cookieName, cookieValue);
                 stack.setValue(cookieName, cookieValue);

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java
index 89251f4..6f604d0 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java
@@ -23,8 +23,8 @@ package org.apache.struts2.interceptor;
 
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
-import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.dispatcher.SessionMap;
 
@@ -92,9 +92,7 @@ public class CreateSessionInterceptor extends AbstractInterceptor {
     public String intercept(ActionInvocation invocation) throws Exception {
         HttpSession httpSession = ServletActionContext.getRequest().getSession(false);
         if (httpSession == null) {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Creating new HttpSession and new SessionMap in ServletActionContext");
-            }
+            LOG.debug("Creating new HttpSession and new SessionMap in ServletActionContext");
             ServletActionContext.getRequest().getSession(true);
             ServletActionContext.getContext().setSession(new SessionMap<String, Object>(ServletActionContext.getRequest()));
         }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java
index cef6905..05d3851 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/DateTextFieldInterceptor.java
@@ -1,18 +1,14 @@
 package org.apache.struts2.interceptor;
 
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.interceptor.Interceptor;
-import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.Map.Entry;
 
 public class DateTextFieldInterceptor implements Interceptor {
 
@@ -31,9 +27,9 @@ public class DateTextFieldInterceptor implements Interceptor {
 		private String description;
 		private Integer length;
 		private String dateType;
-		
-		private DateWord(String n, Integer l, String t) {
-			description = n;
+
+        DateWord(String n, Integer l, String t) {
+            description = n;
 			length = l;
 			dateType = t;
 		}
@@ -68,7 +64,7 @@ public class DateTextFieldInterceptor implements Interceptor {
     public String intercept(ActionInvocation ai) throws Exception {
         Map<String, Object> parameters = ai.getInvocationContext().getParameters();
         Set<Entry<String, Object>> entries = parameters.entrySet();
-        Map<String, Map<String, String>> dates = new HashMap<String, Map<String,String>>();
+        Map<String, Map<String, String>> dates = new HashMap<>();
         
         DateWord[] dateWords = DateWord.getAll();
 
@@ -88,8 +84,8 @@ public class DateTextFieldInterceptor implements Interceptor {
                     		iterator.remove();
                     		Map<String, String> map = dates.get(name);
                     		if (map == null) {
-                    			map = new HashMap<String, String>();
-                            	dates.put(name, map);
+                                map = new HashMap<>();
+                                dates.put(name, map);
                     		}
                             map.put(dateWord.getDateType(), values[0]);
                     	}
@@ -100,7 +96,7 @@ public class DateTextFieldInterceptor implements Interceptor {
         }
 
         // Create all the date objects
-        Map<String, Date> newParams = new HashMap<String, Date>();
+        Map<String, Date> newParams = new HashMap<>();
         Set<Entry<String, Map<String, String>>> dateEntries = dates.entrySet();
         for (Entry<String, Map<String, String>> dateEntry : dateEntries) {
         	Set<Entry<String, String>> dateFormatEntries = dateEntry.getValue().entrySet();
@@ -116,8 +112,7 @@ public class DateTextFieldInterceptor implements Interceptor {
                 Date value = formatter.parse(dateValue);
                 newParams.put(dateEntry.getKey(), value);
             } catch (ParseException e) {
-            	LOG.warn("Cannot parse the parameter '" + dateEntry.getKey() 
-            			+ "' with format '" + dateFormat + "' and with value '" + dateValue + "'");
+                LOG.warn("Cannot parse the parameter '{}' with format '{}' and with value '{}'", dateEntry.getKey(), dateFormat, dateValue);
             }
         }
         parameters.putAll(newParams);

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/DeprecationInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/DeprecationInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/DeprecationInterceptor.java
index 16974d8..3722efe 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/DeprecationInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/DeprecationInterceptor.java
@@ -5,8 +5,9 @@ import com.opensymphony.xwork2.XWorkConstants;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
-import org.apache.logging.log4j.Logger;
+import org.apache.commons.lang3.BooleanUtils;
 import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.StrutsConstants;
 
 import java.lang.reflect.Field;
@@ -47,7 +48,7 @@ public class DeprecationInterceptor extends AbstractInterceptor {
      * @throws Exception
      */
     private String validate() throws Exception {
-        Set<String> constants = new HashSet<String>();
+        Set<String> constants = new HashSet<>();
 
         readConstants(constants, StrutsConstants.class);
         readConstants(constants, XWorkConstants.class);
@@ -55,7 +56,7 @@ public class DeprecationInterceptor extends AbstractInterceptor {
         Set<String> applicationConstants = container.getInstanceNames(String.class);
         String message = null;
         if (!constants.containsAll(applicationConstants)) {
-            Set<String> deprecated = new HashSet<String>(applicationConstants);
+            Set<String> deprecated = new HashSet<>(applicationConstants);
             deprecated.removeAll(constants);
             message = prepareMessage(deprecated);
         }
@@ -94,7 +95,7 @@ public class DeprecationInterceptor extends AbstractInterceptor {
 
     @Inject(StrutsConstants.STRUTS_DEVMODE)
     public void setDevMode(String state) {
-        this.devMode = "true".equals(state);
+        this.devMode = BooleanUtils.toBoolean(state);
     }
 
     @Inject

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java
index 9d42dfb..8b107ee 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java
@@ -21,26 +21,21 @@
 
 package org.apache.struts2.interceptor;
 
-import java.util.Collections;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.ActionProxy;
-import com.opensymphony.xwork2.Action;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.config.entities.ResultConfig;
 import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
-import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
-import org.apache.struts2.util.TokenHelper;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.ServletActionContext;
-import org.apache.struts2.dispatcher.Dispatcher;
-import org.apache.struts2.views.freemarker.FreemarkerManager;
+import org.apache.struts2.util.TokenHelper;
 import org.apache.struts2.views.freemarker.FreemarkerResult;
 
 import javax.servlet.http.HttpSession;
+import java.util.Map;
 
 
 /**
@@ -264,12 +259,9 @@ public class ExecuteAndWaitInterceptor extends MethodFilterInterceptor {
 
                 Map results = proxy.getConfig().getResults();
                 if (!results.containsKey(WAIT)) {
-                    if (LOG.isWarnEnabled()) {
                 	LOG.warn("ExecuteAndWait interceptor has detected that no result named 'wait' is available. " +
                             "Defaulting to a plain built-in wait page. It is highly recommend you " +
-                            "provide an action-specific or global result named '" + WAIT +
-                            "'.");
-                    }
+                            "provide an action-specific or global result named '{}'.", WAIT);
                     // no wait result? hmm -- let's try to do dynamically put it in for you!
 
                     //we used to add a fake "wait" result here, since the configuration is unmodifiable, that is no longer
@@ -314,7 +306,7 @@ public class ExecuteAndWaitInterceptor extends MethodFilterInterceptor {
      * Performs the initial delay.
      * <p/>
      * When this interceptor is executed for the first time this methods handles any provided initial delay.
-     * An initial delay is a time in miliseconds we let the server wait before we continue.
+     * An initial delay is a time in milliseconds we let the server wait before we continue.
      * <br/> During the wait this interceptor will wake every 100 millis to check if the background
      * process is done premature, thus if the job for some reason doesn't take to long the wait
      * page is not shown to the user.
@@ -328,16 +320,12 @@ public class ExecuteAndWaitInterceptor extends MethodFilterInterceptor {
         }
 
         int steps = delay / delaySleepInterval;
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Delaying for " + delay + " millis. (using " + steps + " steps)");
-        }
+        LOG.debug("Delaying for {} millis. (using {} steps)", delay, steps);
         int step;
         for (step = 0; step < steps && !bp.isDone(); step++) {
             Thread.sleep(delaySleepInterval);
         }
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Sleeping ended after " + step + " steps and the background process is " + (bp.isDone() ? " done" : " not done"));
-        }
+        LOG.debug("Sleeping ended after {} steps and the background process is {}", step, (bp.isDone() ? " done" : " not done"));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java
index 109f11a..76ae56a 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java
@@ -21,19 +21,13 @@
 
 package org.apache.struts2.interceptor;
 
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.ActionProxy;
-import com.opensymphony.xwork2.LocaleProvider;
-import com.opensymphony.xwork2.TextProvider;
-import com.opensymphony.xwork2.TextProviderFactory;
-import com.opensymphony.xwork2.ValidationAware;
+import com.opensymphony.xwork2.*;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
 import com.opensymphony.xwork2.util.TextParseUtil;
-import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper;
 import org.apache.struts2.util.ContentTypeMatcher;
@@ -41,14 +35,7 @@ import org.apache.struts2.util.ContentTypeMatcher;
 import javax.servlet.http.HttpServletRequest;
 import java.io.File;
 import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 /**
  * <!-- START SNIPPET: description -->
@@ -288,9 +275,9 @@ public class FileUploadInterceptor extends AbstractInterceptor {
                     // get a File object for the uploaded File
                     File[] files = multiWrapper.getFiles(inputName);
                     if (files != null && files.length > 0) {
-                        List<File> acceptedFiles = new ArrayList<File>(files.length);
-                        List<String> acceptedContentTypes = new ArrayList<String>(files.length);
-                        List<String> acceptedFileNames = new ArrayList<String>(files.length);
+                        List<File> acceptedFiles = new ArrayList<>(files.length);
+                        List<String> acceptedContentTypes = new ArrayList<>(files.length);
+                        List<String> acceptedFileNames = new ArrayList<>(files.length);
                         String contentTypeName = inputName + "ContentType";
                         String fileNameName = inputName + "FileName";
 

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java
index 3c358f5..aff8aac 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java
@@ -21,19 +21,18 @@
 
 package org.apache.struts2.interceptor;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.struts2.dispatcher.ServletRedirectResult;
-
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.ValidationAware;
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
-import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.struts2.dispatcher.ServletRedirectResult;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
 
 /**
  * <!-- START SNIPPET: description -->
@@ -189,18 +188,14 @@ public class MessageStoreInterceptor extends AbstractInterceptor {
     }
 
     public String intercept(ActionInvocation invocation) throws Exception {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("entering MessageStoreInterceptor ...");
-        }
+        LOG.debug("entering MessageStoreInterceptor ...");
 
         before(invocation);
         String result = invocation.invoke();
         after(invocation, result);
 
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("exit executing MessageStoreInterceptor");
-        }
-        
+        LOG.debug("exit executing MessageStoreInterceptor");
+
         return result;
     }
 
@@ -224,17 +219,13 @@ public class MessageStoreInterceptor extends AbstractInterceptor {
                 Map session = (Map) invocation.getInvocationContext().get(ActionContext.SESSION);
 
                 if (session == null) {
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Session is not open, no errors / messages could be retrieve for action ["+action+"]");
-                    }
+                    LOG.debug("Session is not open, no errors / messages could be retrieve for action [{}]", action);
                     return;
                 }
 
                 ValidationAware validationAwareAction = (ValidationAware) action;
 
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("retrieve error / message from session to populate into action ["+action+"]");
-                }
+                LOG.debug("Retrieve error / message from session to populate into action [{}]", action);
 
                 Collection actionErrors = (Collection) session.get(actionErrorsSessionKey);
                 Collection actionMessages = (Collection) session.get(actionMessagesSessionKey);
@@ -283,23 +274,18 @@ public class MessageStoreInterceptor extends AbstractInterceptor {
                 Map session = (Map) invocation.getInvocationContext().get(ActionContext.SESSION);
 
                 if (session == null) {
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Could not store action ["+action+"] error/messages into session, because session hasn't been opened yet.");
-                    }
+                    LOG.debug("Could not store action [{}] error/messages into session, because session hasn't been opened yet.", action);
                     return;
                 }
 
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("store action ["+action+"] error/messages into session ");
-                }
+                LOG.debug("Store action [{}] error/messages into session.", action);
 
                 ValidationAware validationAwareAction = (ValidationAware) action;
                 session.put(actionErrorsSessionKey, validationAwareAction.getActionErrors());
                 session.put(actionMessagesSessionKey, validationAwareAction.getActionMessages());
                 session.put(fieldErrorsSessionKey, validationAwareAction.getFieldErrors());
-            }
-            else if(LOG.isDebugEnabled()) {
-        	LOG.debug("Action ["+action+"] is not ValidationAware, no message / error that are storeable");
+            } else {
+                LOG.debug("Action [{}] is not ValidationAware, no message / error that are storeable", action);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/MultiselectInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/MultiselectInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/MultiselectInterceptor.java
index 15886b6..4c8b844 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/MultiselectInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/MultiselectInterceptor.java
@@ -48,7 +48,7 @@ public class MultiselectInterceptor extends AbstractInterceptor {
      */
     public String intercept(ActionInvocation actionInvocation) throws Exception {
         Map<String, Object> parameters = actionInvocation.getInvocationContext().getParameters();
-        Map<String, Object> newParams = new HashMap<String, Object>();
+        Map<String, Object> newParams = new HashMap<>();
         Set<String> keys = parameters.keySet();
 
         for (Iterator<String> iterator = keys.iterator(); iterator.hasNext();) {

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java
index 0de1996..d5be374 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/ProfilingActivationInterceptor.java
@@ -25,7 +25,7 @@ import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
 import com.opensymphony.xwork2.util.profiling.UtilTimerStack;
-
+import org.apache.commons.lang3.BooleanUtils;
 import org.apache.struts2.StrutsConstants;
 
 /**
@@ -87,7 +87,7 @@ public class ProfilingActivationInterceptor extends AbstractInterceptor {
     
     @Inject(StrutsConstants.STRUTS_DEVMODE)
     public void setDevMode(String mode) {
-        this.devMode = "true".equals(mode);
+        this.devMode = BooleanUtils.toBoolean(mode);
     }
 
     @Override
@@ -96,13 +96,11 @@ public class ProfilingActivationInterceptor extends AbstractInterceptor {
             Object val = invocation.getInvocationContext().getParameters().get(profilingKey);
             if (val != null) {
                 String sval = (val instanceof String ? (String)val : ((String[])val)[0]);
-                boolean enable = "yes".equalsIgnoreCase(sval) || "true".equalsIgnoreCase(sval);
+                boolean enable = BooleanUtils.toBoolean(sval);
                 UtilTimerStack.setActive(enable);
                 invocation.getInvocationContext().getParameters().remove(profilingKey);
             }
         }
         return invocation.invoke();
-
     }
-
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java
index eb087c1..9177ea2 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java
@@ -23,8 +23,8 @@ package org.apache.struts2.interceptor;
 
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
-import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.ServletActionContext;
 
 import javax.servlet.http.HttpServletRequest;
@@ -172,9 +172,7 @@ public class RolesInterceptor extends AbstractInterceptor {
      * @return The result code
      * @throws Exception
      */
-    protected String handleRejection(ActionInvocation invocation,
-            HttpServletResponse response)
-            throws Exception {
+    protected String handleRejection(ActionInvocation invocation, HttpServletResponse response) throws Exception {
         response.sendError(HttpServletResponse.SC_FORBIDDEN);
         return null;
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
index 28cca41..dfcd4d3 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
@@ -21,22 +21,23 @@
 
 package org.apache.struts2.interceptor;
 
-import java.io.Serializable;
-import java.util.IdentityHashMap;
-import java.util.Map;
-
-import org.apache.struts2.ServletActionContext;
-import org.apache.struts2.StrutsException;
-import org.apache.struts2.dispatcher.SessionMap;
-
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.ActionProxy;
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
 import com.opensymphony.xwork2.interceptor.PreResultListener;
 import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
+import org.apache.commons.lang3.BooleanUtils;
+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.StrutsException;
+import org.apache.struts2.dispatcher.SessionMap;
+
+import java.io.Serializable;
+import java.util.IdentityHashMap;
+import java.util.Map;
 
 /**
  * <!-- START SNIPPET: description -->
@@ -182,8 +183,8 @@ public class ScopeInterceptor extends AbstractInterceptor implements PreResultLi
      * @param value True if it should be created
      */
     public void setAutoCreateSession(String value) {
-        if (value != null && value.length() > 0) {
-            this.autoCreateSession = Boolean.valueOf(value).booleanValue();
+        if (StringUtils.isNotBlank(value)) {
+            this.autoCreateSession = BooleanUtils.toBoolean(value);
         }
     }
 
@@ -219,7 +220,7 @@ public class ScopeInterceptor extends AbstractInterceptor implements PreResultLi
 
     private static final Object NULL = new NULLClass();
 
-    private static final Object nullConvert(Object o) {
+    private static Object nullConvert(Object o) {
         if (o == null) {
             return NULL;
         }
@@ -233,10 +234,10 @@ public class ScopeInterceptor extends AbstractInterceptor implements PreResultLi
 
     private static Map locks = new IdentityHashMap();
 
-    static final void lock(Object o, ActionInvocation invocation) throws Exception {
+    static void lock(Object o, ActionInvocation invocation) throws Exception {
         synchronized (o) {
             int count = 3;
-            Object previous = null;
+            Object previous;
             while ((previous = locks.get(o)) != null) {
                 if (previous == invocation) {
                     return;
@@ -249,12 +250,11 @@ public class ScopeInterceptor extends AbstractInterceptor implements PreResultLi
                 }
                 o.wait(10000);
             }
-            ;
             locks.put(o, invocation);
         }
     }
 
-    static final void unlock(Object o) {
+    static void unlock(Object o) {
         synchronized (o) {
             locks.remove(o);
             o.notify();
@@ -285,19 +285,13 @@ public class ScopeInterceptor extends AbstractInterceptor implements PreResultLi
         Map app = ActionContext.getContext().getApplication();
         final ValueStack stack = ActionContext.getContext().getValueStack();
 
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("scope interceptor before");
-        }
+        LOG.debug("scope interceptor before");
 
         if (application != null)
-            for (int i = 0; i < application.length; i++) {
-                String string = application[i];
+            for (String string : application) {
                 Object attribute = app.get(key + string);
                 if (attribute != null) {
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("application scoped variable set " + string + " = " + String.valueOf(attribute));
-                    }
-
+                    LOG.debug("Application scoped variable set {} = {}", string, String.valueOf(attribute));
                     stack.setValue(string, nullConvert(attribute));
                 }
             }
@@ -316,13 +310,10 @@ public class ScopeInterceptor extends AbstractInterceptor implements PreResultLi
         }
 
         if (session != null && (!"start".equals(type))) {
-            for (int i = 0; i < session.length; i++) {
-                String string = session[i];
+            for (String string : session) {
                 Object attribute = ses.get(key + string);
                 if (attribute != null) {
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("session scoped variable set " + string + " = " + String.valueOf(attribute));
-                    }
+                    LOG.debug("Session scoped variable set {} = {}", string, String.valueOf(attribute));
                     stack.setValue(string, nullConvert(attribute));
                 }
             }
@@ -342,12 +333,9 @@ public class ScopeInterceptor extends AbstractInterceptor implements PreResultLi
         final ValueStack stack = ActionContext.getContext().getValueStack();
 
         if (application != null)
-            for (int i = 0; i < application.length; i++) {
-                String string = application[i];
+            for (String string : application) {
                 Object value = stack.findValue(string);
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("application scoped variable saved " + string + " = " + String.valueOf(value));
-                }
+                LOG.debug("Application scoped variable saved {} = {}", string, String.valueOf(value));
 
                 //if( value != null)
                 app.put(key + string, nullConvert(value));
@@ -359,16 +347,12 @@ public class ScopeInterceptor extends AbstractInterceptor implements PreResultLi
         if (ses != null) {
 
             if (session != null) {
-                for (int i = 0; i < session.length; i++) {
-                    String string = session[i];
+                for (String string : session) {
                     if (ends) {
                         ses.remove(key + string);
                     } else {
                         Object value = stack.findValue(string);
-
-                        if (LOG.isDebugEnabled()) {
-                            LOG.debug("session scoped variable saved " + string + " = " + String.valueOf(value));
-                        }
+                        LOG.debug("Session scoped variable saved {} = {}", string, String.valueOf(value));
 
                         // Null value should be scoped too
                         //if( value != null)
@@ -380,9 +364,7 @@ public class ScopeInterceptor extends AbstractInterceptor implements PreResultLi
         } else {
             LOG.debug("No HttpSession created... Cannot save session scoped variables.");
         }
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("scope interceptor after (before result)");
-        }
+        LOG.debug("scope interceptor after (before result)");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
index d6c08f0..53a9807 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
@@ -136,9 +136,7 @@ public class TokenInterceptor extends MethodFilterInterceptor {
      */
     @Override
     protected String doIntercept(ActionInvocation invocation) throws Exception {
-        if (log.isDebugEnabled()) {
-            log.debug("Intercepting invocation to check for valid transaction token.");
-        }
+        log.debug("Intercepting invocation to check for valid transaction token.");
         return handleToken(invocation);
     }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java
index 7ff8799..7ea1fed 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java
@@ -21,6 +21,22 @@
 
 package org.apache.struts2.interceptor.debugging;
 
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
+import com.opensymphony.xwork2.interceptor.PreResultListener;
+import com.opensymphony.xwork2.util.ValueStack;
+import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.StrutsConstants;
+import org.apache.struts2.dispatcher.FilterDispatcher;
+import org.apache.struts2.views.freemarker.FreemarkerManager;
+import org.apache.struts2.views.freemarker.FreemarkerResult;
+
+import javax.servlet.http.HttpServletResponse;
 import java.beans.BeanInfo;
 import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
@@ -29,30 +45,7 @@ import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.lang.reflect.Array;
 import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.struts2.ServletActionContext;
-import org.apache.struts2.StrutsConstants;
-import org.apache.struts2.dispatcher.FilterDispatcher;
-import org.apache.struts2.views.freemarker.FreemarkerManager;
-import org.apache.struts2.views.freemarker.FreemarkerResult;
-
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
-import com.opensymphony.xwork2.interceptor.PreResultListener;
-import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
-import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
+import java.util.*;
 
 /**
  * <!-- START SNIPPET: description -->
@@ -99,7 +92,7 @@ public class DebuggingInterceptor extends AbstractInterceptor {
             "com.opensymphony.xwork2.", "xwork."};
     private String[] _ignoreKeys = new String[]{"application", "session",
             "parameters", "request"};
-    private HashSet<String> ignoreKeys = new HashSet<String>(Arrays.asList(_ignoreKeys));
+    private HashSet<String> ignoreKeys = new HashSet<>(Arrays.asList(_ignoreKeys));
 
     private final static String XML_MODE = "xml";
     private final static String CONSOLE_MODE = "console";
@@ -145,7 +138,7 @@ public class DebuggingInterceptor extends AbstractInterceptor {
         boolean actionOnly = false;
         boolean cont = true;
         Boolean devModeOverride = FilterDispatcher.getDevModeOverride();
-        boolean devMode = devModeOverride != null ? devModeOverride.booleanValue() : this.devMode;
+        boolean devMode = devModeOverride != null ? devModeOverride : this.devMode;
         if (devMode) {
             final ActionContext ctx = ActionContext.getContext();
             String type = getParameter(DEBUG_PARAM);
@@ -266,7 +259,6 @@ public class DebuggingInterceptor extends AbstractInterceptor {
         }
     }
 
-
     /**
      * Gets a single string from the request parameters
      *
@@ -281,7 +273,6 @@ public class DebuggingInterceptor extends AbstractInterceptor {
         return null;
     }
 
-
     /**
      * Prints the current context to the response in XML format.
      */
@@ -299,7 +290,6 @@ public class DebuggingInterceptor extends AbstractInterceptor {
         }
     }
 
-
     /**
      * Prints the current request to the existing writer.
      *
@@ -308,8 +298,7 @@ public class DebuggingInterceptor extends AbstractInterceptor {
     protected void printContext(PrettyPrintWriter writer) {
         ActionContext ctx = ActionContext.getContext();
         writer.startNode(DEBUG_PARAM);
-        serializeIt(ctx.getParameters(), "parameters", writer,
-                new ArrayList<Object>());
+        serializeIt(ctx.getParameters(), "parameters", writer, new ArrayList<>());
         writer.startNode("context");
         String key;
         Map ctxMap = ctx.getContextMap();
@@ -324,24 +313,23 @@ public class DebuggingInterceptor extends AbstractInterceptor {
                 }
             }
             if (print) {
-                serializeIt(ctxMap.get(key), key, writer, new ArrayList<Object>());
+                serializeIt(ctxMap.get(key), key, writer, new ArrayList<>());
             }
         }
         writer.endNode();
         Map requestMap = (Map) ctx.get("request");
         serializeIt(requestMap, "request", writer, filterValueStack(requestMap));
-        serializeIt(ctx.getSession(), "session", writer, new ArrayList<Object>());
+        serializeIt(ctx.getSession(), "session", writer, new ArrayList<>());
 
         ValueStack stack = (ValueStack) ctx.get(ActionContext.VALUE_STACK);
-        serializeIt(stack.getRoot(), "valueStack", writer, new ArrayList<Object>());
+        serializeIt(stack.getRoot(), "valueStack", writer, new ArrayList<>());
         writer.endNode();
     }
 
-
     /**
      * Recursive function to serialize objects to XML. Currently it will
      * serialize Collections, maps, Arrays, and JavaBeans. It maintains a stack
-     * of objects serialized already in the current functioncall. This is used
+     * of objects serialized already in the current function call. This is used
      * to avoid looping (stack overflow) of circular linked objects. Struts and
      * XWork objects are ignored.
      *
@@ -356,10 +344,7 @@ public class DebuggingInterceptor extends AbstractInterceptor {
         writer.flush();
         // Check stack for this object
         if ((bean != null) && (stack.contains(bean))) {
-            if (LOG.isInfoEnabled()) {
-                LOG.info("Circular reference detected, not serializing object: "
-                        + name);
-            }
+            LOG.info("Circular reference detected, not serializing object: {}", name);
             return;
         } else if (bean != null) {
             // Push object onto stack.
@@ -428,7 +413,6 @@ public class DebuggingInterceptor extends AbstractInterceptor {
         stack.remove(bean);
     }
 
-
     /**
      * @param enableXmlWithConsole the enableXmlWithConsole to set
      */
@@ -436,17 +420,14 @@ public class DebuggingInterceptor extends AbstractInterceptor {
         this.enableXmlWithConsole = enableXmlWithConsole;
     }
 
-    
     private List<Object> filterValueStack(Map requestMap) {
-    	List<Object> filter = new ArrayList<Object>();
-    	Object valueStack = requestMap.get("struts.valueStack");
+        List<Object> filter = new ArrayList<>();
+        Object valueStack = requestMap.get("struts.valueStack");
     	if(valueStack != null) {
     		filter.add(valueStack);
     	}
     	return filter;
     }
-
-
 }
 
 

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/debugging/ObjectToHTMLWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/debugging/ObjectToHTMLWriter.java b/core/src/main/java/org/apache/struts2/interceptor/debugging/ObjectToHTMLWriter.java
index 223fe98..396614b 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/debugging/ObjectToHTMLWriter.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/debugging/ObjectToHTMLWriter.java
@@ -21,17 +21,16 @@
 
 package org.apache.struts2.interceptor.debugging;
 
+import com.opensymphony.xwork2.util.reflection.ReflectionException;
+import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
+
 import java.beans.IntrospectionException;
 import java.io.Writer;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import com.opensymphony.xwork2.util.reflection.ReflectionException;
-import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
-
 /**
  * Writes an object as a table, where each field can be expanded if it is an Object/Collection/Array
  *
@@ -51,9 +50,8 @@ class ObjectToHTMLWriter {
         prettyWriter.addAttribute("class", "debugTable");
 
         if (root instanceof Map) {
-            for (Iterator iterator = ((Map) root).entrySet().iterator(); iterator
-                .hasNext();) {
-                Map.Entry property = (Map.Entry) iterator.next();
+            for (Object next : ((Map) root).entrySet()) {
+                Map.Entry property = (Map.Entry) next;
                 String key = property.getKey().toString();
                 Object value = property.getValue();
                 writeProperty(key, value, expr);
@@ -66,8 +64,8 @@ class ObjectToHTMLWriter {
             }
         } else if (root instanceof Set) {
             Set set = (Set) root;
-            for (Iterator iterator = set.iterator(); iterator.hasNext();) {
-                writeProperty("", iterator.next(), expr);
+            for (Object next : set) {
+                writeProperty("", next, expr);
             }
         } else if (root.getClass().isArray()) {
             Object[] objects = (Object[]) root;
@@ -81,8 +79,9 @@ class ObjectToHTMLWriter {
                 String name = property.getKey();
                 Object value = property.getValue();
 
-                if ("class".equals(name))
+                if ("class".equals(name)) {
                     continue;
+                }
 
                 writeProperty(name, value, expr);
             }
@@ -104,9 +103,8 @@ class ObjectToHTMLWriter {
         prettyWriter.startNode("td");
         if (value != null) {
             //if is is an empty collection or array, don't write a link
-            if (value != null &&
-                (isEmptyCollection(value) || isEmptyMap(value) || (value.getClass()
-                    .isArray() && ((Object[]) value).length == 0))) {
+            if (isEmptyCollection(value) || isEmptyMap(value) || (value.getClass()
+                    .isArray() && ((Object[]) value).length == 0)) {
                 prettyWriter.addAttribute("class", "emptyCollection");
                 prettyWriter.setValue("empty");
             } else {

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/debugging/PrettyPrintWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/debugging/PrettyPrintWriter.java b/core/src/main/java/org/apache/struts2/interceptor/debugging/PrettyPrintWriter.java
index 2541040..1902bd9 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/debugging/PrettyPrintWriter.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/debugging/PrettyPrintWriter.java
@@ -28,7 +28,7 @@ import java.util.Stack;
 public class PrettyPrintWriter {
 
     private final PrintWriter writer;
-    private final Stack<String> elementStack = new Stack<String>();
+    private final Stack<String> elementStack = new Stack<>();
     private final char[] lineIndenter;
 
     private boolean tagInProgress;
@@ -153,7 +153,7 @@ public class PrettyPrintWriter {
         } else {
             finishTag();
             writer.write(CLOSE);
-            writer.write((String)elementStack.pop());
+            writer.write(elementStack.pop());
             writer.write('>');
         }
         readyForNewLine = true;

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptor.java
index 01e8a41..ddc8bbb 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptor.java
@@ -21,17 +21,17 @@
 
 package org.apache.struts2.interceptor.validation;
 
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.AnnotationUtils;
 import com.opensymphony.xwork2.validator.ValidationInterceptor;
-
+import org.apache.commons.lang3.BooleanUtils;
 import org.apache.struts2.StrutsConstants;
 
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collection;
+
 /**
  * Extends the xwork validation interceptor to also check for a @SkipValidation
  * annotation, and if found, don't validate this action method
@@ -45,7 +45,7 @@ public class AnnotationValidationInterceptor extends ValidationInterceptor {
 
     @Inject(StrutsConstants.STRUTS_DEVMODE)
     public void setDevMode(String devMode) {
-        this.devMode = "true".equalsIgnoreCase(devMode);
+        this.devMode = BooleanUtils.toBoolean(devMode);
     }
 
     protected String doIntercept(ActionInvocation invocation) throws Exception {
@@ -79,13 +79,14 @@ public class AnnotationValidationInterceptor extends ValidationInterceptor {
     // FIXME: This is copied from DefaultActionInvocation but should be exposed through the interface
     protected Method getActionMethod(Class actionClass, String methodName) throws NoSuchMethodException {
         Method method = null;
+        Class[] classes = new Class[0];
         try {
-            method = actionClass.getMethod(methodName, new Class[0]);
+            method = actionClass.getMethod(methodName, classes);
         } catch (NoSuchMethodException e) {
             // hmm -- OK, try doXxx instead
             try {
                 String altMethodName = "do" + methodName.substring(0, 1).toUpperCase() + methodName.substring(1);
-                method = actionClass.getMethod(altMethodName, new Class[0]);
+                method = actionClass.getMethod(altMethodName, classes);
             } catch (NoSuchMethodException e1) {
                 // throw the original one
                 if (devMode) {

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/util/FastByteArrayOutputStream.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/util/FastByteArrayOutputStream.java b/core/src/main/java/org/apache/struts2/util/FastByteArrayOutputStream.java
index eb07fb1..00fb12f 100644
--- a/core/src/main/java/org/apache/struts2/util/FastByteArrayOutputStream.java
+++ b/core/src/main/java/org/apache/struts2/util/FastByteArrayOutputStream.java
@@ -23,14 +23,13 @@ package org.apache.struts2.util;
 
 import javax.servlet.jsp.JspWriter;
 import java.io.*;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.nio.charset.CharsetDecoder;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CodingErrorAction;
+import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CoderResult;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CodingErrorAction;
+import java.util.LinkedList;
 
 
 /**
@@ -136,7 +135,7 @@ public class FastByteArrayOutputStream extends OutputStream {
     private void writeToFile() {
         FileOutputStream fileOutputStream = null;
         try {
-            fileOutputStream = new FileOutputStream("/tmp/" + getClass().getName() + System.currentTimeMillis() + ".log");
+            fileOutputStream = new FileOutputStream(File.createTempFile(getClass().getName() + System.currentTimeMillis(), ".log"));
             writeTo(fileOutputStream);
         } catch (IOException e) {
             // Ignore
@@ -219,7 +218,7 @@ public class FastByteArrayOutputStream extends OutputStream {
 
     protected void addBuffer() {
         if (buffers == null) {
-            buffers = new LinkedList<byte[]>();
+            buffers = new LinkedList<>();
         }
         buffers.addLast(buffer);
         buffer = new byte[blockSize];


Mime
View raw message