[MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String) (#20)
Use this link to re-run the recipe: https://public.moderne.io/recipes/org.openrewrite.java.migrate.apache.commons.lang.IsNotEmptyToJdk?organizationId=QXBhY2hlIE1hdmVu
Co-authored-by: Moderne <team@moderne.io>
diff --git a/src/main/java/org/apache/maven/shared/jar/JarData.java b/src/main/java/org/apache/maven/shared/jar/JarData.java
index 7105548..32cbad8 100644
--- a/src/main/java/org/apache/maven/shared/jar/JarData.java
+++ b/src/main/java/org/apache/maven/shared/jar/JarData.java
@@ -27,7 +27,6 @@
import org.apache.maven.shared.jar.classes.JarClasses;
import org.apache.maven.shared.jar.identification.JarIdentification;
-import org.codehaus.plexus.util.StringUtils;
/**
* Class that contains details of a single JAR file and it's entries.
@@ -90,7 +89,7 @@
boolean aSealed = false;
if (this.manifest != null) {
String sval = this.manifest.getMainAttributes().getValue(Attributes.Name.SEALED);
- if (StringUtils.isNotEmpty(sval)) {
+ if (sval != null && !sval.isEmpty()) {
aSealed = "true".equalsIgnoreCase(sval.trim());
}
}
diff --git a/src/main/java/org/apache/maven/shared/jar/identification/JarIdentificationAnalysis.java b/src/main/java/org/apache/maven/shared/jar/identification/JarIdentificationAnalysis.java
index 20cfca1..dc5480a 100644
--- a/src/main/java/org/apache/maven/shared/jar/identification/JarIdentificationAnalysis.java
+++ b/src/main/java/org/apache/maven/shared/jar/identification/JarIdentificationAnalysis.java
@@ -105,7 +105,7 @@
int size = Integer.MAX_VALUE;
for (String val : list) {
- if (StringUtils.isNotEmpty(val)) {
+ if (val != null && !val.isEmpty()) {
if (val.length() < size) {
smallest = val;
size = val.length();
@@ -120,7 +120,7 @@
String largest = null;
int size = Integer.MIN_VALUE;
for (String val : list) {
- if (StringUtils.isNotEmpty(val)) {
+ if (val != null && !val.isEmpty()) {
if (val.length() > size) {
largest = val;
size = val.length();
diff --git a/src/main/java/org/apache/maven/shared/jar/identification/exposers/TextFileExposer.java b/src/main/java/org/apache/maven/shared/jar/identification/exposers/TextFileExposer.java
index 996f983..3dc2ab6 100644
--- a/src/main/java/org/apache/maven/shared/jar/identification/exposers/TextFileExposer.java
+++ b/src/main/java/org/apache/maven/shared/jar/identification/exposers/TextFileExposer.java
@@ -32,7 +32,6 @@
import org.apache.maven.shared.jar.JarAnalyzer;
import org.apache.maven.shared.jar.identification.JarIdentification;
import org.apache.maven.shared.jar.identification.JarIdentificationExposer;
-import org.codehaus.plexus.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -70,7 +69,7 @@
// TODO: maybe even for groupId entries.
logger.debug(line);
- if (StringUtils.isNotEmpty(line)) {
+ if (line != null && !line.isEmpty()) {
textVersions.add(line);
}
} catch (IOException e) {
diff --git a/src/main/java/org/apache/maven/shared/jar/identification/exposers/TimestampExposer.java b/src/main/java/org/apache/maven/shared/jar/identification/exposers/TimestampExposer.java
index 202d160..d3a549f 100644
--- a/src/main/java/org/apache/maven/shared/jar/identification/exposers/TimestampExposer.java
+++ b/src/main/java/org/apache/maven/shared/jar/identification/exposers/TimestampExposer.java
@@ -32,7 +32,6 @@
import org.apache.maven.shared.jar.JarAnalyzer;
import org.apache.maven.shared.jar.identification.JarIdentification;
import org.apache.maven.shared.jar.identification.JarIdentificationExposer;
-import org.codehaus.plexus.util.StringUtils;
/**
* Exposer that examines a a JAR and uses the most recent timestamp as a potential version.
@@ -61,7 +60,7 @@
}
}
- if (StringUtils.isNotEmpty(ts)) {
+ if (ts != null && !ts.isEmpty()) {
identification.addVersion(ts);
}
}