activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1087351 - in /activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src: main/activemq/commands/ActiveMQBytesMessage.cpp test/activemq/commands/ActiveMQBytesMessageTest.cpp
Date Thu, 31 Mar 2011 15:57:12 GMT
Author: tabish
Date: Thu Mar 31 15:57:12 2011
New Revision: 1087351

URL: http://svn.apache.org/viewvc?rev=1087351&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQCPP-359

Modified:
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp
    activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test/activemq/commands/ActiveMQBytesMessageTest.cpp
  (contents, props changed)

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp?rev=1087351&r1=1087350&r2=1087351&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/activemq/commands/ActiveMQBytesMessage.cpp
Thu Mar 31 15:57:12 2011
@@ -33,6 +33,7 @@ using namespace activemq::commands;
 using namespace activemq::exceptions;
 using namespace decaf::io;
 using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
 using namespace decaf::util;
 using namespace decaf::util::zip;
 
@@ -307,6 +308,10 @@ int ActiveMQBytesMessage::readBytes( uns
     initializeReading();
     try{
 
+        if( length < 0 ) {
+            throw IndexOutOfBoundsException(__FILE__, __LINE__, "Array length given was negative");
+        }
+
         int n = 0;
 
         while( n < length ) {

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test/activemq/commands/ActiveMQBytesMessageTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test/activemq/commands/ActiveMQBytesMessageTest.cpp?rev=1087351&r1=1087350&r2=1087351&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test/activemq/commands/ActiveMQBytesMessageTest.cpp
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test/activemq/commands/ActiveMQBytesMessageTest.cpp
Thu Mar 31 15:57:12 2011
@@ -212,6 +212,12 @@ void ActiveMQBytesMessageTest::testReadB
         for( int i = 0; i < 50; i++ ) {
             CPPUNIT_ASSERT( test[i] == i );
         }
+
+        CPPUNIT_ASSERT_THROW_MESSAGE(
+            "Should have thrown a CMSException",
+            msg.readBytes( test, -1 ),
+            CMSException);
+
     } catch( CMSException& ex ) {
         ex.printStackTrace();
         CPPUNIT_ASSERT( false );

Propchange: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/test/activemq/commands/ActiveMQBytesMessageTest.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 31 15:57:12 2011
@@ -0,0 +1 @@
+/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQBytesMessageTest.cpp:1087347



Mime
View raw message