Oliver Heger
2018-09-27 19:28:25 UTC
Author: ggregory
Date: Thu Sep 27 18:43:37 2018
New Revision: 1842139
URL: http://svn.apache.org/viewvc?rev=1842139&view=rev
[CONFIGURATION-720] Replace use of deprecated Commons Lang string substitution code for Commons Text.
commons/proper/configuration/trunk/pom.xml
commons/proper/configuration/trunk/src/changes/changes.xml
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.java
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ExprLookup.java
Modified: commons/proper/configuration/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/pom.xml?rev=1842139&r1=1842138&r2=1842139&view=diff
==============================================================================
--- commons/proper/configuration/trunk/pom.xml (original)
+++ commons/proper/configuration/trunk/pom.xml Thu Sep 27 18:43:37 2018
@@ -274,6 +274,11 @@
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-text</artifactId>
+ <version>1.4</version>
+ </dependency>
In the site there is a manually maintained page with the dependencies ofDate: Thu Sep 27 18:43:37 2018
New Revision: 1842139
URL: http://svn.apache.org/viewvc?rev=1842139&view=rev
[CONFIGURATION-720] Replace use of deprecated Commons Lang string substitution code for Commons Text.
commons/proper/configuration/trunk/pom.xml
commons/proper/configuration/trunk/src/changes/changes.xml
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.java
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ExprLookup.java
Modified: commons/proper/configuration/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/pom.xml?rev=1842139&r1=1842138&r2=1842139&view=diff
==============================================================================
--- commons/proper/configuration/trunk/pom.xml (original)
+++ commons/proper/configuration/trunk/pom.xml Thu Sep 27 18:43:37 2018
@@ -274,6 +274,11 @@
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-text</artifactId>
+ <version>1.4</version>
+ </dependency>
this project (dependencies.xml). This one should be updated as well for
the new dependency to [text].
Thanks.
Oliver
<dependency>
<groupId>commons-logging</groupId>
Modified: commons/proper/configuration/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/changes/changes.xml?rev=1842139&r1=1842138&r2=1842139&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/changes/changes.xml (original)
+++ commons/proper/configuration/trunk/src/changes/changes.xml Thu Sep 27 18:43:37 2018
@@ -44,6 +44,9 @@
<action dev="oheger" type="add" issue="CONFIGURATION-713" due-to="Lars W">
Configuration properties can now be converted to regular expressions.
</action>
+ <action dev="ggregory" type="update" issue="CONFIGURATION-720">
+ Replace use of deprecated Commons Lang string substitution code for Commons Text.
+ </action>
</release>
<release version="2.3" date="2018-08-04"
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.java?rev=1842139&r1=1842138&r2=1842139&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.java Thu Sep 27 18:43:37 2018
@@ -26,8 +26,8 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
-import org.apache.commons.lang3.text.StrLookup;
-import org.apache.commons.lang3.text.StrSubstitutor;
+import org.apache.commons.text.StringSubstitutor;
+import org.apache.commons.text.lookup.StringLookup;
/**
* <p>
@@ -107,7 +107,7 @@ public class ConfigurationInterpolator
private final List<Lookup> defaultLookups;
/** The helper object performing variable substitution. */
- private final StrSubstitutor substitutor;
+ private final StringSubstitutor substitutor;
/** Stores a parent interpolator objects if the interpolator is nested hierarchically. */
private volatile ConfigurationInterpolator parentInterpolator;
@@ -474,9 +474,9 @@ public class ConfigurationInterpolator
*
*/
- private StrSubstitutor initSubstitutor()
+ private StringSubstitutor initSubstitutor()
{
- return new StrSubstitutor(new StrLookup<Object>()
+ return new StringSubstitutor(new StringLookup()
{
@Override
public String lookup(String key)
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ExprLookup.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ExprLookup.java?rev=1842139&r1=1842138&r2=1842139&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ExprLookup.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ExprLookup.java Thu Sep 27 18:43:37 2018
@@ -18,16 +18,16 @@ package org.apache.commons.configuration
import java.util.ArrayList;
-import org.apache.commons.configuration2.io.ConfigurationLogger;
import org.apache.commons.configuration2.ex.ConfigurationRuntimeException;
+import org.apache.commons.configuration2.io.ConfigurationLogger;
import org.apache.commons.jexl2.Expression;
import org.apache.commons.jexl2.JexlContext;
import org.apache.commons.jexl2.JexlEngine;
import org.apache.commons.jexl2.MapContext;
import org.apache.commons.lang3.ClassUtils;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.text.StrLookup;
-import org.apache.commons.lang3.text.StrSubstitutor;
+import org.apache.commons.text.StringSubstitutor;
+import org.apache.commons.text.lookup.StringLookup;
/**
* Lookup that allows expressions to be evaluated.
@@ -79,7 +79,7 @@ public class ExprLookup implements Looku
private ConfigurationInterpolator interpolator;
/** The StrSubstitutor for performing replace operations. */
- private StrSubstitutor substitutor;
+ private StringSubstitutor substitutor;
/** The logger used by this instance. */
private ConfigurationLogger logger;
@@ -260,7 +260,7 @@ public class ExprLookup implements Looku
}
else
{
- StrLookup<String> variableResolver = new StrLookup<String>()
+ StringLookup variableResolver = new StringLookup()
{
@Override
public String lookup(String key)
@@ -270,8 +270,8 @@ public class ExprLookup implements Looku
}
};
substitutor =
- new StrSubstitutor(variableResolver, prefixMatcher,
- suffixMatcher, StrSubstitutor.DEFAULT_ESCAPE);
+ new StringSubstitutor(variableResolver, prefixMatcher,
+ suffixMatcher, StringSubstitutor.DEFAULT_ESCAPE);
}
}
@@ -334,14 +334,7 @@ public class ExprLookup implements Looku
public Variable getVariable()
{
- if (size() > 0)
- {
- return get(size() - 1);
- }
- else
- {
- return null;
- }
+ return size() > 0 ? get(size() - 1) : null;
}
}
---------------------------------------------------------------------<groupId>commons-logging</groupId>
Modified: commons/proper/configuration/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/changes/changes.xml?rev=1842139&r1=1842138&r2=1842139&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/changes/changes.xml (original)
+++ commons/proper/configuration/trunk/src/changes/changes.xml Thu Sep 27 18:43:37 2018
@@ -44,6 +44,9 @@
<action dev="oheger" type="add" issue="CONFIGURATION-713" due-to="Lars W">
Configuration properties can now be converted to regular expressions.
</action>
+ <action dev="ggregory" type="update" issue="CONFIGURATION-720">
+ Replace use of deprecated Commons Lang string substitution code for Commons Text.
+ </action>
</release>
<release version="2.3" date="2018-08-04"
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.java?rev=1842139&r1=1842138&r2=1842139&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ConfigurationInterpolator.java Thu Sep 27 18:43:37 2018
@@ -26,8 +26,8 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
-import org.apache.commons.lang3.text.StrLookup;
-import org.apache.commons.lang3.text.StrSubstitutor;
+import org.apache.commons.text.StringSubstitutor;
+import org.apache.commons.text.lookup.StringLookup;
/**
* <p>
@@ -107,7 +107,7 @@ public class ConfigurationInterpolator
private final List<Lookup> defaultLookups;
/** The helper object performing variable substitution. */
- private final StrSubstitutor substitutor;
+ private final StringSubstitutor substitutor;
/** Stores a parent interpolator objects if the interpolator is nested hierarchically. */
private volatile ConfigurationInterpolator parentInterpolator;
@@ -474,9 +474,9 @@ public class ConfigurationInterpolator
*
*/
- private StrSubstitutor initSubstitutor()
+ private StringSubstitutor initSubstitutor()
{
- return new StrSubstitutor(new StrLookup<Object>()
+ return new StringSubstitutor(new StringLookup()
{
@Override
public String lookup(String key)
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ExprLookup.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ExprLookup.java?rev=1842139&r1=1842138&r2=1842139&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ExprLookup.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/interpol/ExprLookup.java Thu Sep 27 18:43:37 2018
@@ -18,16 +18,16 @@ package org.apache.commons.configuration
import java.util.ArrayList;
-import org.apache.commons.configuration2.io.ConfigurationLogger;
import org.apache.commons.configuration2.ex.ConfigurationRuntimeException;
+import org.apache.commons.configuration2.io.ConfigurationLogger;
import org.apache.commons.jexl2.Expression;
import org.apache.commons.jexl2.JexlContext;
import org.apache.commons.jexl2.JexlEngine;
import org.apache.commons.jexl2.MapContext;
import org.apache.commons.lang3.ClassUtils;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.text.StrLookup;
-import org.apache.commons.lang3.text.StrSubstitutor;
+import org.apache.commons.text.StringSubstitutor;
+import org.apache.commons.text.lookup.StringLookup;
/**
* Lookup that allows expressions to be evaluated.
@@ -79,7 +79,7 @@ public class ExprLookup implements Looku
private ConfigurationInterpolator interpolator;
/** The StrSubstitutor for performing replace operations. */
- private StrSubstitutor substitutor;
+ private StringSubstitutor substitutor;
/** The logger used by this instance. */
private ConfigurationLogger logger;
@@ -260,7 +260,7 @@ public class ExprLookup implements Looku
}
else
{
- StrLookup<String> variableResolver = new StrLookup<String>()
+ StringLookup variableResolver = new StringLookup()
{
@Override
public String lookup(String key)
@@ -270,8 +270,8 @@ public class ExprLookup implements Looku
}
};
substitutor =
- new StrSubstitutor(variableResolver, prefixMatcher,
- suffixMatcher, StrSubstitutor.DEFAULT_ESCAPE);
+ new StringSubstitutor(variableResolver, prefixMatcher,
+ suffixMatcher, StringSubstitutor.DEFAULT_ESCAPE);
}
}
@@ -334,14 +334,7 @@ public class ExprLookup implements Looku
public Variable getVariable()
{
- if (size() > 0)
- {
- return get(size() - 1);
- }
- else
- {
- return null;
- }
+ return size() > 0 ? get(size() - 1) : null;
}
}
To unsubscribe, e-mail: dev-***@commons.apache.org
For additional commands, e-mail: dev-***@commons.apache.org