[MNG-6829] Replace any StringUtils#isEmpty(String) and #isNotEmpty(String) (#38)
* [MNG-6829] Replace any StringUtils#isEmpty(String) and #isNotEmpty(String)
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>
* Appease Spotless
* Apply spotless
---------
Co-authored-by: Moderne <team@moderne.io>
diff --git a/src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java b/src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java
index e42e81b..77d2bda 100644
--- a/src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java
+++ b/src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java
@@ -384,13 +384,15 @@
return;
}
- if (StringUtils.isEmpty(encoding)) {
+ if (encoding == null || encoding.isEmpty()) {
getLog().warn("File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
+ ", i.e. build is platform dependent!");
}
if (resolveScopes == null) {
- resolveScopes = new String[] {StringUtils.isEmpty(this.includeScope) ? JavaScopes.TEST : this.includeScope};
+ resolveScopes = new String[] {
+ (this.includeScope == null || this.includeScope.isEmpty()) ? JavaScopes.TEST : this.includeScope
+ };
}
if (supplementalModels == null) {
@@ -804,7 +806,7 @@
String inceptionYear = project.getInceptionYear();
String year = new SimpleDateFormat("yyyy").format((outputDate == null) ? new Date() : outputDate);
- if (StringUtils.isEmpty(inceptionYear)) {
+ if (inceptionYear == null || inceptionYear.isEmpty()) {
if (getLog().isDebugEnabled()) {
getLog().debug("inceptionYear not specified, defaulting to " + year);
}
@@ -849,10 +851,10 @@
String g = s[0];
String a = s[1];
String v = s[2];
- String type = (s.length >= 4 ? s[3] : "jar");
+ String type = s.length >= 4 ? s[3] : "jar";
ArtifactType artifactType =
RepositoryUtils.newArtifactType(type, artifactHandlerManager.getArtifactHandler(type));
- String classifier = (s.length == 5 ? s[4] : artifactType.getClassifier());
+ String classifier = s.length == 5 ? s[4] : artifactType.getClassifier();
DefaultArtifact artifact =
new DefaultArtifact(g, a, classifier, artifactType.getExtension(), v, artifactType);
diff --git a/src/main/java/org/apache/maven/plugin/resources/remote/BundleRemoteResourcesMojo.java b/src/main/java/org/apache/maven/plugin/resources/remote/BundleRemoteResourcesMojo.java
index c5211b6..4007dca 100644
--- a/src/main/java/org/apache/maven/plugin/resources/remote/BundleRemoteResourcesMojo.java
+++ b/src/main/java/org/apache/maven/plugin/resources/remote/BundleRemoteResourcesMojo.java
@@ -93,7 +93,7 @@
return;
}
- if (StringUtils.isEmpty(sourceEncoding)) {
+ if (sourceEncoding == null || sourceEncoding.isEmpty()) {
getLog().warn("sourceEncoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
+ ", i.e. build is platform dependent!");
sourceEncoding = ReaderFactory.FILE_ENCODING;