From e8318615a9d4d820bd29446825b20b7755132ffc Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 22 May 2023 15:28:30 +0000 Subject: [PATCH] [MNG-6829] Replace StringUtils#isEmpty(String) & #isNotEmpty(String) Last batch of is(Not)Empty for https://issues.apache.org/jira/browse/MNG-6829 These are the smallest change sets, hence why I opened more at the same time. After this we can target the next most often used method from the StringUtils classes. 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 --- .../maven/plugins/jlink/AbstractJLinkToolchainExecutor.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkToolchainExecutor.java b/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkToolchainExecutor.java index 3ebce69a..f08406e8 100644 --- a/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkToolchainExecutor.java +++ b/src/main/java/org/apache/maven/plugins/jlink/AbstractJLinkToolchainExecutor.java @@ -158,12 +158,12 @@ private int executeCommand( Commandline cmd ) { int exitCode = CommandLineUtils.executeCommandLine( cmd, out, err ); - String output = ( StringUtils.isEmpty( out.getOutput() ) ? null : '\n' + out.getOutput().trim() ); + String output = StringUtils.isEmpty( out.getOutput() ) ? null : '\n' + out.getOutput().trim(); if ( exitCode != 0 ) { - if ( StringUtils.isNotEmpty( output ) ) + if ( output != null && !output.isEmpty() ) { // Reconsider to use WARN / ERROR ? // getLog().error( output ); @@ -185,7 +185,7 @@ private int executeCommand( Commandline cmd ) throw new MojoExecutionException( msg.toString() ); } - if ( StringUtils.isNotEmpty( output ) ) + if ( output != null && !output.isEmpty() ) { //getLog().info( output ); for ( String outputLine : output.split( "\n" ) )