You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2011/04/23 17:46:07 UTC
svn commit: r1096161 -
/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
Author: tabish
Date: Sat Apr 23 15:46:07 2011
New Revision: 1096161
URL: http://svn.apache.org/viewvc?rev=1096161&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQCPP-366
Modified:
activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp?rev=1096161&r1=1096160&r2=1096161&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/core/ActiveMQConnectionFactory.cpp Sat Apr 23 15:46:07 2011
@@ -35,6 +35,7 @@
using namespace std;
using namespace activemq;
+using namespace activemq::util;
using namespace activemq::core;
using namespace activemq::core::policies;
using namespace activemq::exceptions;
@@ -107,13 +108,19 @@ namespace core{
this->properties->clear();
if( uri.getQuery() != "" ) {
- // Not a composite URI so this works fine.
- activemq::util::URISupport::parseQuery( uri.getQuery(), properties.get() );
+
+ // Not a composite URI so this works fine.
+ try{
+ URISupport::parseQuery( uri.getQuery(), properties.get() );
+ } catch(URISyntaxException& ex) {}
+
} else {
- // Composite URI won't indicate it has a query even if it does.
- activemq::util::CompositeData composite = activemq::util::URISupport::parseComposite( uri );
- *this->properties = composite.getParameters();
+ // Composite URI won't indicate it has a query even if it does.
+ try{
+ CompositeData composite = URISupport::parseComposite( uri );
+ *this->properties = composite.getParameters();
+ } catch(URISyntaxException& ex) {}
}
// Check the connection options
@@ -174,6 +181,13 @@ namespace core{
this->defaultRedeliveryPolicy->configure( *properties );
}
+ static URI createURI(const std::string& uriString) {
+ try{
+ return URI(uriString);
+ } catch(URISyntaxException& ex) {
+ throw cms::CMSException("Invalid Connection Uri detected.");
+ }
+ }
};
}}
@@ -193,15 +207,15 @@ ActiveMQConnectionFactory::ActiveMQConne
const std::string& username,
const std::string& password ) : settings( new FactorySettings() ) {
- this->setBrokerURI( URI( uri ) );
+ this->setBrokerURI(FactorySettings::createURI(uri));
// Store login data in the properties
- if( !username.empty() ) {
+ if (!username.empty()) {
this->settings->username = username;
}
- if( !password.empty() ) {
- this->settings->password = password;
- }
+ if (!password.empty()) {
+ this->settings->password = password;
+ }
}
////////////////////////////////////////////////////////////////////////////////
@@ -209,15 +223,15 @@ ActiveMQConnectionFactory::ActiveMQConne
const std::string& username,
const std::string& password ) : settings( new FactorySettings() ) {
- this->setBrokerURI( uri );
+ this->setBrokerURI(uri);
- // Store login data in the properties
- if( !username.empty() ) {
- this->settings->username = username;
- }
- if( !password.empty() ) {
- this->settings->password = password;
- }
+ // Store login data in the properties
+ if (!username.empty()) {
+ this->settings->username = username;
+ }
+ if (!password.empty()) {
+ this->settings->password = password;
+ }
}
////////////////////////////////////////////////////////////////////////////////
@@ -392,14 +406,12 @@ void ActiveMQConnectionFactory::setClien
////////////////////////////////////////////////////////////////////////////////
void ActiveMQConnectionFactory::setBrokerURI( const std::string& uri ) {
- this->setBrokerURI( URI( uri ) );
+ this->setBrokerURI(FactorySettings::createURI(uri));
}
////////////////////////////////////////////////////////////////////////////////
void ActiveMQConnectionFactory::setBrokerURI( const decaf::net::URI& uri ) {
-
- // Update configuration with new authentication info if any was provided.
- this->settings->updateConfiguration( uri );
+ this->settings->updateConfiguration(uri);
}
////////////////////////////////////////////////////////////////////////////////