Author: tabish
Date: Tue Nov 17 20:23:20 2009
New Revision: 881489
URL: http://svn.apache.org/viewvc?rev=881489&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-268
Apply mods to the ByteArrayOutputStream to catch and convert exceptions to the
expected types. Add performance fix to improve the write function.
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp?rev=881489&r1=881488&r2=881489&view=diff
==============================================================================
---
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp
(original)
+++
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp
Tue Nov 17 20:23:20 2009
@@ -16,7 +16,6 @@
*/
#include "ByteArrayOutputStream.h"
-#include <algorithm>
using namespace std;
using namespace decaf;
@@ -48,7 +47,12 @@
////////////////////////////////////////////////////////////////////////////////
void ByteArrayOutputStream::write( unsigned char c )
throw ( IOException ) {
- activeBuffer->push_back( c );
+
+ try{
+ activeBuffer->push_back( c );
+ }
+ DECAF_CATCH_RETHROW( IOException )
+ DECAF_CATCHALL_THROW( IOException )
}
////////////////////////////////////////////////////////////////////////////////
@@ -79,8 +83,11 @@
"ByteArrayOutputStream::write - passed buffer is null" );
}
- std::back_insert_iterator< std::vector<unsigned char> > iter(
*activeBuffer );
- std::copy( buffer + offset, buffer + offset + len, iter );
+ try{
+ activeBuffer->insert( activeBuffer->end(), buffer + offset, buffer +
offset + len );
+ }
+ DECAF_CATCH_RETHROW( IOException )
+ DECAF_CATCHALL_THROW( IOException )
}
////////////////////////////////////////////////////////////////////////////////