You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bob DeRemer <bo...@thingworx.com> on 2013/10/19 14:46:05 UTC

possible tomcat 7.0.47 jsr-356 bug: NULL pointer being thrown when DecodeException is caught in PojoMessageHandlerWholeBase.onMessage

I am testing what happens when Encode/Decode Exceptions occur during JSR-356 communication and found that in the following code in onMessage, the ((WsSession)session) is NULL.  As a result, the actual DecodeException (cause) is lost.

       // Can this message be decoded?
        Object payload;
        try {
            payload = decode(message);
        } catch (DecodeException de) {
            ((WsSession) session).getLocal().onError(session, de);
            return;
        }


Tracing this further up the stack, I found that Util.getMessageHandlers is initializing it and passing NULL in for the session:

            if (decoderMatch.getTextDecoders().size() > 0) {
                MessageHandlerResult result = new MessageHandlerResult(
                        new PojoMessageHandlerWholeText(listener, m, null,
                                endpointConfig,
                                decoderMatch.getTextDecoders(), new Object[1],
                                0, false, -1, -1),
                        MessageHandlerResultType.TEXT);
                results.add(result);
            }

Is this a bug, or do I need to do something else to get this internal session initialize - in addition to calling: addMessageHandler(this) in the onOpen of my Endpoint-derived class?

Thanks,


Bob DeRemer
Senior Director, Architecture and Development

[Description: Description: Description: Description: cid:image001.png@01CBE3DE.51A12030]
http://www.thingworx.com<http://www.thingworx.com/>
Skype: bob.deremer.thingworx
O: 610.594.6200 x812
M: 717.881.3986


RE: possible tomcat 7.0.47 jsr-356 bug: NULL pointer being thrown when DecodeException is caught in PojoMessageHandlerWholeBase.onMessage

Posted by Bob DeRemer <bo...@thingworx.com>.

> -----Original Message-----
> From: Martin Gainty [mailto:mgainty@hotmail.com]
> Sent: Sunday, October 20, 2013 8:22 AM
> To: Tomcat Users List
> Subject: RE: possible tomcat 7.0.47 jsr-356 bug: NULL pointer being thrown
> when DecodeException is caught in
> PojoMessageHandlerWholeBase<T>.onMessage
> 
> Morning Bob-
> 
> 
> 
> session should never be null..this is a bug
> 
> 
> 
> create an account here
> 
> https://issues.apache.org/bugzilla/createaccount.cgi
> 
> 
> and file the bug report
> 
> 

Bug report submitted
Thx, bob

> 
> Many thanks for discovering this bug and helping us to improve the product
> 
> 
> Martin
> ______________________________________________
> 
> 
> 
> 
> 
> 
> 
> From: bob.deremer@thingworx.com
> To: users@tomcat.apache.org
> Subject: possible tomcat 7.0.47 jsr-356 bug: NULL pointer being thrown when
> DecodeException is caught in PojoMessageHandlerWholeBase<T>.onMessage
> Date: Sat, 19 Oct 2013 12:46:05 +0000
> 
> 
> 
> 
> 
> 
> 
> I am testing what happens when Encode/Decode Exceptions occur during JSR-
> 356 communication and found that in the following code in onMessage, the
> ((WsSession)session) is NULL.  As a result, the actual DecodeException (cause) is
> lost.
> 
>        // Can this message be decoded?
>         Object payload;
>         try {
>             payload = decode(message);
>         } catch (DecodeException de) {
>             ((WsSession) session).getLocal().onError(session, de);
>             return;
>         }
> 
> 
> Tracing this further up the stack, I found that Util.getMessageHandlers is
> initializing it and passing NULL in for the session:
> 
>             if (decoderMatch.getTextDecoders().size() > 0) {
>                 MessageHandlerResult result = new MessageHandlerResult(
>                         new PojoMessageHandlerWholeText(listener, m, null,
>                                 endpointConfig,
>                                 decoderMatch.getTextDecoders(), new Object[1],
>                                 0, false, -1, -1),
>                         MessageHandlerResultType.TEXT);
>                 results.add(result);
>             }
> 
> Is this a bug, or do I need to do something else to get this internal session
> initialize - in addition to calling: addMessageHandler(this) in the onOpen of my
> Endpoint-derived class?
> 
> Thanks,
> 
> 
> Bob DeRemer
> Senior Director, Architecture and Development
> 
> 
> http://www.thingworx.com
> Skype: bob.deremer.thingworx
> O: 610.594.6200 x812
> M: 717.881.3986
> 

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


RE: possible tomcat 7.0.47 jsr-356 bug: NULL pointer being thrown when DecodeException is caught in PojoMessageHandlerWholeBase.onMessage

Posted by Martin Gainty <mg...@hotmail.com>.
Morning Bob-

 

session should never be null..this is a bug

 

create an account here

https://issues.apache.org/bugzilla/createaccount.cgi


and file the bug report

 

Many thanks for discovering this bug and helping us to improve the product


Martin 
______________________________________________ 

  





From: bob.deremer@thingworx.com
To: users@tomcat.apache.org
Subject: possible tomcat 7.0.47 jsr-356 bug: NULL pointer being thrown when DecodeException is caught in PojoMessageHandlerWholeBase<T>.onMessage
Date: Sat, 19 Oct 2013 12:46:05 +0000







I am testing what happens when Encode/Decode Exceptions occur during JSR-356 communication and found that in the following code in onMessage, the ((WsSession)session) is NULL.  As a result, the actual DecodeException (cause) is lost.
 
       // Can this message be decoded?
        Object payload;
        try {
            payload = decode(message);
        } catch (DecodeException de) {
            ((WsSession) session).getLocal().onError(session, de);
            return;
        }
 
 
Tracing this further up the stack, I found that Util.getMessageHandlers is initializing it and passing NULL in for the session:
 
            if (decoderMatch.getTextDecoders().size() > 0) {
                MessageHandlerResult result = new MessageHandlerResult(
                        new PojoMessageHandlerWholeText(listener, m, null,
                                endpointConfig,
                                decoderMatch.getTextDecoders(), new Object[1],
                                0, false, -1, -1),
                        MessageHandlerResultType.TEXT);
                results.add(result);
            }
 
Is this a bug, or do I need to do something else to get this internal session initialize - in addition to calling: addMessageHandler(this) in the onOpen of my Endpoint-derived class?
 
Thanks,
 
 
Bob DeRemer
Senior Director, Architecture and Development
 

http://www.thingworx.com
Skype: bob.deremer.thingworx
O: 610.594.6200 x812
M: 717.881.3986
  		 	   		  

RE: possible tomcat 7.0.47 jsr-356 bug: NULL pointer being thrown when DecodeException is caught in PojoMessageHandlerWholeBase.onMessage

Posted by Bob DeRemer <bo...@thingworx.com>.
I have re-posted to DEV so please disregard

From: Bob DeRemer [mailto:bob.deremer@thingworx.com]
Sent: Saturday, October 19, 2013 8:46 AM
To: Tomcat Users List
Subject: possible tomcat 7.0.47 jsr-356 bug: NULL pointer being thrown when DecodeException is caught in PojoMessageHandlerWholeBase<T>.onMessage

I am testing what happens when Encode/Decode Exceptions occur during JSR-356 communication and found that in the following code in onMessage, the ((WsSession)session) is NULL.  As a result, the actual DecodeException (cause) is lost.

       // Can this message be decoded?
        Object payload;
        try {
            payload = decode(message);
        } catch (DecodeException de) {
            ((WsSession) session).getLocal().onError(session, de);
            return;
        }


Tracing this further up the stack, I found that Util.getMessageHandlers is initializing it and passing NULL in for the session:

            if (decoderMatch.getTextDecoders().size() > 0) {
                MessageHandlerResult result = new MessageHandlerResult(
                        new PojoMessageHandlerWholeText(listener, m, null,
                                endpointConfig,
                                decoderMatch.getTextDecoders(), new Object[1],
                                0, false, -1, -1),
                        MessageHandlerResultType.TEXT);
                results.add(result);
            }

Is this a bug, or do I need to do something else to get this internal session initialize - in addition to calling: addMessageHandler(this) in the onOpen of my Endpoint-derived class?

Thanks,


Bob DeRemer
Senior Director, Architecture and Development

[Description: Description: Description: Description: cid:image001.png@01CBE3DE.51A12030]
http://www.thingworx.com<http://www.thingworx.com/>
Skype: bob.deremer.thingworx
O: 610.594.6200 x812
M: 717.881.3986