From 7a3d620f01c173be3a2d7d61c59edf3a934fdd48 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 15 May 2023 15:08:40 +0200 Subject: [PATCH] [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 * Appease Spotless * Apply spotless --------- Co-authored-by: Moderne --- .../remote/AbstractProcessRemoteResourcesMojo.java | 12 +++++++----- .../resources/remote/BundleRemoteResourcesMojo.java | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) 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 @@ public void execute() throws MojoExecutionException { 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 @@ public Object internalGet(String key) { 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 @@ private List downloadBundles(List bundles) throws MojoExecutionExc 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 @@ public void execute() throws MojoExecutionException { 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;