Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 976647859 for ; Wed, 9 Nov 2011 21:16:31 +0000 (UTC) Received: (qmail 37941 invoked by uid 500); 9 Nov 2011 21:16:31 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 37872 invoked by uid 500); 9 Nov 2011 21:16:31 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 37865 invoked by uid 99); 9 Nov 2011 21:16:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2011 21:16:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2011 21:16:30 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 2C4DC2388A9B for ; Wed, 9 Nov 2011 21:16:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1199968 - in /activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src: main/activemq/core/ test-integration/activemq/test/openwire/ Date: Wed, 09 Nov 2011 21:16:10 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111109211610.2C4DC2388A9B@eris.apache.org> Author: tabish Date: Wed Nov 9 21:16:09 2011 New Revision: 1199968 URL: http://svn.apache.org/viewvc?rev=1199968&view=rev Log: Fix for: https://issues.apache.org/jira/browse/AMQCPP-382 Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.cpp activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp?rev=1199968&r1=1199967&r2=1199968&view=diff ============================================================================== --- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp (original) +++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConsumer.cpp Wed Nov 9 21:16:09 2011 @@ -1131,7 +1131,7 @@ void ActiveMQConsumer::dispatch( const P if( !this->internal->unconsumedMessages->isClosed() ) { // Don't dispatch expired messages, ack it and then destroy it - if( dispatch->getMessage()->isExpired() ) { + if( dispatch->getMessage() != NULL && dispatch->getMessage()->isExpired() ) { this->ackLater( dispatch, ActiveMQConstants::ACK_TYPE_CONSUMED ); // stop now, don't queue Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.cpp?rev=1199968&r1=1199967&r2=1199968&view=diff ============================================================================== --- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.cpp (original) +++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.cpp Wed Nov 9 21:16:09 2011 @@ -72,6 +72,31 @@ void OpenwireSimpleTest::testWithZeroCon } //////////////////////////////////////////////////////////////////////////////// +void OpenwireSimpleTest::testWithZeroConsumerPrefetchAndNoMessage() { + + cmsProvider->setTopic( false ); + cmsProvider->setDestinationName( + UUID::randomUUID().toString() + "?consumer.prefetchSize=0" ); + + cmsProvider->reconnectSession(); + + // Create CMS Object for Comms + cms::Session* session( cmsProvider->getSession() ); + cms::MessageConsumer* consumer = cmsProvider->getConsumer(); + + // Should be no message and no exceptions + auto_ptr message( consumer->receiveNoWait() ); + CPPUNIT_ASSERT( message.get() == NULL ); + + // Should be no message and no exceptions + message.reset( consumer->receive(1000) ); + CPPUNIT_ASSERT( message.get() == NULL ); + + consumer->close(); + session->close(); +} + +//////////////////////////////////////////////////////////////////////////////// void OpenwireSimpleTest::testMapMessageSendToQueue() { try { Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h?rev=1199968&r1=1199967&r2=1199968&view=diff ============================================================================== --- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h (original) +++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h Wed Nov 9 21:16:09 2011 @@ -40,6 +40,7 @@ namespace openwire{ CPPUNIT_TEST( testBytesMessageSendRecv ); CPPUNIT_TEST( testQuickCreateAndDestroy ); CPPUNIT_TEST( testWithZeroConsumerPrefetch ); + CPPUNIT_TEST( testWithZeroConsumerPrefetchAndNoMessage ); CPPUNIT_TEST( testMapMessageSendToQueue ); CPPUNIT_TEST( testMapMessageSendToTopic ); CPPUNIT_TEST( testDestroyDestination ); @@ -57,6 +58,7 @@ namespace openwire{ } void testWithZeroConsumerPrefetch(); + void testWithZeroConsumerPrefetchAndNoMessage(); void testMapMessageSendToQueue(); void testMapMessageSendToTopic(); void tesstStreamMessage();