You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2020/03/30 07:21:22 UTC

[sling-org-apache-sling-feature-launcher] branch master updated: SLING-9298 : Switch to commons.text

This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-launcher.git


The following commit(s) were added to refs/heads/master by this push:
     new 9e01543  SLING-9298 : Switch to commons.text
9e01543 is described below

commit 9e01543207b7e18a3f452f3c17114d95d6110a1a
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Mar 30 09:20:56 2020 +0200

    SLING-9298 : Switch to commons.text
---
 pom.xml                                                    |  8 ++++----
 .../feature/launcher/impl/launchers/FrameworkLauncher.java | 14 +++++++-------
 .../feature/launcher/impl/launchers/FrameworkRunner.java   |  1 -
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8bb35c6..5a039e3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,7 +56,7 @@
                         <outputDirectory>${project.build.directory}/classes</outputDirectory>
                         <overWriteReleases>false</overWriteReleases>
                         <overWriteSnapshots>true</overWriteSnapshots>
-                        <includeArtifactIds>osgi.core,commons-lang,org.apache.sling.feature,org.apache.sling.feature.io,org.apache.sling.commons.johnzon,org.apache.felix.converter,commons-cli,slf4j-api,slf4j-simple</includeArtifactIds>
+                        <includeArtifactIds>osgi.core,commons-text,org.apache.sling.feature,org.apache.sling.feature.io,org.apache.sling.commons.johnzon,org.apache.felix.converter,commons-cli,slf4j-api,slf4j-simple</includeArtifactIds>
                     </configuration>
                 </execution>
             </executions>
@@ -89,9 +89,9 @@
 
     <dependencies>
         <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-            <version>2.6</version>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-text</artifactId>
+            <version>1.8</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkLauncher.java b/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkLauncher.java
index f5668be..197f360 100644
--- a/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkLauncher.java
+++ b/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkLauncher.java
@@ -23,8 +23,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Callable;
 
-import org.apache.commons.lang.text.StrLookup;
-import org.apache.commons.lang.text.StrSubstitutor;
+import org.apache.commons.text.StringSubstitutor;
+import org.apache.commons.text.lookup.StringLookup;
 import org.apache.sling.feature.ArtifactId;
 import org.apache.sling.feature.Feature;
 import org.apache.sling.feature.launcher.spi.Launcher;
@@ -50,15 +50,15 @@ public class FrameworkLauncher implements Launcher {
      */
     @Override
     public int run(final LauncherRunContext context, final ClassLoader cl) throws Exception {
-        StrSubstitutor ss = new StrSubstitutor(new StrLookup() {
+        StringSubstitutor ss = new StringSubstitutor(new StringLookup() {
+
             @Override
-            public String lookup(String key) {
+            public String lookup(final String key) {
                 // Normally if a variable cannot be found, StrSubstitutor will
                 // leave the raw variable in place. We need to replace it with
                 // nothing in that case.
-
-                String val = context.getFrameworkProperties().get(key);
-                return val != null ? val : "";
+                final String value = context.getFrameworkProperties().get(key);
+                return value == null ? "" : value;
             }
         });
         ss.setEnableSubstitutionInVariables(true);
diff --git a/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkRunner.java b/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkRunner.java
index 0f12761..f31a8a2 100644
--- a/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkRunner.java
+++ b/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkRunner.java
@@ -16,7 +16,6 @@
  */
 package org.apache.sling.feature.launcher.impl.launchers;
 
-import java.io.File;
 import java.net.URL;
 import java.util.List;
 import java.util.Map;