Fixing patch for AMQ-824 - adding NULL check for MessageConsumer::autoAcknowledge

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@425574 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nathan Christopher Mittler 2006-07-26 00:44:39 +00:00
parent 859caee9d2
commit 95fec7d0db
1 changed files with 14 additions and 8 deletions

View File

@ -217,20 +217,26 @@ p<IMessage> MessageConsumer::autoAcknowledge(p<IMessage> message)
{ {
try try
{ {
// Is the message an ActiveMQMessage? (throws bad_cast otherwise) if( message != NULL )
p<ActiveMQMessage> activeMessage = p_dyncast<ActiveMQMessage> (message) ; {
// 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) );
// Register the handler for client acknowledgment if( acknowledgementMode != ClientAckMode )
activeMessage->setAcknowledger( smartify(this) ) ; doAcknowledge(activeMessage);
}
if( acknowledgementMode != ClientAckMode )
doAcknowledge(activeMessage) ;
} }
catch( bad_cast& bc ) catch( bad_cast& bc )
{ {
// ignore // ignore
} }
return message ;
// Return the message even if NULL, caller must determine what to do.
return message;
} }
/* /*