You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2022/10/16 10:01:19 UTC
[maven-jxr] branch master updated: [JXR-176] - Remove dependency org.apache.commons:commons-lang3
This is an automated email from the ASF dual-hosted git repository.
sjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jxr.git
The following commit(s) were added to refs/heads/master by this push:
new 6e00987 [JXR-176] - Remove dependency org.apache.commons:commons-lang3
6e00987 is described below
commit 6e0098709e4b5e392909638aabfed911b4b2f9a1
Author: Markus Spann <sm...@outlook.de>
AuthorDate: Wed Aug 31 14:33:01 2022 +0200
[JXR-176] - Remove dependency org.apache.commons:commons-lang3
The project depended on commons-lang3 for its StringUtils.replace method only,
which is a null-safe alternative to String.replace.
Review of StringUtils usage shows that affected variables cannot be null. Thus the dependency can be replaced by core Java.
---
maven-jxr/pom.xml | 4 ----
.../java/org/apache/maven/jxr/JavaCodeTransform.java | 18 +++++++-----------
2 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/maven-jxr/pom.xml b/maven-jxr/pom.xml
index 9f183fc..06a921b 100644
--- a/maven-jxr/pom.xml
+++ b/maven-jxr/pom.xml
@@ -92,10 +92,6 @@ under the License.
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
<dependency>
<groupId>junit</groupId>
diff --git a/maven-jxr/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java b/maven-jxr/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java
index af3c133..8b857c9 100644
--- a/maven-jxr/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java
+++ b/maven-jxr/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java
@@ -30,7 +30,6 @@ package org.apache.maven.jxr;
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.apache.commons.lang3.StringUtils;
import org.apache.maven.jxr.pacman.ClassType;
import org.apache.maven.jxr.pacman.FileManager;
import org.apache.maven.jxr.pacman.ImportType;
@@ -573,9 +572,7 @@ public class JavaCodeTransform
{
String uri = ( end + 1 == line.length() ) ? line.substring( start ) : line.substring( start, end );
- line =
- StringUtils.replace( line, uri, "<a href=\"" + uri + "\" target=\"alexandria_uri\">" + uri
- + "</a>" );
+ line = line.replace( uri, "<a href=\"" + uri + "\" target=\"alexandria_uri\">" + uri + "</a>" );
}
}
}
@@ -1159,7 +1156,7 @@ public class JavaCodeTransform
href.append( this.getPackageRoot() );
// now find out how to get to the dest package
- dest = StringUtils.replace( dest, ".*", "" ).replace( '.', '/' );
+ dest = dest.replace( ".*", "" ).replace( '.', '/' );
href.append( dest );
@@ -1259,7 +1256,7 @@ public class JavaCodeTransform
if (pkg.contains(".*"))
{
- pkg = StringUtils.replace( pkg, ".*", "" );
+ pkg = pkg.replace( ".*", "" );
}
else if ( !isPackage )
{
@@ -1292,7 +1289,7 @@ public class JavaCodeTransform
}
}
- pkg = StringUtils.replace( pkg, ";", "" );
+ pkg = pkg.replace( ";", "" );
String pkgHREF = getHREF( pkg );
// if this package is within the PackageManager then you can create an HREF for it.
@@ -1301,14 +1298,13 @@ public class JavaCodeTransform
// Create an HREF for explicit classname imports
if ( classname != null )
{
- line =
- StringUtils.replace( line, classname, "<a href=\"" + pkgHREF + '/' + classname + ".html"
- + "\">" + classname + "</a>" );
+ line = line.replace( classname, "<a href=\"" + pkgHREF + '/' + classname + ".html"
+ + "\">" + classname + "</a>" );
}
// now replace the given package with a href
line =
- StringUtils.replace( line, pkg, "<a href=\"" + pkgHREF + '/' + DirectoryIndexer.INDEX + "\">" + pkg
+ line.replace( pkg, "<a href=\"" + pkgHREF + '/' + DirectoryIndexer.INDEX + "\">" + pkg
+ "</a>" );
}