diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/ObjectAdapterI.cpp | 11 | ||||
-rw-r--r-- | cpp/test/Ice/proxy/AllTests.cpp | 34 |
2 files changed, 38 insertions, 7 deletions
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index df7b4a81a77..e3b9cb2450c 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -1194,6 +1194,10 @@ Ice::ObjectAdapterI::parseEndpoints(const string& endpts, bool oaEndpoints) cons beg = endpts.find_first_not_of(delim, end); if(beg == string::npos) { + if(!endpoints.empty()) + { + throw EndpointParseException(__FILE__, __LINE__, "invalid empty object adapter endpoint"); + } break; } @@ -1242,17 +1246,14 @@ Ice::ObjectAdapterI::parseEndpoints(const string& endpts, bool oaEndpoints) cons if(end == beg) { - ++end; - continue; + throw EndpointParseException(__FILE__, __LINE__, "invalid empty object adapter endpoint"); } string s = endpts.substr(beg, end - beg); EndpointIPtr endp = _instance->endpointFactoryManager()->create(s, oaEndpoints); if(endp == 0) { - EndpointParseException ex(__FILE__, __LINE__); - ex.str = "invalid object adapter endpoint `" + s + "'"; - throw ex; + throw EndpointParseException(__FILE__, __LINE__, "invalid object adapter endpoint `" + s + "'"); } endpoints.push_back(endp); diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp index 269988a9119..82655d278e5 100644 --- a/cpp/test/Ice/proxy/AllTests.cpp +++ b/cpp/test/Ice/proxy/AllTests.cpp @@ -236,7 +236,7 @@ allTests(const Ice::CommunicatorPtr& communicator) try { - b1 = communicator->stringToProxy("test:tcp@adapterId"); + communicator->stringToProxy("test:tcp@adapterId"); test(false); } catch(const Ice::EndpointParseException&) @@ -254,7 +254,37 @@ allTests(const Ice::CommunicatorPtr& communicator) //} try { - b1 = communicator->stringToProxy("test::tcp"); + communicator->stringToProxy("test: :tcp"); + test(false); + } + catch(const Ice::EndpointParseException&) + { + } + + // + // Test invalid endpoint syntax + // + try + { + communicator->createObjectAdapterWithEndpoints("BadAdapter", " : "); + test(false); + } + catch(const Ice::EndpointParseException&) + { + } + + try + { + communicator->createObjectAdapterWithEndpoints("BadAdapter", "tcp: "); + test(false); + } + catch(const Ice::EndpointParseException&) + { + } + + try + { + communicator->createObjectAdapterWithEndpoints("BadAdapter", ":tcp"); test(false); } catch(const Ice::EndpointParseException&) |