struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject [5/5] struts git commit: Minor code improvements's in the struts core module
Date Mon, 08 Jun 2015 17:27:23 GMT
Minor code improvements's in the struts core module

- Use Java 7 features like diamond operater and multi catch
- Improve some logging message and don't check LOG.isXxx if not necessary
- Fix some typos
- Imrove some loops and use for each instead of iterator
- 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/e47a1127
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/e47a1127
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/e47a1127

Branch: refs/heads/master
Commit: e47a1127f8c17d6aed1fdccb182c366f2c519b69
Parents: 27bfb22
Author: Johannes Geppert <johgep@gmail.com>
Authored: Mon Jun 8 19:27:05 2015 +0200
Committer: Johannes Geppert <johgep@gmail.com>
Committed: Mon Jun 8 19:27:06 2015 +0200

----------------------------------------------------------------------
 .../java/org/apache/struts2/RequestUtils.java   |  10 +-
 .../struts2/components/ActionComponent.java     |  20 ++--
 .../struts2/components/ActionMessage.java       |   2 +-
 .../org/apache/struts2/components/Anchor.java   |  10 +-
 .../struts2/components/AppendIterator.java      |  19 ++-
 .../org/apache/struts2/components/ComboBox.java |  22 ++--
 .../apache/struts2/components/Component.java    |  27 ++---
 .../components/ComponentUrlProvider.java        |   2 +-
 .../apache/struts2/components/ContextBean.java  |   6 +-
 .../org/apache/struts2/components/Date.java     |  26 ++--
 .../org/apache/struts2/components/Else.java     |   9 +-
 .../org/apache/struts2/components/ElseIf.java   |  15 ++-
 .../apache/struts2/components/FieldError.java   |   2 +-
 .../org/apache/struts2/components/File.java     |  19 ++-
 .../org/apache/struts2/components/Form.java     |  17 +--
 .../org/apache/struts2/components/I18n.java     |  22 ++--
 .../org/apache/struts2/components/Include.java  |  58 ++++-----
 .../struts2/components/InputTransferSelect.java |  31 +++--
 .../struts2/components/IteratorComponent.java   |   6 +-
 .../apache/struts2/components/ListUIBean.java   |  17 +--
 .../struts2/components/MergeIterator.java       |  21 ++--
 .../components/OptionTransferSelect.java        |  21 ++--
 .../org/apache/struts2/components/Param.java    |   3 +-
 .../org/apache/struts2/components/Property.java |   8 +-
 .../struts2/components/ServletUrlRenderer.java  |  20 ++--
 .../org/apache/struts2/components/Text.java     |   6 +-
 .../org/apache/struts2/components/TextArea.java |   9 +-
 .../org/apache/struts2/components/UIBean.java   |  38 +++---
 .../java/org/apache/struts2/components/URL.java |   4 +-
 .../apache/struts2/components/UpDownSelect.java |  26 ++--
 .../apache/struts2/components/UrlRenderer.java  |   5 +-
 .../components/template/BaseTemplateEngine.java |  19 +--
 .../template/FreemarkerTemplateEngine.java      |  44 +++----
 .../components/template/JspTemplateEngine.java  |  21 ++--
 .../struts2/components/template/Template.java   |   2 +-
 .../template/TemplateEngineManager.java         |  20 ++--
 .../template/VelocityTemplateEngine.java        |  28 ++---
 .../config/AbstractBeanSelectionProvider.java   |  11 +-
 .../apache/struts2/config/DefaultSettings.java  |   6 +-
 .../struts2/config/DelegatingSettings.java      |   3 +-
 .../struts2/config/PropertiesSettings.java      |  10 +-
 .../config/StrutsXmlConfigurationProvider.java  |  27 ++---
 .../dispatcher/ActionContextCleanUp.java        |  12 +-
 .../struts2/dispatcher/ApplicationMap.java      |   8 +-
 .../struts2/dispatcher/ContainerHolder.java     |   2 +-
 .../DefaultDispatcherErrorHandler.java          |  19 ++-
 .../dispatcher/DefaultStaticContentLoader.java  |  33 +++--
 .../apache/struts2/dispatcher/Dispatcher.java   |  45 +++----
 .../struts2/dispatcher/FilterDispatcher.java    |  12 +-
 .../struts2/dispatcher/HttpHeaderResult.java    |  10 +-
 .../struts2/dispatcher/PlainTextResult.java     |  15 +--
 .../apache/struts2/dispatcher/RequestMap.java   |   3 +-
 .../dispatcher/ServletDispatcherResult.java     |  10 +-
 .../dispatcher/ServletRedirectResult.java       |  12 +-
 .../apache/struts2/dispatcher/SessionMap.java   |  13 +-
 .../apache/struts2/dispatcher/StreamResult.java |  31 ++---
 .../struts2/dispatcher/StrutsResultSupport.java |  21 ++--
 .../struts2/dispatcher/VelocityResult.java      |   4 +-
 .../mapper/CompositeActionMapper.java           |  51 +++-----
 .../dispatcher/mapper/DefaultActionMapper.java  |  34 +++---
 .../mapper/PrefixBasedActionMapper.java         |  37 +++---
 .../dispatcher/mapper/Restful2ActionMapper.java |   9 +-
 .../dispatcher/mapper/RestfulActionMapper.java  |   4 +-
 .../multipart/JakartaMultiPartRequest.java      |  43 +++----
 .../JakartaStreamMultiPartRequest.java          | 120 ++++++++++---------
 .../dispatcher/multipart/MultiPartRequest.java  |   2 +-
 .../multipart/MultiPartRequestWrapper.java      |  23 +---
 .../struts2/dispatcher/ng/InitOperations.java   |  12 +-
 .../dispatcher/ng/PrepareOperations.java        |   9 +-
 .../ng/filter/StrutsExecuteFilter.java          |  11 +-
 .../impl/PrefixBasedActionProxyFactory.java     |   6 +-
 .../struts2/impl/StrutsObjectFactory.java       |   2 +-
 .../ActionMappingParametersInteceptor.java      |  14 +--
 .../interceptor/CheckboxInterceptor.java        |  10 +-
 .../interceptor/ClearSessionInterceptor.java    |  12 +-
 .../struts2/interceptor/CookieInterceptor.java  |  22 ++--
 .../interceptor/CreateSessionInterceptor.java   |   6 +-
 .../interceptor/DateTextFieldInterceptor.java   |  33 +++--
 .../interceptor/DeprecationInterceptor.java     |   9 +-
 .../interceptor/ExecuteAndWaitInterceptor.java  |  28 ++---
 .../interceptor/FileUploadInterceptor.java      |  25 +---
 .../interceptor/MessageStoreInterceptor.java    |  46 +++----
 .../interceptor/MultiselectInterceptor.java     |   2 +-
 .../ProfilingActivationInterceptor.java         |   8 +-
 .../struts2/interceptor/RolesInterceptor.java   |   6 +-
 .../struts2/interceptor/ScopeInterceptor.java   |  70 ++++-------
 .../struts2/interceptor/TokenInterceptor.java   |   4 +-
 .../debugging/DebuggingInterceptor.java         |  73 +++++------
 .../debugging/ObjectToHTMLWriter.java           |  24 ++--
 .../debugging/PrettyPrintWriter.java            |   4 +-
 .../AnnotationValidationInterceptor.java        |  17 +--
 .../struts2/util/FastByteArrayOutputStream.java |  15 ++-
 .../apache/struts2/util/IteratorGenerator.java  |  12 +-
 .../struts2/util/RegexPatternMatcher.java       |   2 +-
 .../apache/struts2/util/SortIteratorFilter.java |  16 +--
 .../struts2/util/StrutsTestCaseHelper.java      |  12 +-
 .../org/apache/struts2/util/StrutsUtil.java     |  15 +--
 .../apache/struts2/util/TextProviderHelper.java |  12 +-
 .../org/apache/struts2/util/TokenHelper.java    |  31 ++---
 .../views/freemarker/FreemarkerManager.java     |  48 ++------
 .../views/freemarker/ScopesHashModel.java       |   2 +-
 .../jsp/iterator/IteratorGeneratorTag.java      |  11 +-
 .../views/jsp/iterator/SubsetIteratorTag.java   |  15 +--
 .../struts2/views/jsp/ui/AbstractUITag.java     |   2 +-
 .../views/jsp/ui/AbstractUITagBeanInfo.java     |   4 +-
 .../apache/struts2/views/jsp/ui/AnchorTag.java  |  16 +--
 .../struts2/views/util/DefaultUrlHelper.java    |  15 +--
 .../struts2/views/velocity/VelocityManager.java |  43 ++-----
 .../struts2/views/xslt/AbstractAdapterNode.java |  30 ++---
 .../struts2/views/xslt/AdapterFactory.java      |  54 ++++-----
 .../apache/struts2/views/xslt/ArrayAdapter.java |  15 +--
 .../apache/struts2/views/xslt/BeanAdapter.java  |  26 ++--
 .../struts2/views/xslt/CollectionAdapter.java   |  15 +--
 .../apache/struts2/views/xslt/MapAdapter.java   |  11 +-
 .../struts2/views/xslt/ProxyElementAdapter.java |  20 ++--
 .../struts2/views/xslt/ProxyNodeAdapter.java    |  19 +--
 .../struts2/views/xslt/ServletURIResolver.java  |  15 ++-
 .../struts2/views/xslt/SimpleNodeList.java      |  14 +--
 .../struts2/views/xslt/StringAdapter.java       |  19 ++-
 .../apache/struts2/views/xslt/XSLTResult.java   |  34 ++----
 core/src/site/resources/tags/a.html             |   2 +-
 core/src/site/resources/tags/actionmessage.html |   2 +-
 core/src/site/resources/tags/checkboxlist.html  |   4 +-
 core/src/site/resources/tags/combobox.html      |   6 +-
 core/src/site/resources/tags/doubleselect.html  |   4 +-
 .../resources/tags/inputtransferselect.html     |   4 +-
 .../resources/tags/optiontransferselect.html    |   4 +-
 core/src/site/resources/tags/radio.html         |   4 +-
 core/src/site/resources/tags/select.html        |   4 +-
 core/src/site/resources/tags/text.html          |   2 +-
 core/src/site/resources/tags/updownselect.html  |   4 +-
 131 files changed, 912 insertions(+), 1389 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/RequestUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/RequestUtils.java b/core/src/main/java/org/apache/struts2/RequestUtils.java
index a09f879..393459a 100644
--- a/core/src/main/java/org/apache/struts2/RequestUtils.java
+++ b/core/src/main/java/org/apache/struts2/RequestUtils.java
@@ -21,6 +21,7 @@
 
 package org.apache.struts2;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.FastDateFormat;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -69,8 +70,8 @@ public class RequestUtils {
                 servletPath = requestUri.substring(requestUri.indexOf(servletPath));
             }
         }
-        
-        if (null != servletPath && !"".equals(servletPath)) {
+
+        if (StringUtils.isNotEmpty(servletPath)) {
             return servletPath;
         }
         
@@ -92,14 +93,13 @@ public class RequestUtils {
      */
     public static String getUri(HttpServletRequest request) {
         // handle http dispatcher includes.
-        String uri = (String) request
-                .getAttribute("javax.servlet.include.servlet_path");
+        String uri = (String) request.getAttribute("javax.servlet.include.servlet_path");
         if (uri != null) {
             return uri;
         }
 
         uri = getServletPath(request);
-        if (uri != null && !"".equals(uri)) {
+        if (StringUtils.isNotEmpty(uri)) {
             return uri;
         }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/ActionComponent.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/ActionComponent.java b/core/src/main/java/org/apache/struts2/components/ActionComponent.java
index fd58339..5b1196b 100644
--- a/core/src/main/java/org/apache/struts2/components/ActionComponent.java
+++ b/core/src/main/java/org/apache/struts2/components/ActionComponent.java
@@ -28,8 +28,8 @@ import com.opensymphony.xwork2.ActionProxyFactory;
 import com.opensymphony.xwork2.inject.Inject;
 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.ServletActionContext;
 import org.apache.struts2.StrutsException;
 import org.apache.struts2.StrutsStatics;
@@ -47,7 +47,6 @@ import javax.servlet.jsp.PageContext;
 import java.io.IOException;
 import java.io.Writer;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 /**
@@ -164,16 +163,13 @@ public class ActionComponent extends ContextBean {
                 try {
                     writer.flush();
                 } catch (IOException e) {
-                    if (LOG.isWarnEnabled()) {
                 	LOG.warn("error while trying to flush writer ", e);
-                    }
                 }
             }
             executeAction();
 
             if ((getVar() != null) && (proxy != null)) {
-                getStack().setValue("#attr['" + getVar() + "']",
-                        proxy.getAction());
+                getStack().setValue("#attr['" + getVar() + "']", proxy.getAction());
             }
         } finally {
             popComponentStack();
@@ -219,14 +215,14 @@ public class ActionComponent extends ContextBean {
             parentParams = new ActionContext(getStack().getContext()).getParameters();
         }
 
-        Map<String,String[]> newParams = (parentParams != null) 
-            ? new HashMap<String,String[]>(parentParams) 
-            : new HashMap<String,String[]>();
+        Map<String, String[]> newParams = (parentParams != null)
+                ? new HashMap<String, String[]>(parentParams)
+                : new HashMap<String, String[]>();
 
         if (parameters != null) {
-            Map<String,String[]> params = new HashMap<String,String[]>();
-            for (Iterator i = parameters.entrySet().iterator(); i.hasNext(); ) {
-                Map.Entry entry = (Map.Entry) i.next();
+            Map<String, String[]> params = new HashMap<>();
+            for (Object o : parameters.entrySet()) {
+                Map.Entry entry = (Map.Entry) o;
                 String key = (String) entry.getKey();
                 Object val = entry.getValue();
                 if (val.getClass().isArray() && String.class == val.getClass().getComponentType()) {

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/ActionMessage.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/ActionMessage.java b/core/src/main/java/org/apache/struts2/components/ActionMessage.java
index 74ab33b..10ba59f 100644
--- a/core/src/main/java/org/apache/struts2/components/ActionMessage.java
+++ b/core/src/main/java/org/apache/struts2/components/ActionMessage.java
@@ -82,7 +82,7 @@ public class ActionMessage extends UIBean {
         addParameter("escape", escape);
     }
 
-    @StrutsTagAttribute(description=" Whether to escape HTML", type="Boolean", defaultValue="true")
+    @StrutsTagAttribute(description = "Whether to escape HTML", type = "Boolean", defaultValue = "true")
     public void setEscape(boolean escape) {
         this.escape = escape;
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/Anchor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/Anchor.java b/core/src/main/java/org/apache/struts2/components/Anchor.java
index 3d7fdf9..5819294 100644
--- a/core/src/main/java/org/apache/struts2/components/Anchor.java
+++ b/core/src/main/java/org/apache/struts2/components/Anchor.java
@@ -23,19 +23,19 @@ package org.apache.struts2.components;
 
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ValueStack;
-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 org.apache.struts2.StrutsConstants;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
-import org.apache.commons.lang3.StringUtils;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.StringWriter;
 import java.io.Writer;
-import java.util.Map;
 import java.util.LinkedHashMap;
+import java.util.Map;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -48,7 +48,7 @@ import java.util.LinkedHashMap;
  * <p/>
  * <pre>
  * <!-- START SNIPPET: example1 -->
- * &lt;s:a id="link1" theme="ajax" href="/DoIt.action"&gt;
+ * &lt;s:a id="link1" href="/do-it.action"&gt;
  *     &lt;img border="none" src="&lt;%=request.getContextPath()%&gt;/images/delete.gif"/&gt;
  *     &lt;s:param name="id" value="1"/&gt;
  * &lt;/s:a&gt;
@@ -58,7 +58,7 @@ import java.util.LinkedHashMap;
 @StrutsTag(
         name = "a",
         tldTagClass = "org.apache.struts2.views.jsp.ui.AnchorTag",
-        description = "Render a HTML href element that when clicked can optionally call a URL via remote XMLHttpRequest and updates its targets",
+        description = "Render a HTML href element",
         allowDynamicAttributes = true)
 public class Anchor extends ClosingUIBean {
     private static final Logger LOG = LogManager.getLogger(Anchor.class);

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/AppendIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/AppendIterator.java b/core/src/main/java/org/apache/struts2/components/AppendIterator.java
index 6021fe3..eebddad 100644
--- a/core/src/main/java/org/apache/struts2/components/AppendIterator.java
+++ b/core/src/main/java/org/apache/struts2/components/AppendIterator.java
@@ -21,20 +21,19 @@
 
 package org.apache.struts2.components;
 
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
+import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.components.Param.UnnamedParametric;
 import org.apache.struts2.util.AppendIteratorFilter;
 import org.apache.struts2.util.MakeIterator;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
 
-import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -141,9 +140,7 @@ public class AppendIterator extends ContextBean implements UnnamedParametric {
 
             Object iteratorEntryObj = paramEntries.next();
             if (! MakeIterator.isIterable(iteratorEntryObj)) {
-                if (LOG.isWarnEnabled()) {
-                    LOG.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
-                }
+                LOG.warn("param with value resolved as {} cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator", iteratorEntryObj);
                 continue;
             }
             appendIteratorFilter.setSource(MakeIterator.convert(iteratorEntryObj));

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/ComboBox.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/ComboBox.java b/core/src/main/java/org/apache/struts2/components/ComboBox.java
index bde41ba..d7ac8dc 100644
--- a/core/src/main/java/org/apache/struts2/components/ComboBox.java
+++ b/core/src/main/java/org/apache/struts2/components/ComboBox.java
@@ -21,18 +21,16 @@
 
 package org.apache.struts2.components;
 
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.struts2.util.MakeIterator;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
-import org.apache.struts2.util.MakeIterator;
 
-import com.opensymphony.xwork2.util.ValueStack;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -158,7 +156,7 @@ public class ComboBox extends TextField {
                 "Example: people or people.{name}");
     }
 
-    @StrutsTagAttribute(description="Iteratable source to populate from. " +
+    @StrutsTagAttribute(description = "Iterable source to populate from. " +
                 "If this is missing, the select widget is simply not displayed.", required=true)
     public void setList(String list) {
         this.list = list;
@@ -179,12 +177,12 @@ public class ComboBox extends TextField {
         this.headerValue = headerValue;
     }
 
-    @StrutsTagAttribute(description="Set the key used to retrive the option key.")
+    @StrutsTagAttribute(description = "Set the key used to retrieve the option key.")
     public void setListKey(String listKey) {
         this.listKey = listKey;
     }
 
-    @StrutsTagAttribute(description="Set the value used to retrive the option value.")
+    @StrutsTagAttribute(description = "Set the value used to retrieve the option value.")
     public void setListValue(String listValue) {
         this.listValue = listValue;
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/Component.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/Component.java b/core/src/main/java/org/apache/struts2/components/Component.java
index bde06c0..1853ed8 100644
--- a/core/src/main/java/org/apache/struts2/components/Component.java
+++ b/core/src/main/java/org/apache/struts2/components/Component.java
@@ -25,9 +25,10 @@ import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.AnnotationUtils;
 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.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.StrutsConstants;
 import org.apache.struts2.StrutsException;
 import org.apache.struts2.dispatcher.mapper.ActionMapper;
@@ -44,11 +45,7 @@ import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.Writer;
 import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Stack;
+import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
@@ -67,7 +64,7 @@ public class Component {
     /**
      * Caches information about common tag's attributes to reduce scanning for annotation @StrutsTagAttribute
      */
-    protected static ConcurrentMap<Class<?>, Collection<String>> standardAttributesMap = new ConcurrentHashMap<Class<?>, Collection<String>>();
+    protected static ConcurrentMap<Class<?>, Collection<String>> standardAttributesMap = new ConcurrentHashMap<>();
 
     protected boolean devMode = false;
     protected ValueStack stack;
@@ -83,7 +80,7 @@ public class Component {
      */
     public Component(ValueStack stack) {
         this.stack = stack;
-        this.parameters = new LinkedHashMap<String, Object>();
+        this.parameters = new LinkedHashMap<>();
         getComponentStack().push(this);
     }
 
@@ -101,7 +98,7 @@ public class Component {
 
     @Inject(value = StrutsConstants.STRUTS_DEVMODE, required = false)
     public void setDevMode(String devMode) {
-        this.devMode = Boolean.parseBoolean(devMode);
+        this.devMode = BooleanUtils.toBoolean(devMode);
     }
 
     @Inject
@@ -111,7 +108,7 @@ public class Component {
 
     @Inject(StrutsConstants.STRUTS_EL_THROW_EXCEPTION)
     public void setThrowExceptionsOnELFailure(String throwException) {
-        this.throwExceptionOnELFailure = "true".equals(throwException);
+        this.throwExceptionOnELFailure = BooleanUtils.toBoolean(throwException);
     }
 
     @Inject
@@ -133,7 +130,7 @@ public class Component {
     public Stack<Component> getComponentStack() {
         Stack<Component> componentStack = (Stack<Component>) stack.getContext().get(COMPONENT_STACK);
         if (componentStack == null) {
-            componentStack = new Stack<Component>();
+            componentStack = new Stack<>();
             stack.getContext().put(COMPONENT_STACK, componentStack);
         }
         return componentStack;
@@ -230,7 +227,7 @@ public class Component {
      * Evaluates the OGNL stack to find a String value.
      * <p/>
      * If the given expression is <tt>null</tt/> a error is logged and a <code>RuntimeException</code> is thrown
-     * constructed with a messaged based on the given field and errorMsg paramter.
+     * constructed with a messaged based on the given field and errorMsg parameter.
      *
      * @param expr  OGNL expression.
      * @param field   field name used when throwing <code>RuntimeException</code>.
@@ -499,7 +496,7 @@ public class Component {
      * If the provided value is <tt>null</tt> any existing parameter with
      * the given key name is removed.
      * @param key  the key of the new parameter to add.
-     * @param value the value assoicated with the key.
+     * @param value the value associated with the key.
      */
     public void addParameter(String key, Object value) {
         if (key != null) {
@@ -539,7 +536,7 @@ public class Component {
         Collection<String> standardAttributes = standardAttributesMap.get(clz);
         if (standardAttributes == null) {
             Collection<Method> methods = AnnotationUtils.getAnnotatedMethods(clz, StrutsTagAttribute.class);
-            standardAttributes = new HashSet<String>(methods.size());
+            standardAttributes = new HashSet<>(methods.size());
             for(Method m : methods) {
                 standardAttributes.add(StringUtils.uncapitalize(m.getName().substring(3)));
             }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/ComponentUrlProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/ComponentUrlProvider.java b/core/src/main/java/org/apache/struts2/components/ComponentUrlProvider.java
index bcb58e4..4a5c88c 100644
--- a/core/src/main/java/org/apache/struts2/components/ComponentUrlProvider.java
+++ b/core/src/main/java/org/apache/struts2/components/ComponentUrlProvider.java
@@ -56,7 +56,7 @@ public class ComponentUrlProvider implements UrlProvider {
 
     /**
      *
-     * @param component The component used to delagete some calls to
+     * @param component The component used to delegate some calls to
      * @param parameters parameters passed from <param...>
      */
     public ComponentUrlProvider(Component component, Map parameters) {

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/ContextBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/ContextBean.java b/core/src/main/java/org/apache/struts2/components/ContextBean.java
index 57a4431..6ef8b74 100644
--- a/core/src/main/java/org/apache/struts2/components/ContextBean.java
+++ b/core/src/main/java/org/apache/struts2/components/ContextBean.java
@@ -21,9 +21,9 @@
 
 package org.apache.struts2.components;
 
-import org.apache.struts2.views.annotations.StrutsTagAttribute;
-
 import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.struts2.views.annotations.StrutsTagAttribute;
 
 /**
  * Base class for control and data tags
@@ -36,7 +36,7 @@ public abstract class ContextBean extends Component {
     }
 
     protected void putInContext(Object value) {
-        if (var != null && var.length() > 0) {
+        if (StringUtils.isNotBlank(var)) {
             stack.getContext().put(var, value);
         }
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/Date.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/Date.java b/core/src/main/java/org/apache/struts2/components/Date.java
index ac61fc7..cedb6af 100644
--- a/core/src/main/java/org/apache/struts2/components/Date.java
+++ b/core/src/main/java/org/apache/struts2/components/Date.java
@@ -24,8 +24,8 @@ package org.apache.struts2.components;
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.TextProvider;
 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.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
 
@@ -35,7 +35,6 @@ import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
-import java.util.Iterator;
 import java.util.List;
 import java.util.TimeZone;
 
@@ -200,10 +199,7 @@ public class Date extends ContextBean {
     }
 
     private TextProvider findProviderInStack() {
-        for (Iterator iterator = getStack().getRoot().iterator(); iterator
-                .hasNext();) {
-            Object o = iterator.next();
-
+        for (Object o : getStack().getRoot()) {
             if (o instanceof TextProvider) {
                 return (TextProvider) o;
             }
@@ -234,31 +230,31 @@ public class Date extends ContextBean {
         int years = days / 365;
 
         if (years > 0) {
-            args.add(Long.valueOf(years));
-            args.add(Long.valueOf(day));
+            args.add(years);
+            args.add(day);
             args.add(sb);
             args.add(null);
             sb.append(tp.getText(DATETAG_PROPERTY_YEARS, DATETAG_DEFAULT_YEARS, args));
         } else if (day > 0) {
-            args.add(Long.valueOf(day));
-            args.add(Long.valueOf(hour));
+            args.add(day);
+            args.add(hour);
             args.add(sb);
             args.add(null);
             sb.append(tp.getText(DATETAG_PROPERTY_DAYS, DATETAG_DEFAULT_DAYS, args));
         } else if (hour > 0) {
-            args.add(Long.valueOf(hour));
-            args.add(Long.valueOf(min));
+            args.add(hour);
+            args.add(min);
             args.add(sb);
             args.add(null);
             sb.append(tp.getText(DATETAG_PROPERTY_HOURS, DATETAG_DEFAULT_HOURS, args));
         } else if (min > 0) {
-            args.add(Long.valueOf(min));
-            args.add(Long.valueOf(sec));
+            args.add(min);
+            args.add(sec);
             args.add(sb);
             args.add(null);
             sb.append(tp.getText(DATETAG_PROPERTY_MINUTES, DATETAG_DEFAULT_MINUTES, args));
         } else {
-            args.add(Long.valueOf(sec));
+            args.add(sec);
             args.add(sb);
             args.add(null);
             sb.append(tp.getText(DATETAG_PROPERTY_SECONDS, DATETAG_DEFAULT_SECONDS, args));

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/Else.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/Else.java b/core/src/main/java/org/apache/struts2/components/Else.java
index b64bcda..4ce124b 100644
--- a/core/src/main/java/org/apache/struts2/components/Else.java
+++ b/core/src/main/java/org/apache/struts2/components/Else.java
@@ -21,12 +21,11 @@
 
 package org.apache.struts2.components;
 
-import java.io.Writer;
-import java.util.Map;
-
+import com.opensymphony.xwork2.util.ValueStack;
 import org.apache.struts2.views.annotations.StrutsTag;
 
-import com.opensymphony.xwork2.util.ValueStack;
+import java.io.Writer;
+import java.util.Map;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -70,6 +69,6 @@ public class Else extends Component {
 
         context.remove(If.ANSWER);
 
-        return !((ifResult == null) || (ifResult.booleanValue()));
+        return !((ifResult == null) || (ifResult));
     }
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/ElseIf.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/ElseIf.java b/core/src/main/java/org/apache/struts2/components/ElseIf.java
index ac28885..215a58e 100644
--- a/core/src/main/java/org/apache/struts2/components/ElseIf.java
+++ b/core/src/main/java/org/apache/struts2/components/ElseIf.java
@@ -21,12 +21,11 @@
 
 package org.apache.struts2.components;
 
-import java.io.Writer;
-
+import com.opensymphony.xwork2.util.ValueStack;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
 
-import com.opensymphony.xwork2.util.ValueStack;
+import java.io.Writer;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -75,27 +74,27 @@ public class ElseIf extends Component {
     public boolean start(Writer writer) {
         Boolean ifResult = (Boolean) stack.getContext().get(If.ANSWER);
 
-        if ((ifResult == null) || (ifResult.booleanValue())) {
+        if ((ifResult == null) || (ifResult)) {
             return false;
         }
 
-        //make the comparision
+        //make the comparison
         answer = (Boolean) findValue(test, Boolean.class);
 
         if (answer == null) {
             answer = Boolean.FALSE;
         }
-        if (answer.booleanValue()) {
+        if (answer) {
             stack.getContext().put(If.ANSWER, answer);
         }
-        return answer.booleanValue();
+        return answer;
     }
 
     public boolean end(Writer writer, String body) {
         if (answer == null) {
             answer = Boolean.FALSE;
         }
-        if (answer.booleanValue()) {
+        if (answer) {
             stack.getContext().put(If.ANSWER, answer);
         }
         return super.end(writer, "");

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/FieldError.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/FieldError.java b/core/src/main/java/org/apache/struts2/components/FieldError.java
index 63fee5f..581ca46 100644
--- a/core/src/main/java/org/apache/struts2/components/FieldError.java
+++ b/core/src/main/java/org/apache/struts2/components/FieldError.java
@@ -91,7 +91,7 @@ import java.util.List;
                 "or partial depending on param tag nested)if they exists")
 public class FieldError extends UIBean implements UnnamedParametric {
 
-    private List<String> errorFieldNames = new ArrayList<String>();
+    private List<String> errorFieldNames = new ArrayList<>();
     private boolean escape = true;
 
     public FieldError(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/File.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/File.java b/core/src/main/java/org/apache/struts2/components/File.java
index 6d86182..d98df90 100644
--- a/core/src/main/java/org/apache/struts2/components/File.java
+++ b/core/src/main/java/org/apache/struts2/components/File.java
@@ -21,15 +21,14 @@
 
 package org.apache.struts2.components;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
 
-import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -75,17 +74,13 @@ public class File extends UIBean {
             String encType = (String) form.getParameters().get("enctype");
             if (!"multipart/form-data".equals(encType)) {
                 // uh oh, this isn't good! Let's warn the developer
-                if (LOG.isWarnEnabled()) {
-                    LOG.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to enctype 'multipart/form-data'. This is probably an error!");
-                }
+                LOG.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to enctype 'multipart/form-data'. This is probably an error!");
             }
 
             String method = (String) form.getParameters().get("method");
             if (!"post".equalsIgnoreCase(method)) {
                 // uh oh, this isn't good! Let's warn the developer
-                if (LOG.isWarnEnabled()) {
-                    LOG.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to method 'POST'. This is probably an error!");
-                }
+                LOG.warn("Struts has detected a file upload UI tag (s:file) being used without a form set to method 'POST'. This is probably an error!");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/Form.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/Form.java b/core/src/main/java/org/apache/struts2/components/Form.java
index e705050..5e85adf 100644
--- a/core/src/main/java/org/apache/struts2/components/Form.java
+++ b/core/src/main/java/org/apache/struts2/components/Form.java
@@ -29,12 +29,7 @@ import com.opensymphony.xwork2.config.entities.InterceptorMapping;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.interceptor.MethodFilterInterceptorUtil;
 import com.opensymphony.xwork2.util.ValueStack;
-import com.opensymphony.xwork2.validator.ActionValidatorManager;
-import com.opensymphony.xwork2.validator.FieldValidator;
-import com.opensymphony.xwork2.validator.ValidationException;
-import com.opensymphony.xwork2.validator.ValidationInterceptor;
-import com.opensymphony.xwork2.validator.Validator;
-import com.opensymphony.xwork2.validator.ValidatorContext;
+import com.opensymphony.xwork2.validator.*;
 import com.opensymphony.xwork2.validator.validators.VisitorFieldValidator;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.struts2.dispatcher.mapper.ActionMapping;
@@ -278,7 +273,7 @@ public class Form extends ClosingUIBean {
         String actionName = mapping.getName();
 
         List<Validator> actionValidators = actionValidatorManager.getValidators(actionClass, actionName);
-        List<Validator> validators = new ArrayList<Validator>();
+        List<Validator> validators = new ArrayList<>();
 
         findFieldValidators(name, actionClass, actionName, actionValidators, validators, "");
 
@@ -286,7 +281,7 @@ public class Form extends ClosingUIBean {
     }
 
     private void findFieldValidators(String name, Class actionClass, String actionName,
-            List<Validator> validatorList, List<Validator> retultValidators, String prefix) {
+                                     List<Validator> validatorList, List<Validator> resultValidators, String prefix) {
 
         for (Validator validator : validatorList) {
             if (validator instanceof FieldValidator) {
@@ -301,14 +296,14 @@ public class Form extends ClosingUIBean {
 
                     List<Validator> visitorValidators = actionValidatorManager.getValidators(clazz, actionName);
                     String vPrefix = prefix + (vfValidator.isAppendPrefix() ? vfValidator.getFieldName() + "." : "");
-                    findFieldValidators(name, clazz, actionName, visitorValidators, retultValidators, vPrefix);
+                    findFieldValidators(name, clazz, actionName, visitorValidators, resultValidators, vPrefix);
                 } else if ((prefix + fieldValidator.getFieldName()).equals(name)) {
                     if (StringUtils.isNotBlank(prefix)) {
                         //fixing field name for js side
                         FieldVisitorValidatorWrapper wrap = new FieldVisitorValidatorWrapper(fieldValidator, prefix);
-                        retultValidators.add(wrap);
+                        resultValidators.add(wrap);
                     } else {
-                        retultValidators.add(fieldValidator);
+                        resultValidators.add(fieldValidator);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/I18n.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/I18n.java b/core/src/main/java/org/apache/struts2/components/I18n.java
index 82d690b..651fd5a 100644
--- a/core/src/main/java/org/apache/struts2/components/I18n.java
+++ b/core/src/main/java/org/apache/struts2/components/I18n.java
@@ -21,24 +21,23 @@
 
 package org.apache.struts2.components;
 
-import java.io.Writer;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import org.apache.struts2.views.annotations.StrutsTag;
-import org.apache.struts2.views.annotations.StrutsTagAttribute;
-import org.apache.struts2.StrutsException;
-
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.LocaleProvider;
-import com.opensymphony.xwork2.TextProviderFactory;
 import com.opensymphony.xwork2.TextProvider;
+import com.opensymphony.xwork2.TextProviderFactory;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
 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.StrutsException;
+import org.apache.struts2.views.annotations.StrutsTag;
+import org.apache.struts2.views.annotations.StrutsTagAttribute;
+
+import java.io.Writer;
+import java.util.Locale;
+import java.util.ResourceBundle;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -129,8 +128,7 @@ public class I18n extends Component {
                 pushed = true;
             }
         } catch (Exception e) {
-            String msg = "Could not find the bundle " + name;
-            throw new StrutsException(msg, e);
+            throw new StrutsException("Could not find the bundle " + name, e);
         }
 
         return result;

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/Include.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/Include.java b/core/src/main/java/org/apache/struts2/components/Include.java
index fbc702f..bcd97a4 100644
--- a/core/src/main/java/org/apache/struts2/components/Include.java
+++ b/core/src/main/java/org/apache/struts2/components/Include.java
@@ -21,17 +21,15 @@
 
 package org.apache.struts2.components;
 
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-import java.util.StringTokenizer;
+import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.struts2.RequestUtils;
+import org.apache.struts2.StrutsConstants;
+import org.apache.struts2.util.FastByteArrayOutputStream;
+import org.apache.struts2.views.annotations.StrutsTag;
+import org.apache.struts2.views.annotations.StrutsTagAttribute;
 
 import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletException;
@@ -40,17 +38,9 @@ import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponseWrapper;
-
-import org.apache.struts2.RequestUtils;
-import org.apache.struts2.StrutsConstants;
-import org.apache.struts2.util.FastByteArrayOutputStream;
-import org.apache.struts2.views.annotations.StrutsTag;
-import org.apache.struts2.views.annotations.StrutsTagAttribute;
-
-import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
+import java.io.*;
+import java.net.URLEncoder;
+import java.util.*;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -135,24 +125,20 @@ public class Include extends Component {
             String concat = "";
 
             // Set parameters
-            Iterator iter = parameters.entrySet().iterator();
-
-            while (iter.hasNext()) {
-                Map.Entry entry = (Map.Entry) iter.next();
+            for (Object next : parameters.entrySet()) {
+                Map.Entry entry = (Map.Entry) next;
                 Object name = entry.getKey();
                 List values = (List) entry.getValue();
 
-                for (int i = 0; i < values.size(); i++) {
+                for (Object value : values) {
                     urlBuf.append(concat);
                     urlBuf.append(name);
                     urlBuf.append('=');
 
                     try {
-                        urlBuf.append(URLEncoder.encode(values.get(i).toString(), "UTF-8"));
-                    } catch (Exception e) {
-                        if (LOG.isWarnEnabled()) {
-                            LOG.warn("unable to url-encode "+values.get(i).toString()+", it will be ignored");
-                        }
+                        urlBuf.append(URLEncoder.encode(value.toString(), "UTF-8"));
+                    } catch (UnsupportedEncodingException e) {
+                        LOG.warn("Unable to url-encode {}, it will be ignored", value);
                     }
 
                     concat = "&";
@@ -165,10 +151,8 @@ public class Include extends Component {
         // Include
         try {
             include(result, writer, req, res, defaultEncoding);
-        } catch (Exception e) {
-            if (LOG.isWarnEnabled()) {
-        	LOG.warn("Exception thrown during include of " + result, e);
-            }
+        } catch (ServletException | IOException e) {
+            LOG.warn("Exception thrown during include of {}", result, e);
         }
 
         return super.end(writer, body);
@@ -199,7 +183,7 @@ public class Include extends Component {
 
         // .. is illegal in an absolute path according to the Servlet Spec and will cause
         // known problems on Orion application servers.
-        if (returnValue.indexOf("..") != -1) {
+        if (returnValue.contains("..")) {
             Stack stack = new Stack();
             StringTokenizer pathParts = new StringTokenizer(returnValue.replace('\\', '/'), "/");
 

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/InputTransferSelect.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/InputTransferSelect.java b/core/src/main/java/org/apache/struts2/components/InputTransferSelect.java
index 0dcf7d0..c137ec8 100644
--- a/core/src/main/java/org/apache/struts2/components/InputTransferSelect.java
+++ b/core/src/main/java/org/apache/struts2/components/InputTransferSelect.java
@@ -21,18 +21,17 @@
 
 package org.apache.struts2.components;
 
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
 
-import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.LinkedHashMap;
+import java.util.Map;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -40,7 +39,7 @@ import org.apache.logging.log4j.LogManager;
  * Create a input transfer select component which is basically an text input
  * and  &lt;select ...&gt; tag with buttons in the middle of them allowing text
  * to be added to the transfer select. Will auto-select all its
- * elements upon its containing form submision.
+ * elements upon its containing form submission.
  *
  * <!-- END SNIPPET: javadoc -->
  *
@@ -113,11 +112,11 @@ public class InputTransferSelect extends ListUIBean {
     public void evaluateExtraParams() {
         super.evaluateExtraParams();
 
-        if (size == null || size.trim().length() <= 0) {
+        if (StringUtils.isBlank(size)) {
             addParameter("size", "5");
         }
 
-        if (multiple == null || multiple.trim().length() <= 0) {
+        if (StringUtils.isBlank(multiple)) {
             addParameter("multiple", Boolean.TRUE);
         }
 
@@ -140,12 +139,12 @@ public class InputTransferSelect extends ListUIBean {
 
 
         // buttonCssClass
-        if (buttonCssClass != null && buttonCssClass.trim().length() > 0) {
+        if (StringUtils.isNotBlank(buttonCssClass)) {
             addParameter("buttonCssClass", buttonCssClass);
         }
 
         // buttonCssStyle
-        if (buttonCssStyle != null && buttonCssStyle.trim().length() > 0) {
+        if (StringUtils.isNotBlank(buttonCssStyle)) {
             addParameter("buttonCssStyle", buttonCssStyle);
         }
 
@@ -174,11 +173,11 @@ public class InputTransferSelect extends ListUIBean {
 
 
         // inform the form component our select tag infos, so they know how to select
-        // its elements upon onsubmit
+        // its elements upon onSubmit
         Form formAncestor = (Form) findAncestor(Form.class);
         if (formAncestor != null) {
 
-            // inform ancestor form that we are having a customOnsubmit (see form-close.ftl [simple theme])
+            // inform ancestor form that we are having a customOnSubmit (see form-close.ftl [simple theme])
             enableAncestorFormCustomOnsubmit();
 
 

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/IteratorComponent.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/IteratorComponent.java b/core/src/main/java/org/apache/struts2/components/IteratorComponent.java
index 45a8ee1..9ca073d 100644
--- a/core/src/main/java/org/apache/struts2/components/IteratorComponent.java
+++ b/core/src/main/java/org/apache/struts2/components/IteratorComponent.java
@@ -22,8 +22,8 @@
 package org.apache.struts2.components;
 
 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.util.MakeIterator;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
@@ -276,7 +276,7 @@ public class IteratorComponent extends ContextBean {
             if (iterator == null) {
                 //classic for loop from 'begin' to 'end'
                 iterator = new CounterIterator(begin, end, step, null);
-            } else if (iterator != null) {
+            } else {
                 //only arrays and lists are supported
                 if (iteratorTarget.getClass().isArray()) {
                     Object[] values = (Object[]) iteratorTarget;
@@ -304,8 +304,6 @@ public class IteratorComponent extends ContextBean {
             String var = getVar();
 
             if ((var != null) && (currentValue != null)) {
-                //pageContext.setAttribute(id, currentValue);
-                //pageContext.setAttribute(id, currentValue, PageContext.REQUEST_SCOPE);
                 putInContext(currentValue);
             }
 

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/ListUIBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/ListUIBean.java b/core/src/main/java/org/apache/struts2/components/ListUIBean.java
index 1adfc2e..cd11326 100644
--- a/core/src/main/java/org/apache/struts2/components/ListUIBean.java
+++ b/core/src/main/java/org/apache/struts2/components/ListUIBean.java
@@ -22,6 +22,7 @@
 package org.apache.struts2.components;
 
 import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.struts2.util.ContainUtil;
 import org.apache.struts2.util.MakeIterator;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
@@ -96,11 +97,11 @@ public abstract class ListUIBean extends UIBean {
         }
 
         if (value instanceof Collection) {
-            addParameter("listSize", Integer.valueOf(((Collection) value).size()));
+            addParameter("listSize", ((Collection) value).size());
         } else if (value instanceof Map) {
-            addParameter("listSize", Integer.valueOf(((Map) value).size()));
+            addParameter("listSize", ((Map) value).size());
         } else if (value != null && value.getClass().isArray()) {
-            addParameter("listSize", Integer.valueOf(Array.getLength(value)));
+            addParameter("listSize", Array.getLength(value));
         }
 
         if (listKey != null) {
@@ -127,15 +128,15 @@ public abstract class ListUIBean extends UIBean {
             addParameter("listLabelKey", listLabelKey);
         }
 
-        if (listCssClass != null && listCssClass.trim().length() > 0) {
+        if (StringUtils.isNotBlank(listCssClass)) {
             addParameter("listCssClass", listCssClass);
         }
 
-        if (listCssStyle != null && listCssStyle.trim().length() > 0) {
+        if (StringUtils.isNotBlank(listCssStyle)) {
             addParameter("listCssStyle", listCssStyle);
         }
 
-        if (listTitle != null && listTitle.trim().length() > 0) {
+        if (StringUtils.isNotBlank(listTitle)) {
             addParameter("listTitle", listTitle);
         }
     }
@@ -154,12 +155,12 @@ public abstract class ListUIBean extends UIBean {
         this.list = list;
     }
 
-    @StrutsTagAttribute(description = " Property of list objects to get field value from")
+    @StrutsTagAttribute(description = "Property of list objects to get field value from")
     public void setListKey(String listKey) {
         this.listKey = listKey;
     }
 
-    @StrutsTagAttribute(description = " Property of list objects to get field value label from")
+    @StrutsTagAttribute(description = "Property of list objects to get field value label from")
     public void setListValueKey(String listValueKey) {
         this.listValueKey = listValueKey;
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/MergeIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/MergeIterator.java b/core/src/main/java/org/apache/struts2/components/MergeIterator.java
index f4aa31b..52f40ef 100644
--- a/core/src/main/java/org/apache/struts2/components/MergeIterator.java
+++ b/core/src/main/java/org/apache/struts2/components/MergeIterator.java
@@ -21,20 +21,18 @@
 
 package org.apache.struts2.components;
 
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
+import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.components.Param.UnnamedParametric;
 import org.apache.struts2.util.MakeIterator;
 import org.apache.struts2.util.MergeIteratorFilter;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
 
-import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -152,12 +150,9 @@ public class MergeIterator extends ContextBean implements UnnamedParametric {
 
     public boolean end(Writer writer, String body) {
 
-        for (Iterator parametersIterator = _parameters.iterator(); parametersIterator.hasNext(); ) {
-            Object iteratorEntryObj = parametersIterator.next();
+        for (Object iteratorEntryObj : _parameters) {
             if (! MakeIterator.isIterable(iteratorEntryObj)) {
-                if (LOG.isWarnEnabled()) {
-                    LOG.warn("param with value resolved as "+iteratorEntryObj+" cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
-                }
+                LOG.warn("param with value resolved as {} cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator", iteratorEntryObj);
                 continue;
             }
             mergeIteratorFilter.setSource(MakeIterator.convert(iteratorEntryObj));

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java b/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java
index 68a3f2b..c704817 100644
--- a/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java
+++ b/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java
@@ -22,8 +22,9 @@
 package org.apache.struts2.components;
 
 import com.opensymphony.xwork2.util.ValueStack;
-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 org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
 
@@ -150,35 +151,29 @@ public class OptionTransferSelect extends DoubleListUIBean {
             doubleValue = findValue(doubleList);
             addParameter("doubleList", doubleValue);
         }
-        if (size == null || size.trim().length() <= 0) {
+        if (StringUtils.isBlank(size)) {
             addParameter("size", "15");
         }
-        if (doubleSize == null || doubleSize.trim().length() <= 0) {
+        if (StringUtils.isBlank(doubleSize)) {
             addParameter("doubleSize", "15");
         }
-        if (multiple == null || multiple.trim().length() <= 0) {
+        if (StringUtils.isBlank(multiple)) {
             addParameter("multiple", Boolean.TRUE);
         }
-        if (doubleMultiple == null || doubleMultiple.trim().length() <= 0) {
+        if (StringUtils.isBlank(doubleMultiple)) {
             addParameter("doubleMultiple", Boolean.TRUE);
         }
 
-
-
-
-
         // buttonCssClass
-        if (buttonCssClass != null && buttonCssClass.trim().length() > 0) {
+        if (StringUtils.isNotBlank(buttonCssClass)) {
             addParameter("buttonCssClass", buttonCssClass);
         }
 
         // buttonCssStyle
-        if (buttonCssStyle != null && buttonCssStyle.trim().length() > 0) {
+        if (StringUtils.isNotBlank(buttonCssStyle)) {
             addParameter("buttonCssStyle", buttonCssStyle);
         }
 
-
-
         // allowSelectAll
         addParameter("allowSelectAll",
                 allowSelectAll != null ? findValue(allowSelectAll, Boolean.class) : Boolean.TRUE);

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/Param.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/Param.java b/core/src/main/java/org/apache/struts2/components/Param.java
index dd3e3c3..09178b4 100644
--- a/core/src/main/java/org/apache/struts2/components/Param.java
+++ b/core/src/main/java/org/apache/struts2/components/Param.java
@@ -22,6 +22,7 @@
 package org.apache.struts2.components;
 
 import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.struts2.StrutsException;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
@@ -126,7 +127,7 @@ public class Param extends Component {
 
                 Object value = findValue(this.value);
                 if (suppressEmptyParameters) {
-                    if (value != null && !value.toString().isEmpty()) {
+                    if (value != null && StringUtils.isNotBlank(value.toString())) {
                         component.addParameter(name, value);
                     }
                 } else {

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/Property.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/Property.java b/core/src/main/java/org/apache/struts2/components/Property.java
index 5019b55..e0961a9 100644
--- a/core/src/main/java/org/apache/struts2/components/Property.java
+++ b/core/src/main/java/org/apache/struts2/components/Property.java
@@ -22,9 +22,9 @@
 package org.apache.struts2.components;
 
 import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
 import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
 
@@ -165,9 +165,7 @@ public class Property extends Component {
                 writer.write(prepare(defaultValue));
             }
         } catch (IOException e) {
-            if (LOG.isInfoEnabled()) {
-        	LOG.info("Could not print out value '" + value + "'", e);
-            }
+            LOG.info("Could not print out value '{}'", value, e);
         }
 
         return result;

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java b/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
index 4216ddb..5b63cd4 100644
--- a/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
+++ b/core/src/main/java/org/apache/struts2/components/ServletUrlRenderer.java
@@ -26,9 +26,9 @@ import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.StrutsException;
 import org.apache.struts2.dispatcher.mapper.ActionMapper;
 import org.apache.struts2.dispatcher.mapper.ActionMapping;
@@ -201,7 +201,7 @@ public class ServletUrlRenderer implements UrlRenderer {
             // Warn user that the specified namespace/action combo
             // was not found in the configuration.
             if (namespace != null && LOG.isWarnEnabled()) {
-                LOG.warn("No configuration found for the specified action: '" + actionName + "' in namespace: '" + namespace + "'. Form action defaulting to 'action' attribute's literal value.");
+                LOG.warn("No configuration found for the specified action: '{}' in namespace: '{}'. Form action defaulting to 'action' attribute's literal value.", actionName, namespace);
             }
 
             String result = urlHelper.buildUrl(action, formComponent.request, formComponent.response, null, scheme, formComponent.includeContext, true);
@@ -264,17 +264,11 @@ public class ServletUrlRenderer implements UrlRenderer {
                 includeGetParameters(urlComponent);
                 includeExtraParameters(urlComponent);
             } else if (includeParams != null) {
-                if (LOG.isWarnEnabled()) {
-                    LOG.warn("Unknown value for includeParams parameter to URL tag: " + includeParams);
-                }
+                LOG.warn("Unknown value for includeParams parameter to URL tag: {}", includeParams);
             }
         } catch (Exception e) {
-            if (LOG.isWarnEnabled()) {
-                LOG.warn("Unable to put request parameters (" + urlComponent.getHttpServletRequest().getQueryString() + ") into parameter map.", e);
-            }
+            LOG.warn("Unable to put request parameters ({}) into parameter map.", urlComponent.getHttpServletRequest().getQueryString(), e);
         }
-
-
     }
 
     private void includeExtraParameters(UrlProvider urlComponent) {
@@ -324,13 +318,13 @@ public class ServletUrlRenderer implements UrlRenderer {
      */
     protected void mergeRequestParameters(String value, Map<String, Object> parameters, Map<String, Object> contextParameters) {
 
-        Map<String, Object> mergedParams = new LinkedHashMap<String, Object>(contextParameters);
+        Map<String, Object> mergedParams = new LinkedHashMap<>(contextParameters);
 
         // Merge contextParameters (from current request) with parameters specified in value attribute
         // eg. value="someAction.action?id=someId&venue=someVenue"
         // where the parameters specified in value attribute takes priority.
 
-        if (value != null && value.trim().length() > 0 && value.indexOf("?") > 0) {
+        if (StringUtils.contains(value, "?")) {
             String queryString = value.substring(value.indexOf("?") + 1);
 
             mergedParams = urlHelper.parseQueryString(queryString, false);

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/Text.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/Text.java b/core/src/main/java/org/apache/struts2/components/Text.java
index 6ec0b39..a26a2dd 100644
--- a/core/src/main/java/org/apache/struts2/components/Text.java
+++ b/core/src/main/java/org/apache/struts2/components/Text.java
@@ -22,9 +22,9 @@
 package org.apache.struts2.components;
 
 import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.util.TextProviderHelper;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
@@ -130,7 +130,7 @@ public class Text extends ContextBean implements Param.UnnamedParametric {
         super(stack);
     }
 
-    @StrutsTagAttribute(description=" Name of resource property to fetch", required=true)
+    @StrutsTagAttribute(description = "Name of resource property to fetch", required = true)
     public void setName(String name) {
         this.name = name;
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/TextArea.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/TextArea.java b/core/src/main/java/org/apache/struts2/components/TextArea.java
index 7831f5e..6e27687 100644
--- a/core/src/main/java/org/apache/struts2/components/TextArea.java
+++ b/core/src/main/java/org/apache/struts2/components/TextArea.java
@@ -21,13 +21,12 @@
 
 package org.apache.struts2.components;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import com.opensymphony.xwork2.util.ValueStack;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
 
-import com.opensymphony.xwork2.util.ValueStack;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -42,8 +41,6 @@ import com.opensymphony.xwork2.util.ValueStack;
  * <!-- END SNIPPET: example -->
  * </pre>
  *
- * @see TabbedPanel
- *
  */
 @StrutsTag(
     name="textarea",

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/UIBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/UIBean.java b/core/src/main/java/org/apache/struts2/components/UIBean.java
index 4f015e9..d30322a 100644
--- a/core/src/main/java/org/apache/struts2/components/UIBean.java
+++ b/core/src/main/java/org/apache/struts2/components/UIBean.java
@@ -24,8 +24,9 @@ package org.apache.struts2.components;
 import com.opensymphony.xwork2.config.ConfigurationException;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ValueStack;
-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 org.apache.struts2.StrutsConstants;
 import org.apache.struts2.StrutsException;
 import org.apache.struts2.components.template.Template;
@@ -504,7 +505,7 @@ public abstract class UIBean extends Component {
     protected String tooltipIconPath;
 
     // dynamic attributes
-    protected Map<String,Object> dynamicAttributes = new HashMap<String,Object>();
+    protected Map<String, Object> dynamicAttributes = new HashMap<>();
 
     protected String defaultTemplateDir;
     protected String defaultUITheme;
@@ -576,9 +577,7 @@ public abstract class UIBean extends Component {
             throw new ConfigurationException("Unable to find a TemplateEngine for template " + template);
         }
 
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Rendering template " + template);
-        }
+        LOG.debug("Rendering template {}", template);
 
         final TemplateRenderingContext context = new TemplateRenderingContext(template, writer, getStack(), getParameters(), this);
         engine.renderTemplate(context);
@@ -593,17 +592,17 @@ public abstract class UIBean extends Component {
 
         // If templateDir is not explicitly given,
         // try to find attribute which states the dir set to use
-        if ((templateDir == null) || (templateDir.equals(""))) {
+        if (StringUtils.isBlank(templateDir)) {
             templateDir = stack.findString("#attr.templateDir");
         }
 
         // Default template set
-        if ((templateDir == null) || (templateDir.equals(""))) {
+        if (StringUtils.isBlank(templateDir)) {
             templateDir = defaultTemplateDir;
         }
 
         // Defaults to 'template'
-        if ((templateDir == null) || (templateDir.equals(""))) {
+        if (StringUtils.isBlank(templateDir)) {
             templateDir = "template";
         }
 
@@ -617,7 +616,7 @@ public abstract class UIBean extends Component {
             theme = findString(this.theme);
         }
 
-        if ( theme == null || theme.equals("") ) {
+        if (StringUtils.isBlank(theme)) {
             Form form = (Form) findAncestor(Form.class);
             if (form != null) {
                 theme = form.getTheme();
@@ -626,12 +625,12 @@ public abstract class UIBean extends Component {
 
         // If theme set is not explicitly given,
         // try to find attribute which states the theme set to use
-        if ((theme == null) || (theme.equals(""))) {
+        if (StringUtils.isBlank(theme)) {
             theme = stack.findString("#attr.theme");
         }
 
         // Default theme set
-        if ((theme == null) || (theme.equals(""))) {
+        if (StringUtils.isBlank(theme)) {
             theme = defaultUITheme;
         }
 
@@ -662,7 +661,6 @@ public abstract class UIBean extends Component {
                 // lookup the label from a TextProvider (default value is the key)
                 providedLabel = TextProviderHelper.getText(key, key, stack);
             }
-
         }
 
         if (this.name != null) {
@@ -841,7 +839,7 @@ public abstract class UIBean extends Component {
             if (form != null) { // inform the containing form that we need tooltip javascript included
                 form.addParameter("hasTooltip", Boolean.TRUE);
 
-                // tooltipConfig defined in component itseilf will take precedence
+                // tooltipConfig defined in component itself will take precedence
                 // over those defined in the containing form
                 Map overallTooltipConfigMap = getTooltipConfig(form);
                 overallTooltipConfigMap.putAll(tooltipConfigMap); // override parent form's tooltip config
@@ -852,9 +850,7 @@ public abstract class UIBean extends Component {
                 }
             }
             else {
-                if (LOG.isWarnEnabled()) {
-                    LOG.warn("No ancestor Form found, javascript based tooltip will not work, however standard HTML tooltip using alt and title attribute will still work ");
-                }
+                LOG.warn("No ancestor Form found, javascript based tooltip will not work, however standard HTML tooltip using alt and title attribute will still work");
             }
 
             //TODO: this is to keep backward compatibility, remove once when tooltipConfig is dropped
@@ -886,8 +882,6 @@ public abstract class UIBean extends Component {
                 if (this.tooltipCssClass != null)
                     this.addParameter("tooltipCssClass", findString(this.tooltipCssClass));
             }
-
-
         }
 
         evaluateExtraParams();
@@ -947,14 +941,14 @@ public abstract class UIBean extends Component {
 
     protected Map getTooltipConfig(UIBean component) {
         Object tooltipConfigObj = component.getParameters().get("tooltipConfig");
-        Map<String, String> tooltipConfig = new LinkedHashMap<String, String>();
+        Map<String, String> tooltipConfig = new LinkedHashMap<>();
 
         if (tooltipConfigObj instanceof Map) {
             // we get this if its configured using
             // 1] UI component's tooltipConfig attribute  OR
             // 2] <param name="tooltip" value="" /> param tag value attribute
 
-            tooltipConfig = new LinkedHashMap<String, String>((Map)tooltipConfigObj);
+            tooltipConfig = new LinkedHashMap<>((Map) tooltipConfigObj);
         } else if (tooltipConfigObj instanceof String) {
 
             // we get this if its configured using
@@ -970,9 +964,7 @@ public abstract class UIBean extends Component {
                     value = configEntry[1].trim();
                     tooltipConfig.put(key, value);
                 } else {
-                    if (LOG.isWarnEnabled()) {
-                        LOG.warn("component " + component + " tooltip config param " + key + " has no value defined, skipped");
-                    }
+                    LOG.warn("component {} tooltip config param {} has no value defined, skipped", component, key);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/URL.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/URL.java b/core/src/main/java/org/apache/struts2/components/URL.java
index a163acb..a8eed35 100644
--- a/core/src/main/java/org/apache/struts2/components/URL.java
+++ b/core/src/main/java/org/apache/struts2/components/URL.java
@@ -23,8 +23,6 @@ package org.apache.struts2.components;
 
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
@@ -110,7 +108,7 @@ import java.io.Writer;
  */
 @StrutsTag(name="url", tldTagClass="org.apache.struts2.views.jsp.URLTag", description="This tag is used to create a URL")
 public class URL extends ContextBean {
-    private static final Logger LOG = LogManager.getLogger(URL.class);
+
     private UrlProvider urlProvider;
     private UrlRenderer urlRenderer;
 

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/UpDownSelect.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/UpDownSelect.java b/core/src/main/java/org/apache/struts2/components/UpDownSelect.java
index c2a2694..150c5b5 100644
--- a/core/src/main/java/org/apache/struts2/components/UpDownSelect.java
+++ b/core/src/main/java/org/apache/struts2/components/UpDownSelect.java
@@ -21,18 +21,17 @@
 
 package org.apache.struts2.components;
 
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.struts2.views.annotations.StrutsTag;
 import org.apache.struts2.views.annotations.StrutsTagAttribute;
 
-import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.LinkedHashMap;
+import java.util.Map;
 
 /**
  * <!-- START SNIPPET: javadoc -->
@@ -109,15 +108,13 @@ public class UpDownSelect extends Select {
 
 
         // override Select's default
-        if (size == null || size.trim().length() <= 0) {
+        if (StringUtils.isBlank(size)) {
             addParameter("size", "5");
         }
-        if (multiple == null || multiple.trim().length() <= 0) {
+        if (StringUtils.isBlank(multiple)) {
             addParameter("multiple", Boolean.TRUE);
         }
 
-
-
         if (allowMoveUp != null) {
             addParameter("allowMoveUp", findValue(allowMoveUp, Boolean.class));
         }
@@ -138,13 +135,12 @@ public class UpDownSelect extends Select {
             addParameter("selectAllLabel", findString(selectAllLabel));
         }
 
-
         // inform our form ancestor about this UpDownSelect so the form knows how to
         // auto select all options upon it submission
         Form ancestorForm = (Form) findAncestor(Form.class);
         if (ancestorForm != null) {
 
-            // inform form ancestor that we are using a custom onsubmit
+            // inform form ancestor that we are using a custom onSubmit
             enableAncestorFormCustomOnsubmit();
 
             Map m = (Map) ancestorForm.getParameters().get("updownselectIds");

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/UrlRenderer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/UrlRenderer.java b/core/src/main/java/org/apache/struts2/components/UrlRenderer.java
index faa71cc..a9de852 100644
--- a/core/src/main/java/org/apache/struts2/components/UrlRenderer.java
+++ b/core/src/main/java/org/apache/struts2/components/UrlRenderer.java
@@ -22,6 +22,7 @@
 package org.apache.struts2.components;
 
 import org.apache.struts2.dispatcher.mapper.ActionMapper;
+
 import java.io.Writer;
 
 /**
@@ -33,14 +34,14 @@ public interface UrlRenderer {
 	
 	/**
 	 * Preprocessing step
-	 * @param urlComponent
+	 * @param provider
 	 */
 	void beforeRenderUrl(UrlProvider provider);
 	
 	/**
 	 * Render a URL.
 	 * @param writer A writer that the implementation can use to write the result to.
-	 * @param urlComponent The {@link UrlProvider} component that "owns" this renderer.
+	 * @param provider The {@link UrlProvider} component that "owns" this renderer.
 	 */
 	void renderUrl(Writer writer, UrlProvider provider);
 	

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java b/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java
index 097d09c..59e5aac 100644
--- a/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java
+++ b/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java
@@ -22,17 +22,12 @@
 package org.apache.struts2.components.template;
 
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
-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.ServletContext;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
+import java.io.*;
 import java.util.Map;
 import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
@@ -49,7 +44,7 @@ public abstract class BaseTemplateEngine implements TemplateEngine {
      */
     public static final String DEFAULT_THEME_PROPERTIES_FILE_NAME = "theme.properties";
 
-    private final Map<String, Properties> themeProps = new ConcurrentHashMap<String, Properties>();
+    private final Map<String, Properties> themeProps = new ConcurrentHashMap<>();
 
     public Map getThemeProps(Template template) {
         Properties props = themeProps.get(template.getTheme());
@@ -109,7 +104,7 @@ public abstract class BaseTemplateEngine implements TemplateEngine {
         try {
             props.load(is);
         } catch (IOException e) {
-            LOG.error("Could not load " + propName, e);
+            LOG.error("Could not load property with name: {}", propName, e);
         } finally {
             tryCloseStream(is);
         }
@@ -119,9 +114,7 @@ public abstract class BaseTemplateEngine implements TemplateEngine {
         try {
             is.close();
         } catch (IOException io) {
-            if (LOG.isWarnEnabled()) {
         	LOG.warn("Unable to close input stream", io);
-            }
         }
     }
 
@@ -137,9 +130,7 @@ public abstract class BaseTemplateEngine implements TemplateEngine {
         try {
             return createFileInputStream(propFile);
         } catch (FileNotFoundException e) {
-            if (LOG.isWarnEnabled()) {
-        	LOG.warn("Unable to find file in filesystem [" + propFile.getAbsolutePath() + "]");
-            }
+            LOG.warn("Unable to find file in filesystem [{}]", propFile.getAbsolutePath());
             return null;
         }
     }

http://git-wip-us.apache.org/repos/asf/struts/blob/e47a1127/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java b/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java
index 478eb53..67a332c 100644
--- a/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java
+++ b/core/src/main/java/org/apache/struts2/components/template/FreemarkerTemplateEngine.java
@@ -21,30 +21,26 @@
 
 package org.apache.struts2.components.template;
 
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Locale;
-import java.util.Map;
-import java.util.List;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.struts2.ServletActionContext;
-import org.apache.struts2.views.freemarker.FreemarkerManager;
-
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
 import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
-
+import freemarker.core.ParseException;
 import freemarker.template.Configuration;
 import freemarker.template.SimpleHash;
-import freemarker.core.ParseException;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.views.freemarker.FreemarkerManager;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.List;
+import java.util.Map;
 
 /**
  * Freemarker based template engine.
@@ -110,11 +106,11 @@ public class FreemarkerTemplateEngine extends BaseTemplateEngine {
 
         if (template == null) {
             if (LOG.isErrorEnabled()) {
-                LOG.error("Could not load the FreeMarker template named '" + templateContext.getTemplate().getName() +"':");
+                LOG.error("Could not load the FreeMarker template named '{}':", templateContext.getTemplate().getName());
                 for (Template t : templates) {
-                    LOG.error("Attempted: " + getFinalTemplateName(t));
+                    LOG.error("Attempted: {}", getFinalTemplateName(t));
                 }
-                LOG.error("The TemplateLoader provided by the FreeMarker Configuration was a: "+config.getTemplateLoader().getClass().getName());
+                LOG.error("The TemplateLoader provided by the FreeMarker Configuration was a: {}", config.getTemplateLoader().getClass().getName());
             }
             if (exception != null) {
                 throw exception;
@@ -123,9 +119,7 @@ public class FreemarkerTemplateEngine extends BaseTemplateEngine {
             }
         }
 
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Rendering template " + templateName);
-        }
+        LOG.debug("Rendering template: {}", templateName);
 
         ActionInvocation ai = ActionContext.getContext().getActionInvocation();
 
@@ -164,6 +158,4 @@ public class FreemarkerTemplateEngine extends BaseTemplateEngine {
     protected String getSuffix() {
         return "ftl";
     }
-
-
-}
+}
\ No newline at end of file


Mime
View raw message