Author: tabish
Date: Tue Dec 16 10:56:00 2008
New Revision: 727118
URL: http://svn.apache.org/viewvc?rev=727118&view=rev
Log:
Changes needed while implementing the URI class.
Modified:
activemq/activemq-cpp/trunk/src/main/decaf/internal/net/URIEncoderDecoder.cpp
activemq/activemq-cpp/trunk/src/main/decaf/internal/net/URIHelper.cpp
Modified:
activemq/activemq-cpp/trunk/src/main/decaf/internal/net/URIEncoderDecoder.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/internal/net/URIEncoderDecoder.cpp?rev=727118&r1=727117&r2=727118&view=diff
==============================================================================
---
activemq/activemq-cpp/trunk/src/main/decaf/internal/net/URIEncoderDecoder.cpp
(original)
+++
activemq/activemq-cpp/trunk/src/main/decaf/internal/net/URIEncoderDecoder.cpp
Tue Dec 16 10:56:00 2008
@@ -68,8 +68,8 @@
if( !( Character::isLetterOrDigit( *itr ) ||
legal.find( *itr, 0 ) != std::string::npos ||
( (unsigned char)ch > 127 &&
- !Character::isWhitespace(ch) &&
- !Character::isISOControl(ch) ) ) ) {
+ ( !Character::isWhitespace(ch) ||
+ !Character::isISOControl(ch) ) ) ) ) {
throw URISyntaxException(
__FILE__, __LINE__, s,
@@ -86,13 +86,16 @@
std::string::const_iterator itr = s.begin();
for( int i = 0; itr != s.end(); ++i, ++itr ) {
- if( !Character::isLetterOrDigit( *itr ) ||
- !( legal.find( *itr ) > std::string::npos ) ) {
- throw URISyntaxException(
- __FILE__, __LINE__, s,
- "string contains invalid ASCII chars", (int)i );
+ if( Character::isLetterOrDigit( *itr ) ||
+ legal.find( *itr ) != std::string::npos ) {
+
+ continue;
}
+
+ throw URISyntaxException(
+ __FILE__, __LINE__, s,
+ "string contains invalid ASCII chars", (int)i );
}
}
Modified: activemq/activemq-cpp/trunk/src/main/decaf/internal/net/URIHelper.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/internal/net/URIHelper.cpp?rev=727118&r1=727117&r2=727118&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/internal/net/URIHelper.cpp
(original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/internal/net/URIHelper.cpp Tue
Dec 16 10:56:00 2008
@@ -126,11 +126,11 @@
}
// Authority and Path
- if( temp.at(0) == '/' && temp.at(1) == '/' ) {
+ if( temp != "" && temp.at(0) == '/' && temp.at(1) == '/' ) {
index = temp.find( '/', 2 );
if( index != std::string::npos ) {
- result.setAuthority( temp.substr( 2, index ) );
+ result.setAuthority( temp.substr( 2, index - 2 ) );
result.setPath( temp.substr( index, std::string::npos ) );
} else {
result.setAuthority( temp.substr( 2, std::string::npos ) );
@@ -148,11 +148,10 @@
// never be null)
}
- if( result.getAuthority().length() == 0 ) {
- result.setAuthority( "" );
- } else {
+ if( result.getAuthority().length() != 0 ) {
validateAuthority( uri, result.getAuthority(), index1 + 3 );
}
+
} else { // no authority specified
result.setPath( temp );
}