Unspecified exception can be thrown from
decaf::io::ByteArrayOutputStream::write( const unsigned char* buffer,
std::size_t offset, std::size_t len )
------------------------------------------------------------------------------------------------------------------------------------------------------
Key: AMQCPP-268
URL: https://issues.apache.org/activemq/browse/AMQCPP-268
Project: ActiveMQ C++ Client
Issue Type: Bug
Components: Decaf
Affects Versions: 3.0.1
Reporter: Olivier Langlois
Assignee: Timothy Bish
Priority: Minor
std::bad_alloc can be thrown when appending data to the STL vector.
The proposed fix is to replace:
std::back_insert_iterator< std::vector<unsigned char> > iter( *activeBuffer
);
std::copy( buffer + offset, buffer + offset + len, iter );
with
try
{
activeBuffer->insert( activeBuffer->end(), buffer + offset, buffer + offset
+ len );
}
DECAF_CATCHALL_THROW( IOException )
Note that the proposition is getting rid of the std::back_insert_iterator which
is calling push_back() method as many times as there is chars to copy vs a
single call to insert().
If proposition is accepted then you could also remove:
#include <algorithm>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.