This is an automated email from the ASF dual-hosted git repository. rfscholte pushed a commit to branch github-19 in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git
commit 4aa80ed34fd2b8ff8183ec4748bcf37860f32a47 Author: Russell Howe <[email protected]> AuthorDate: Sun May 5 14:43:37 2019 +0100 (doc) Remove nullity check in CompilationFailureException If the messages list is null, this class will throw a NullPointerException in its shortMessage() method, so having a check for a null message list in longMessage() seems unnecessary. Remove it. --- .../maven/plugin/compiler/CompilationFailureException.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/maven/plugin/compiler/CompilationFailureException.java b/src/main/java/org/apache/maven/plugin/compiler/CompilationFailureException.java index 12c72e1..e47b058 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/CompilationFailureException.java +++ b/src/main/java/org/apache/maven/plugin/compiler/CompilationFailureException.java @@ -37,7 +37,7 @@ public class CompilationFailureException /** * Wrap error messages from the compiler * - * @param messages the messages + * @param messages the messages, not null * @since 2.0 */ public CompilationFailureException( List<CompilerMessage> messages ) @@ -48,7 +48,7 @@ public class CompilationFailureException /** * Long message will have all messages, one per line * - * @param messages the messages + * @param messages the messages, not null * @return the long error message * @since 2.0 */ @@ -56,20 +56,18 @@ public class CompilationFailureException { StringBuilder sb = new StringBuilder(); - if ( messages != null ) + for ( CompilerMessage compilerError : messages ) { - for ( CompilerMessage compilerError : messages ) - { - sb.append( compilerError ).append( LS ); - } + sb.append( compilerError ).append( LS ); } + return sb.toString(); } /** * Short message will have the error message if there's only one, useful for errors forking the compiler * - * @param messages the messages + * @param messages the messages, not null * @return the short error message * @since 2.0.2 */
