You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Olivier Langlois (JIRA)" <ji...@apache.org> on 2009/11/17 20:39:52 UTC

[jira] Updated: (AMQCPP-268) Unspecified exception can be thrown from decaf::io::ByteArrayOutputStream::write( const unsigned char* buffer, std::size_t offset, std::size_t len )

     [ https://issues.apache.org/activemq/browse/AMQCPP-268?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olivier Langlois updated AMQCPP-268:
------------------------------------

    Remaining Estimate: 10 minutes
     Original Estimate: 10 minutes

> 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
>   Original Estimate: 10 minutes
>  Remaining Estimate: 10 minutes
>
> 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.