You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/11/28 17:52:29 UTC

svn commit: r599060 - /activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp

Author: tabish
Date: Wed Nov 28 08:52:28 2007
New Revision: 599060

URL: http://svn.apache.org/viewvc?rev=599060&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103

Working on the NIO package

Modified:
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp?rev=599060&r1=599059&r2=599060&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/nio/ByteBuffer.cpp Wed Nov 28 08:52:28 2007
@@ -248,19 +248,18 @@
             return *this;
         }
 
-        if( length > this->remaining() ) {
-            throw BufferUnderflowException(
-                __FILE__, __LINE__,
-                "ByteBuffer::get - Not Enough Data to Fill Request.");
-        }
-
-
         if( buffer == NULL ) {
             throw NullPointerException(
                 __FILE__, __LINE__,
                 "ByteBuffer::get - Passed Buffer is Null.");
         }
 
+        if( length > this->remaining() ) {
+            throw BufferUnderflowException(
+                __FILE__, __LINE__,
+                "ByteBuffer::get - Not Enough Data to Fill Request.");
+        }
+
         // read length bytes starting from the offset
         for( std::size_t ix = 0; ix < length; ++ix ) {
             buffer[ix + offset] = this->get();
@@ -513,7 +512,7 @@
 
     try{
 
-        if( (offset + index) > this->limit() ) {
+        if( (offset + index) >= this->limit() ) {
             throw IndexOutOfBoundsException(
                 __FILE__, __LINE__,
                 "ByteBuffer::get - Not enough data to fill request." );