[ 
https://issues.apache.org/jira/browse/SUREFIRE-1276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15431693#comment-15431693
 ] 

Tibor Digana commented on SUREFIRE-1276:
----------------------------------------

{{String#isEmpty()}} is available since of Java 1.6 and we compile code with 
1.5.
The point of {{countNewLines == 1 && !msg.trim().endsWith( "\n" )}} is to print 
{{java.lang.IllegalArgumentException: Message}}
instead of
{{java.lang.IllegalArgumentException: 
Message}}
if you call {{throw new IllegalArgumentException("Message\n");}}
The point of Groovy fix is to align expression and value.
The code {{countNewLines == 1 && !msg.trim().endsWith( "\n" )}} avoids 
situation with {{throw new IllegalArgumentException("Message\n");}} without 
unnecessary call {{.isEmpty()}} and without cutting msg with tokenizer.

> Document handling of multiline exception messages
> -------------------------------------------------
>
>                 Key: SUREFIRE-1276
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1276
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>            Reporter: Gili
>            Assignee: Tibor Digana
>              Labels: documentation
>
> I am throwing an exception whose message contains newlines for readability. 
> When {{<trimStackTrace>}} is true (the default value) Surefire is removing 
> all newlines.
> Expected behavior: Consider moving this functionality out of 
> {{<trimStackTrace>}} into its own parameter. Regardless of which parameter 
> enables this behavior, please document it at 
> http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html ... 
> right now there is no mention of this behavior.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to