From 3695e02eb7b0657d39f7b89e58779ab12e35a569 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Fri, 10 Dec 2021 16:32:17 +0100 Subject: [PATCH] Use String#join instead of manual joining --- .../plugins/invoker/AbstractInvokerMojo.java | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java index 2228acfd..2e11984f 100644 --- a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java +++ b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java @@ -1721,43 +1721,33 @@ private void runBuild( File projectsDir, BuildJob buildJob, File settingsFile, F { buildJob.setResult( BuildJob.Result.SKIPPED ); - StringBuilder message = new StringBuilder(); + List messages = new ArrayList<>(); + if ( selection == Selector.SELECTOR_MULTI ) { - message.append( "non-matching selectors" ); + messages.add( "non-matching selectors" ); } else { if ( ( selection & Selector.SELECTOR_MAVENVERSION ) != 0 ) { - message.append( "Maven version" ); + messages.add( "Maven version" ); } if ( ( selection & Selector.SELECTOR_JREVERSION ) != 0 ) { - if ( message.length() > 0 ) - { - message.append( ", " ); - } - message.append( "JRE version" ); + messages.add( "JRE version" ); } if ( ( selection & Selector.SELECTOR_OSFAMILY ) != 0 ) { - if ( message.length() > 0 ) - { - message.append( ", " ); - } - message.append( "OS" ); + messages.add( "OS" ); } if ( ( selection & Selector.SELECTOR_TOOLCHAIN ) != 0 ) { - if ( message.length() > 0 ) - { - message.append( ", " ); - } - message.append( "Toolchain" ); + messages.add( "Toolchain" ); } } + String message = String.join( ", ", messages ); if ( !suppressSummaries ) { getLog().info( pad( buildJob ).warning( "SKIPPED" ) + " due to " + message );