Skip to content

Commit

Permalink
[MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String) (
Browse files Browse the repository at this point in the history
#187)

* [MNG-6829] Replace 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>

* Revert changes to src/it/projects/MSHADE-36-inject-dep-reduced-pom-in-final/src/main/java/com/example/Main.java

---------

Co-authored-by: Moderne <team@moderne.io>
  • Loading branch information
timtebeek and TeamModerne authored May 15, 2023
1 parent f15f26b commit b598aef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import java.util.jar.JarOutputStream;

import org.apache.maven.plugins.shade.relocation.Relocator;
import org.codehaus.plexus.util.StringUtils;

/**
* Merges <code>META-INF/NOTICE.TXT</code> files.
Expand Down Expand Up @@ -106,7 +105,7 @@ public void processResource(String resource, InputStream is, List<Relocator> rel
}

BufferedReader reader;
if (StringUtils.isNotEmpty(encoding)) {
if (encoding != null && !encoding.isEmpty()) {
reader = new BufferedReader(new InputStreamReader(is, encoding));
} else {
reader = new BufferedReader(new InputStreamReader(is));
Expand Down Expand Up @@ -178,7 +177,7 @@ public void modifyOutputStream(JarOutputStream jos) throws IOException {
jos.putNextEntry(jarEntry);

Writer writer;
if (StringUtils.isNotEmpty(encoding)) {
if (encoding != null && !encoding.isEmpty()) {
writer = new OutputStreamWriter(jos, encoding);
} else {
writer = new OutputStreamWriter(jos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.util.jar.JarOutputStream;

import org.apache.maven.plugins.shade.relocation.Relocator;
import org.codehaus.plexus.util.StringUtils;

/**
* A resource processor that prevents the inclusion of an arbitrary
Expand All @@ -36,7 +35,7 @@ public class DontIncludeResourceTransformer extends AbstractCompatibilityTransfo
List<String> resources;

public boolean canTransformResource(String r) {
if (StringUtils.isNotEmpty(resource) && r.endsWith(resource)) {
if ((resource != null && !resource.isEmpty()) && r.endsWith(resource)) {
return true;
}

Expand Down

0 comments on commit b598aef

Please sign in to comment.