activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
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 GMT
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<cms::Message> 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();



Mime
View raw message