You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2014/04/23 04:11:22 UTC

[Bug 56446] New: Handling InvocationTargetException for PojoMessageHandlerWholeBase and PojoMessageHandlerPartialBase.onMessage()

https://issues.apache.org/bugzilla/show_bug.cgi?id=56446

            Bug ID: 56446
           Summary: Handling InvocationTargetException for
                    PojoMessageHandlerWholeBase and
                    PojoMessageHandlerPartialBase.onMessage()
           Product: Tomcat 8
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: WebSocket
          Assignee: dev@tomcat.apache.org
          Reporter: bluewolf.chung@gmail.com

Both two methods handle InvocationTargetException from Endpoint @OnMessage
method like this:

        try {
            result = method.invoke(pojo, parameters);
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw new IllegalArgumentException(e);
        }

I'd like to suggest to use

org.apache.tomcat.util.ExceptionUtils#unwrapInvocationTargetException() and
RuntimeException

, which is like below:

        try {
            result = method.invoke(pojo, parameters);
        } catch (IllegalAccessException | InvocationTargetException e) {
            Throwable throwable =
ExceptionUtils.unwrapInvocationTargetException(e);
            if (throwable instanceof RuntimeException) {
                throw (RuntimeException) throwable;
            } else {
                throw new RuntimeException(throwable);
            }
        }

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56446] Handling InvocationTargetException for PojoMessageHandlerWholeBase and PojoMessageHandlerPartialBase.onMessage()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56446

--- Comment #2 from Violeta Georgieva <vi...@apache.org> ---
The fix was back-ported to 7.0.x for 7.0.56 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56446] Handling InvocationTargetException for PojoMessageHandlerWholeBase and PojoMessageHandlerPartialBase.onMessage()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56446

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Thanks for the report. I have applied a variation of this to 8.0.x for 8.0.9
onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org