struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4915) Replace deprecated commons-lang3 classes
Date Fri, 16 Mar 2018 13:31:01 GMT

    [ https://issues.apache.org/jira/browse/WW-4915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16401894#comment-16401894
] 

ASF GitHub Bot commented on WW-4915:
------------------------------------

lukaszlenart closed pull request #208: WW-4915 Replace deprecated commons-lang3 classes
URL: https://github.com/apache/struts/pull/208
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Skill.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Skill.java
index 3dd5bde49..740644d8b 100644
--- a/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Skill.java
+++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/model/Skill.java
@@ -20,7 +20,7 @@
  */
 package org.apache.struts2.showcase.model;
 
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 
 import java.io.Serializable;
 
diff --git a/core/pom.xml b/core/pom.xml
index 61e6772d7..420b1baa5 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -262,6 +262,10 @@
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-text</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-core</artifactId>
diff --git a/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java b/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
index 81afc3b2e..87b9b7f90 100644
--- a/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
+++ b/core/src/main/java/com/opensymphony/xwork2/DefaultActionProxy.java
@@ -23,7 +23,7 @@
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.profiling.UtilTimerStack;
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
diff --git a/core/src/main/java/com/opensymphony/xwork2/config/providers/EnvsValueSubstitutor.java
b/core/src/main/java/com/opensymphony/xwork2/config/providers/EnvsValueSubstitutor.java
index de53caf52..6aff302a1 100644
--- a/core/src/main/java/com/opensymphony/xwork2/config/providers/EnvsValueSubstitutor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/providers/EnvsValueSubstitutor.java
@@ -18,7 +18,7 @@
  */
 package com.opensymphony.xwork2.config.providers;
 
-import org.apache.commons.lang3.text.StrSubstitutor;
+import org.apache.commons.text.StrSubstitutor;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptor.java
b/core/src/main/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptor.java
index 2c2113b7e..32270de95 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptor.java
@@ -22,7 +22,7 @@
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
 import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 
 import java.util.HashMap;
 import java.util.Map;
diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/RepopulateConversionErrorFieldValidatorSupport.java
b/core/src/main/java/com/opensymphony/xwork2/validator/validators/RepopulateConversionErrorFieldValidatorSupport.java
index 30799215f..e67a39d54 100644
--- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/RepopulateConversionErrorFieldValidatorSupport.java
+++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/RepopulateConversionErrorFieldValidatorSupport.java
@@ -23,7 +23,7 @@
 import com.opensymphony.xwork2.interceptor.PreResultListener;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.validator.ValidationException;
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
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 10e1d1e54..4be202551 100644
--- a/core/src/main/java/org/apache/struts2/components/Property.java
+++ b/core/src/main/java/org/apache/struts2/components/Property.java
@@ -19,7 +19,7 @@
 package org.apache.struts2.components;
 
 import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.struts2.views.annotations.StrutsTag;
@@ -162,15 +162,15 @@ public boolean start(Writer writer) {
     }
 
     private String prepare(String value) {
-    	String result = value;
+        String result = value;
         if (escapeHtml) {
-        	result = StringEscapeUtils.escapeHtml4(result);
+            result = StringEscapeUtils.escapeHtml4(result);
         }
         if (escapeJavaScript) {
-        	result = StringEscapeUtils.escapeEcmaScript(result);
+            result = StringEscapeUtils.escapeEcmaScript(result);
         }
         if (escapeXml) {
-        	result = StringEscapeUtils.escapeXml(result);
+            result = StringEscapeUtils.escapeXml10(result);
         }
         if (escapeCsv) {
             result = StringEscapeUtils.escapeCsv(result);
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 8ce179ff4..498cb425d 100644
--- a/core/src/main/java/org/apache/struts2/components/Text.java
+++ b/core/src/main/java/org/apache/struts2/components/Text.java
@@ -19,7 +19,7 @@
 package org.apache.struts2.components;
 
 import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -225,7 +225,7 @@ private String prepare(String value) {
             result = StringEscapeUtils.escapeEcmaScript(result);
         }
         if (escapeXml) {
-            result = StringEscapeUtils.escapeXml(result);
+            result = StringEscapeUtils.escapeXml10(result);
         }
         if (escapeCsv) {
             result = StringEscapeUtils.escapeCsv(result);
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Parameter.java b/core/src/main/java/org/apache/struts2/dispatcher/Parameter.java
index 16a281d97..b8a227083 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/Parameter.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/Parameter.java
@@ -20,7 +20,7 @@
 
 import java.util.Objects;
 
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
diff --git a/core/src/main/java/org/apache/struts2/util/TextProviderHelper.java b/core/src/main/java/org/apache/struts2/util/TextProviderHelper.java
index 145f6c006..2d08d8f40 100644
--- a/core/src/main/java/org/apache/struts2/util/TextProviderHelper.java
+++ b/core/src/main/java/org/apache/struts2/util/TextProviderHelper.java
@@ -20,7 +20,7 @@
 
 import com.opensymphony.xwork2.TextProvider;
 import com.opensymphony.xwork2.util.ValueStack;
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
diff --git a/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelper.java b/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelper.java
index 5191c2ff8..c27361177 100644
--- a/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelper.java
+++ b/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelper.java
@@ -30,7 +30,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
diff --git a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ActionNamesAction.java
b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ActionNamesAction.java
index 8ba236f05..9b6efbdad 100644
--- a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ActionNamesAction.java
+++ b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ActionNamesAction.java
@@ -21,7 +21,7 @@
 import com.opensymphony.xwork2.ActionSupport;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.inject.Inject;
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.apache.struts2.StrutsConstants;
 
 import java.util.Set;
diff --git a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java
b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java
index 5538cf3a8..51b0d50e5 100644
--- a/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java
+++ b/plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ShowConfigAction.java
@@ -24,7 +24,7 @@
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
 import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 
 import java.beans.PropertyDescriptor;
 import java.util.Set;
diff --git a/plugins/javatemplates/pom.xml b/plugins/javatemplates/pom.xml
index 1dd248a9a..71e9c4596 100644
--- a/plugins/javatemplates/pom.xml
+++ b/plugins/javatemplates/pom.xml
@@ -37,6 +37,10 @@
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-text</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.easymock</groupId>
             <artifactId>easymock</artifactId>
diff --git a/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/Attributes.java
b/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/Attributes.java
index 603cd9341..3a6050702 100644
--- a/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/Attributes.java
+++ b/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/Attributes.java
@@ -18,7 +18,7 @@
  */
 package org.apache.struts2.views.java;
 
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.apache.commons.lang3.StringUtils;
 
 import java.util.LinkedHashMap;
diff --git a/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/XHTMLTagSerializer.java
b/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/XHTMLTagSerializer.java
index ab7203687..00b24ac3b 100644
--- a/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/XHTMLTagSerializer.java
+++ b/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/XHTMLTagSerializer.java
@@ -20,7 +20,7 @@
 
 import org.apache.struts2.components.template.TemplateRenderingContext;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 
 import java.io.IOException;
 import java.io.Writer;
diff --git a/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/CheckboxHandler.java
b/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/CheckboxHandler.java
index 2e6eb37dc..c712ddaeb 100644
--- a/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/CheckboxHandler.java
+++ b/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/CheckboxHandler.java
@@ -21,7 +21,7 @@
 import org.apache.struts2.views.java.Attributes;
 import org.apache.struts2.views.java.TagGenerator;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 
 import java.io.IOException;
 import java.util.Map;
diff --git a/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/CheckboxListHandler.java
b/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/CheckboxListHandler.java
index a4cdb5b90..0937490d5 100644
--- a/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/CheckboxListHandler.java
+++ b/plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/CheckboxListHandler.java
@@ -20,7 +20,7 @@
 
 import com.opensymphony.xwork2.util.ValueStack;
 
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.struts2.util.MakeIterator;
 import org.apache.struts2.views.java.Attributes;
diff --git a/plugins/json/pom.xml b/plugins/json/pom.xml
index c84fdff03..82d4385e7 100644
--- a/plugins/json/pom.xml
+++ b/plugins/json/pom.xml
@@ -59,6 +59,11 @@
             <artifactId>commons-lang3</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-text</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>jsp-api</artifactId>
diff --git a/plugins/json/src/main/java/org/apache/struts2/json/JSONValidationInterceptor.java
b/plugins/json/src/main/java/org/apache/struts2/json/JSONValidationInterceptor.java
index 68113658f..4e5938904 100644
--- a/plugins/json/src/main/java/org/apache/struts2/json/JSONValidationInterceptor.java
+++ b/plugins/json/src/main/java/org/apache/struts2/json/JSONValidationInterceptor.java
@@ -25,7 +25,7 @@
 import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.LogManager;
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
 import org.apache.struts2.ServletActionContext;
 
 import javax.servlet.http.HttpServletRequest;
diff --git a/pom.xml b/pom.xml
index a948f5f21..39997afac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -847,6 +847,11 @@
                 <artifactId>commons-lang3</artifactId>
                 <version>3.6</version>
             </dependency>
+            <dependency>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-text</artifactId>
+                <version>1.2</version>
+            </dependency>
             <dependency>
                 <groupId>commons-digester</groupId>
                 <artifactId>commons-digester</artifactId>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Replace deprecated commons-lang3 classes
> ----------------------------------------
>
>                 Key: WW-4915
>                 URL: https://issues.apache.org/jira/browse/WW-4915
>             Project: Struts 2
>          Issue Type: Improvement
>    Affects Versions: 2.5.14.1
>            Reporter: Aleksandr Mashchenko
>            Assignee: Aleksandr Mashchenko
>            Priority: Major
>             Fix For: 2.6
>
>
> The Apache Commons Community has recently set up the Commons Text component as a home
for algorithms working on strings. For this reason most of the string focused functionality
in Commons Lang has been deprecated and moved to Commons Text. This includes:
>  * All classes in the org.apache.commons.lang3.text and the org.apache.commons.lang3.text.translate
packages
>  * org.apache.commons.lang3.StringEscapeUtils
>  * org.apache.commons.lang3.RandomStringUtils
>  * The methods org.apache.commons.lang3.StringUtils.getJaroWinklerDistance and org.apache.commons.lang3.StringUtils.getLevenshteinDistance
> For more information see the Commons Text website: http://commons.apache.org/text



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message