[forge-issues] [JBoss JIRA] (FORGE-1970) Copy cause's message to InvocationTargetException

Ondrej Zizka (JIRA) issues at jboss.org
Wed Aug 6 00:16:31 EDT 2014


    [ https://issues.jboss.org/browse/FORGE-1970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12990591#comment-12990591 ] 

Ondrej Zizka commented on FORGE-1970:
-------------------------------------

The source of the problems is that InvocationTargetException doesn't use "cause" to store the cause.
If you think of IDE, then - no, it doesn't truncate anything.
Re-throwing would be okay, but the API throws Exception, so Errors are kept wrapped this way.

STR:
{code}
git clone git at github.com:OndraZizka/windup.git
git co ReportCommons
cd
mvn clean install -DskipTests
mvn install reporting/xslt
{code}

> Copy cause's message to InvocationTargetException
> -------------------------------------------------
>
>                 Key: FORGE-1970
>                 URL: https://issues.jboss.org/browse/FORGE-1970
>             Project: Forge
>          Issue Type: Enhancement
>      Security Level: Public(Everyone can see) 
>            Reporter: Ondrej Zizka
>
> InvocationTargetException
> in arquillian-forge-core appears without any message and with null cause. The cause is in {{target}} property.
> Then the logging frameworks do not show the additional information.
> I suggest to either copy the error to the {{cause}} property, or at least to copy the message.
> I.e. change this in {{org.jboss.forge.arquillian.ForgeTestMethodExecutor}}
> {code}
>                         if (e.getCause() != null && e.getCause() instanceof Exception)
>                            throw (Exception) e.getCause();
>                         else
>                            throw e;
> {code}
> into something like
> {code}
>                       if (e.getCause() != null) {
>                         if( e.getCause() instanceof Exception)
>                            throw (Exception) e.getCause();
>                         else{
>                            e = new InvocationTargetException( target, target.getMessage);
>                            // And some reflection to set the cause.
>                            throw e;
>                         }
>                       }
> {code}
> I would make a PR, but I didn't find where the repo for arq-forge-core is.



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)


More information about the forge-issues mailing list