activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olivier Langlois (JIRA)" <j...@apache.org>
Subject [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 )
Date Tue, 17 Nov 2009 19:39:52 GMT

     [ 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.


Mime
View raw message