[ https://issues.apache.org/activemq/browse/AMQ-824?page=all ]

Timothy Bish updated AMQ-824:
-----------------------------

    Attachment: patch.txt

This patch adds a check for null in the MessageConsumers autoAcknowledge 
method, this shuold fix all the receive methods so that if NULL is returned 
from the dequeue an exceptions will not be generated in the ack method.

> Missing NULL pointer check in  MessageConsumer::autoAcknowledge
> ---------------------------------------------------------------
>
>                 Key: AMQ-824
>                 URL: https://issues.apache.org/activemq/browse/AMQ-824
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: CMS (C++ client)
>    Affects Versions: incubation
>         Environment: RHEL ES 4/32bit
>            Reporter: Radek Sedmak
>         Assigned To: Timothy Bish
>         Attachments: patch.txt
>
>   Original Estimate: 10 minutes
>  Remaining Estimate: 10 minutes
>
> When you call consumer->receive() on empty queue receive method returns NULL 
> message but before return MessageConsumer::autoAcknowledge method is invoked. 
> This method doesn't check message against NULL, this cause coredump is 
> message is NULL.
> Patch: 
> p<IMessage> MessageConsumer::autoAcknowledge(p<IMessage> message)
> {
>     try
>     {
>         if ( message != NULL ) {   // <------ Check NULL here !!!!!
>           // Is the message an ActiveMQMessage? (throws bad_cast otherwise)
>           p<ActiveMQMessage> activeMessage = p_dyncast<ActiveMQMessage> 
> (message) ;
>           // Register the handler for client acknowledgment
>           activeMessage->setAcknowledger( smartify(this) ) ;
>           if( acknowledgementMode != ClientAckMode )
>               doAcknowledge(activeMessage) ;
>         }
>     }
>     catch( bad_cast& bc )
>     {
>         // ignore
>     }
>     return message ;

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to