diff options
author | Benoit Foucher <benoit@zeroc.com> | 2013-01-15 18:46:12 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2013-01-15 18:46:12 +0100 |
commit | f561241d76b7a3d58a8652a8ae6642361f6d596b (patch) | |
tree | 06602625807c74e6476043eee42f304e15609592 /cpp/src | |
parent | Fixed(ICE-5184) -IceGridGUI will not allow me to enter port in connection cre... (diff) | |
download | ice-f561241d76b7a3d58a8652a8ae6642361f6d596b.tar.bz2 ice-f561241d76b7a3d58a8652a8ae6642361f6d596b.tar.xz ice-f561241d76b7a3d58a8652a8ae6642361f6d596b.zip |
Fixed ICE-5131 - parsing of -p <version> for proxies, tweaked UDP endpoint deprecation warning for -v/-e
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/Outgoing.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/OutgoingAsync.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/ReferenceFactory.cpp | 31 | ||||
-rw-r--r-- | cpp/src/Ice/UdpEndpointI.cpp | 28 |
4 files changed, 53 insertions, 14 deletions
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index 51f41bedd2b..acd4856aace 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -87,12 +87,12 @@ IceInternal::Outgoing::Outgoing(RequestHandler* handler, const string& operation _handler(handler), _observer(observer), _state(StateUnsent), - _encoding(checkForCompatibleEncoding(handler->getReference()->getEncoding())), + _encoding(getCompatibleEncoding(handler->getReference()->getEncoding())), _is(handler->getReference()->getInstance().get(), Ice::currentProtocolEncoding), _os(handler->getReference()->getInstance().get(), Ice::currentProtocolEncoding), _sent(false) { - checkSupportedProtocol(handler->getReference()->getProtocol()); + checkSupportedProtocol(getCompatibleProtocol(handler->getReference()->getProtocol())); switch(_handler->getReference()->getMode()) { diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 04e9eabdc02..9d15133ad8a 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -426,7 +426,7 @@ IceInternal::OutgoingAsync::OutgoingAsync(const ObjectPrx& prx, const Ice::LocalObjectPtr& cookie) : AsyncResult(prx->ice_getCommunicator(), prx->__reference()->getInstance(), operation, delegate, cookie), _proxy(prx), - _encoding(checkForCompatibleEncoding(prx->__reference()->getEncoding())) + _encoding(getCompatibleEncoding(prx->__reference()->getEncoding())) { } @@ -438,7 +438,7 @@ IceInternal::OutgoingAsync::__prepare(const std::string& operation, OperationMod _mode = mode; _sentSynchronously = false; - checkSupportedProtocol(_proxy->__reference()->getProtocol()); + checkSupportedProtocol(getCompatibleProtocol(_proxy->__reference()->getProtocol())); _observer.attach(_proxy.get(), operation, context); diff --git a/cpp/src/Ice/ReferenceFactory.cpp b/cpp/src/Ice/ReferenceFactory.cpp index b4193f3a374..57c01f213bf 100644 --- a/cpp/src/Ice/ReferenceFactory.cpp +++ b/cpp/src/Ice/ReferenceFactory.cpp @@ -190,6 +190,7 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP Reference::Mode mode = Reference::ModeTwoway; bool secure = false; Ice::EncodingVersion encoding = _instance->defaultsAndOverrides()->defaultEncoding; + Ice::ProtocolVersion protocol = Protocol_1_0; string adapter; while(true) @@ -372,7 +373,7 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP throw ex; } - try + try { encoding = Ice::stringToEncodingVersion(argument); } @@ -385,6 +386,28 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP break; } + case 'p': + { + if(argument.empty()) + { + Ice::ProxyParseException ex(__FILE__, __LINE__); + ex.str = "no argument provided for -p option in `" + s + "'"; + throw ex; + } + + try + { + protocol = Ice::stringToProtocolVersion(argument); + } + catch(const Ice::VersionParseException& e) + { + Ice::ProxyParseException ex(__FILE__, __LINE__); + ex.str = "invalid protocol version `" + argument + "' in `" + s + "':\n" + e.str; + throw ex; + } + break; + } + default: { ProxyParseException ex(__FILE__, __LINE__); @@ -396,7 +419,7 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP if(beg == string::npos) { - return create(ident, facet, mode, secure, Protocol_1_0, encoding, vector<EndpointIPtr>(), "", propertyPrefix); + return create(ident, facet, mode, secure, protocol, encoding, vector<EndpointIPtr>(), "", propertyPrefix); } vector<EndpointIPtr> endpoints; @@ -484,7 +507,7 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP } } - return create(ident, facet, mode, secure, Protocol_1_0, encoding, endpoints, "", propertyPrefix); + return create(ident, facet, mode, secure, protocol, encoding, endpoints, "", propertyPrefix); break; } case '@': @@ -548,7 +571,7 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP adapter = Ice::UTF8ToNative(_instance->initializationData().stringConverter, adapter); - return create(ident, facet, mode, secure, Protocol_1_0, encoding, endpoints, adapter, propertyPrefix); + return create(ident, facet, mode, secure, protocol, encoding, endpoints, adapter, propertyPrefix); break; } default: diff --git a/cpp/src/Ice/UdpEndpointI.cpp b/cpp/src/Ice/UdpEndpointI.cpp index 8d812e591dc..87cb12aafee 100644 --- a/cpp/src/Ice/UdpEndpointI.cpp +++ b/cpp/src/Ice/UdpEndpointI.cpp @@ -157,13 +157,29 @@ IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const strin } const_cast<bool&>(_compress) = true; } - else if(option == "-v") + else if(option == "-v" || option == "-e") { - _instance->initializationData().logger->warning("deprecated udp endpoint option: -v"); - } - else if(option == "-e") - { - _instance->initializationData().logger->warning("deprecated udp endpoint option: -e"); + if(argument.empty()) + { + EndpointParseException ex(__FILE__, __LINE__); + ex.str = "no argument provided for " + option + " option in endpoint `udp " + str + "'"; + throw ex; + } + try + { + Ice::Byte major, minor; + IceInternal::stringToMajorMinor(argument, major, minor); + if(major != 1 || minor != 0) + { + _instance->initializationData().logger->warning("deprecated udp endpoint option: " + option); + } + } + catch(const VersionParseException& e) + { + EndpointParseException ex(__FILE__, __LINE__); + ex.str = "invalid version `" + argument + "' in endpoint `udp " + str + "':\n" + e.str; + throw ex; + } } else if(option == "--interface") { |