Skip to content

Commit b598aef

Browse files
[MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String) (#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 <[email protected]> * 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 <[email protected]>
1 parent f15f26b commit b598aef

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import java.util.jar.JarOutputStream;
3737

3838
import org.apache.maven.plugins.shade.relocation.Relocator;
39-
import org.codehaus.plexus.util.StringUtils;
4039

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

108107
BufferedReader reader;
109-
if (StringUtils.isNotEmpty(encoding)) {
108+
if (encoding != null && !encoding.isEmpty()) {
110109
reader = new BufferedReader(new InputStreamReader(is, encoding));
111110
} else {
112111
reader = new BufferedReader(new InputStreamReader(is));
@@ -178,7 +177,7 @@ public void modifyOutputStream(JarOutputStream jos) throws IOException {
178177
jos.putNextEntry(jarEntry);
179178

180179
Writer writer;
181-
if (StringUtils.isNotEmpty(encoding)) {
180+
if (encoding != null && !encoding.isEmpty()) {
182181
writer = new OutputStreamWriter(jos, encoding);
183182
} else {
184183
writer = new OutputStreamWriter(jos);

src/main/java/org/apache/maven/plugins/shade/resource/DontIncludeResourceTransformer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.jar.JarOutputStream;
2525

2626
import org.apache.maven.plugins.shade.relocation.Relocator;
27-
import org.codehaus.plexus.util.StringUtils;
2827

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

3837
public boolean canTransformResource(String r) {
39-
if (StringUtils.isNotEmpty(resource) && r.endsWith(resource)) {
38+
if ((resource != null && !resource.isEmpty()) && r.endsWith(resource)) {
4039
return true;
4140
}
4241

0 commit comments

Comments
 (0)