You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Timothy Bish (JIRA)" <ji...@apache.org> on 2010/02/09 16:43:33 UTC

[jira] Updated: (AMQCPP-285) If brokerURI is ipv4 format(127.0.0.1), createConnection will throw decaf::lang::exceptions::NumberFormatException.

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

Timothy Bish updated AMQCPP-285:
--------------------------------

    Fix Version/s: 3.2.0
                   3.1.1

> If brokerURI is ipv4 format(127.0.0.1),  createConnection will throw decaf::lang::exceptions::NumberFormatException.
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: AMQCPP-285
>                 URL: https://issues.apache.org/activemq/browse/AMQCPP-285
>             Project: ActiveMQ C++ Client
>          Issue Type: Bug
>          Components: Decaf
>    Affects Versions: 3.1
>         Environment: vs2008,windows xp
>            Reporter: yojay.li
>            Assignee: Timothy Bish
>             Fix For: 3.1.1, 3.2.0
>
>
> file: 
>   activemq-cpp-library-3.1.0\src\main\decaf\internal\net\URIHelper.cpp
> funciton: 
>   bool URIHelper::isValidIPv4Address( const std::string& host )
> cause:
>   The paramters of std::string.substr() is (start_pos, length) but not (start_pos, end_pos).
>   Interger::parseInt(host.substr(..., ...)) will throw NumberFormatException.
> fixed code:
> bool URIHelper::isValidIPv4Address( const std::string& host ) {
>     std::size_t index;
>     std::size_t index2;
>     try {
>         int num;
>         index = host.find( '.' );
> 		num = decaf::lang::Integer::parseInt( host.substr( 0, index ) );
>         if( num < 0 || num > 255 ) {
>             return false;
>         }
>         index2 = host.find( '.', index + 1 );
>         num = decaf::lang::Integer::parseInt( host.substr( index + 1, index2 - index - 1) );
>         if( num < 0 || num > 255 ) {
>             return false;
>         }
>         index = host.find( '.', index2 + 1 );
>         num = decaf::lang::Integer::parseInt( host.substr( index2 + 1, index - index2 - 1) );
>         if( num < 0 || num > 255 ) {
>             return false;
>         }
>         num = decaf::lang::Integer::parseInt( host.substr( index + 1, std::string::npos ) );
>         if( num < 0 || num > 255 ) {
>             return false;
>         }
> 	} catch( decaf::lang::Exception& e ) {
>         return false;
>     }
>     return true;
> }
>   

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.