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 2015/04/02 23:51:07 UTC

[Bug 57788] New: NPE on session.addMessageHandler

https://bz.apache.org/bugzilla/show_bug.cgi?id=57788

            Bug ID: 57788
           Summary: NPE on session.addMessageHandler
           Product: Tomcat 8
           Version: 8.0.21
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: WebSocket
          Assignee: dev@tomcat.apache.org
          Reporter: marco@lordzodiac.de

The NPE is throwed when then MessageHandler has no Generic Class.

java.lang.NullPointerException
    at org.apache.tomcat.websocket.Util.getGenericType(Util.java:192)
    at org.apache.tomcat.websocket.Util.getGenericType(Util.java:212)
    at org.apache.tomcat.websocket.Util.getGenericType(Util.java:212)
    at org.apache.tomcat.websocket.Util.getGenericType(Util.java:212)
    at org.apache.tomcat.websocket.Util.getMessageType(Util.java:171)
    at
org.apache.tomcat.websocket.WsSession.addMessageHandler(WsSession.java:198)

Please check on the Util class line 210. The call clazz.getSuperclass() returns
null if clazz is a Object class (see JDK Javadoc).

-- 
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 57788] NPE on session.addMessageHandler

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

Konstantin Kolinko <kn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Konstantin Kolinko <kn...@gmail.com> ---
What are you trying to do here and what do you expect? Is it a real use case? 

(Source code =?)

My expectations are that such call is expected to fail.

For reference, WsSession.addMessageHandler(WsSession.java:198) method called
here is

[[[
    @Override
    public void addMessageHandler(MessageHandler listener) {
]]]

declared in javax.websocket.Session.

Use of that method is discouraged in favor of WebSocket 1.1 methods

Session.addMessageHandler(Class<T> clazz, MessageHandler.Partial<T> handler)
Session.addMessageHandler(Class<T> clazz, MessageHandler.Whole<T> handler)

-- 
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 57788] NPE on session.addMessageHandler

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

Remy Maucherat <re...@apache.org> changed:

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

--- Comment #2 from Remy Maucherat <re...@apache.org> ---
r1672628, will be included in 8.0.22. Of course, it will only display a
different error. Source for better test ?

-- 
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 57788] NPE on session.addMessageHandler

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

--- Comment #3 from Remy Maucherat <re...@apache.org> ---
r1673169 for 7.0.62.

-- 
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