[ https://jira.codehaus.org/browse/SUREFIRE-1029?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrew Gaul updated SUREFIRE-1029:
----------------------------------
Description:
Surefire only reports the exception from a try-with-resources body, not any suppressed exceptions
from close methods. I see this behavior from the attached AutoCloseableMain.java:
{code}
Exception in thread "main" java.io.IOException: from body
at AutoCloseableMain.main(AutoCloseableMain.java:9)
Suppressed: java.io.IOException: from close
at ThrowIOExceptionOnClose.close(AutoCloseableMain.java:17)
at AutoCloseableMain.main(AutoCloseableMain.java:10)
{code}
I see a different behavior from the attached AutoCloseableTest.java:
{code}
java.io.IOException: from body
at com.maginatics.AutoCloseableTest.testAutoCloseable(AutoCloseableTest.java:14)
{code}
Surefire could call Throwable.getSuppressed via reflection to maintain compatibility with
earlier versions of Java. Refer to Guava Closer which does something similar.
was:
Surefire only reports the exception from a try-with-resources body, not any suppressed exceptions
from close methods. I see this behavior from the attached AutoCloseableMain.java:
{{
Exception in thread "main" java.io.IOException: from body
at AutoCloseableMain.main(AutoCloseableMain.java:9)
Suppressed: java.io.IOException: from close
at ThrowIOExceptionOnClose.close(AutoCloseableMain.java:17)
at AutoCloseableMain.main(AutoCloseableMain.java:10)
}}
I see a different behavior from the attached AutoCloseableTest.java:
{{
java.io.IOException: from body
at com.maginatics.AutoCloseableTest.testAutoCloseable(AutoCloseableTest.java:14)
}}
Surefire could call Throwable.getSuppressed via reflection to maintain compatibility with
earlier versions of Java. Refer to Guava Closer which does something similar.
> Report suppressed exceptions
> ----------------------------
>
> Key: SUREFIRE-1029
> URL: https://jira.codehaus.org/browse/SUREFIRE-1029
> Project: Maven Surefire
> Issue Type: Improvement
> Components: Maven Surefire Plugin
> Affects Versions: 2.16
> Reporter: Andrew Gaul
> Attachments: AutoCloseableMain.java, AutoCloseableTest.java
>
>
> Surefire only reports the exception from a try-with-resources body, not any suppressed
exceptions from close methods. I see this behavior from the attached AutoCloseableMain.java:
> {code}
> Exception in thread "main" java.io.IOException: from body
> at AutoCloseableMain.main(AutoCloseableMain.java:9)
> Suppressed: java.io.IOException: from close
> at ThrowIOExceptionOnClose.close(AutoCloseableMain.java:17)
> at AutoCloseableMain.main(AutoCloseableMain.java:10)
> {code}
> I see a different behavior from the attached AutoCloseableTest.java:
> {code}
> java.io.IOException: from body
> at com.maginatics.AutoCloseableTest.testAutoCloseable(AutoCloseableTest.java:14)
> {code}
> Surefire could call Throwable.getSuppressed via reflection to maintain compatibility
with earlier versions of Java. Refer to Guava Closer which does something similar.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
|