summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2017-01-12 14:39:56 -0500
committerBernard Normier <bernard@zeroc.com>2017-01-12 14:39:56 -0500
commit21d56ef199fe0002c90b57d873878ac9ba4a32e1 (patch)
treea39441e45379a574beb6563cb5b5c34cdcdf5cb1
parentRevert "Replaced Borders by Paddings to eliminate deprecation warnings" (diff)
downloadice-21d56ef199fe0002c90b57d873878ac9ba4a32e1.tar.bz2
ice-21d56ef199fe0002c90b57d873878ac9ba4a32e1.tar.xz
ice-21d56ef199fe0002c90b57d873878ac9ba4a32e1.zip
Reject empty endpoint in OA endpoint list
-rw-r--r--CHANGELOG-3.7.md3
-rw-r--r--cpp/src/Ice/ObjectAdapterI.cpp11
-rw-r--r--cpp/test/Ice/proxy/AllTests.cpp34
-rw-r--r--csharp/src/Ice/ObjectAdapterI.cs11
-rw-r--r--csharp/test/Ice/proxy/AllTests.cs34
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ObjectAdapterI.java11
-rw-r--r--java-compat/test/src/main/java/test/Ice/proxy/AllTests.java34
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ObjectAdapterI.java11
-rw-r--r--java/test/src/main/java/test/Ice/proxy/AllTests.java34
9 files changed, 155 insertions, 28 deletions
diff --git a/CHANGELOG-3.7.md b/CHANGELOG-3.7.md
index 97c55c60ffa..27542717973 100644
--- a/CHANGELOG-3.7.md
+++ b/CHANGELOG-3.7.md
@@ -93,6 +93,9 @@ These are the changes since Ice 3.6.3.
and universal character names (\unnnn and \Unnnnnnnn). See the property
Ice.ToStringMode and the static function/method identityToString.
+- An empty endpoint in an Object Adapter endpoint list is now rejected with an
+ `EndpointParseException`; such an endpoint was ignored in previous releases.
+
- IcePatch2 and IceGrid's distribution mechanism have been deprecated.
## C++ Changes
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&)
diff --git a/csharp/src/Ice/ObjectAdapterI.cs b/csharp/src/Ice/ObjectAdapterI.cs
index 26523708c67..5929b46fd3c 100644
--- a/csharp/src/Ice/ObjectAdapterI.cs
+++ b/csharp/src/Ice/ObjectAdapterI.cs
@@ -1118,6 +1118,10 @@ namespace Ice
beg = IceUtilInternal.StringUtil.findFirstNotOf(endpts, delim, end);
if(beg == -1)
{
+ if(endpoints.Count != 0)
+ {
+ throw new EndpointParseException("invalid empty object adapter endpoint");
+ }
break;
}
@@ -1166,17 +1170,14 @@ namespace Ice
if(end == beg)
{
- ++end;
- continue;
+ throw new EndpointParseException("invalid empty object adapter endpoint");
}
string s = endpts.Substring(beg, (end) - (beg));
EndpointI endp = _instance.endpointFactoryManager().create(s, oaEndpoints);
if(endp == null)
{
- EndpointParseException e2 = new EndpointParseException();
- e2.str = "invalid object adapter endpoint `" + s + "'";
- throw e2;
+ throw new EndpointParseException("invalid object adapter endpoint `" + s + "'");
}
endpoints.Add(endp);
diff --git a/csharp/test/Ice/proxy/AllTests.cs b/csharp/test/Ice/proxy/AllTests.cs
index a98997603b1..9647d0f271e 100644
--- a/csharp/test/Ice/proxy/AllTests.cs
+++ b/csharp/test/Ice/proxy/AllTests.cs
@@ -226,7 +226,7 @@ public class AllTests : TestCommon.AllTests
try
{
- b1 = communicator.stringToProxy("test:tcp@adapterId");
+ communicator.stringToProxy("test:tcp@adapterId");
test(false);
}
catch(Ice.EndpointParseException)
@@ -244,7 +244,37 @@ public class AllTests : TestCommon.AllTests
//}
try
{
- b1 = communicator.stringToProxy("test::tcp");
+ communicator.stringToProxy("test: :tcp");
+ test(false);
+ }
+ catch(Ice.EndpointParseException)
+ {
+ }
+
+ //
+ // Test invalid endpoint syntax
+ //
+ try
+ {
+ communicator.createObjectAdapterWithEndpoints("BadAdapter", " : ");
+ test(false);
+ }
+ catch(Ice.EndpointParseException)
+ {
+ }
+
+ try
+ {
+ communicator.createObjectAdapterWithEndpoints("BadAdapter", "tcp: ");
+ test(false);
+ }
+ catch(Ice.EndpointParseException)
+ {
+ }
+
+ try
+ {
+ communicator.createObjectAdapterWithEndpoints("BadAdapter", ":tcp");
test(false);
}
catch(Ice.EndpointParseException)
diff --git a/java-compat/src/Ice/src/main/java/Ice/ObjectAdapterI.java b/java-compat/src/Ice/src/main/java/Ice/ObjectAdapterI.java
index f0497ea6b7c..9ab45240784 100644
--- a/java-compat/src/Ice/src/main/java/Ice/ObjectAdapterI.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ObjectAdapterI.java
@@ -1211,6 +1211,10 @@ public final class ObjectAdapterI implements ObjectAdapter
beg = IceUtilInternal.StringUtil.findFirstNotOf(endpts, delim, end);
if(beg == -1)
{
+ if(!endpoints.isEmpty())
+ {
+ throw new EndpointParseException("invalid empty object adapter endpoint");
+ }
break;
}
@@ -1259,17 +1263,14 @@ public final class ObjectAdapterI implements ObjectAdapter
if(end == beg)
{
- ++end;
- continue;
+ throw new EndpointParseException("invalid empty object adapter endpoint");
}
String s = endpts.substring(beg, end);
IceInternal.EndpointI endp = _instance.endpointFactoryManager().create(s, oaEndpoints);
if(endp == null)
{
- Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "invalid object adapter endpoint `" + s + "'";
- throw e;
+ throw new Ice.EndpointParseException("invalid object adapter endpoint `" + s + "'");
}
endpoints.add(endp);
diff --git a/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java b/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java
index ed2561faf1b..23b30d28039 100644
--- a/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java
+++ b/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java
@@ -244,7 +244,7 @@ public class AllTests
try
{
- b1 = communicator.stringToProxy("test:tcp@adapterId");
+ communicator.stringToProxy("test:tcp@adapterId");
test(false);
}
catch(Ice.EndpointParseException ex)
@@ -262,7 +262,37 @@ public class AllTests
//}
try
{
- b1 = communicator.stringToProxy("test::tcp");
+ communicator.stringToProxy("test: :tcp");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ //
+ // Test invalid endpoint syntax
+ //
+ try
+ {
+ communicator.createObjectAdapterWithEndpoints("BadAdapter", " : ");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ communicator.createObjectAdapterWithEndpoints("BadAdapter", "tcp: ");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ communicator.createObjectAdapterWithEndpoints("BadAdapter", ":tcp");
test(false);
}
catch(Ice.EndpointParseException ex)
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectAdapterI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectAdapterI.java
index 1bbe0aa90e6..de83357a228 100644
--- a/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectAdapterI.java
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectAdapterI.java
@@ -1210,6 +1210,10 @@ public final class ObjectAdapterI implements ObjectAdapter
beg = com.zeroc.IceUtilInternal.StringUtil.findFirstNotOf(endpts, delim, end);
if(beg == -1)
{
+ if(!endpoints.isEmpty())
+ {
+ throw new EndpointParseException("invalid empty object adapter endpoint");
+ }
break;
}
@@ -1258,17 +1262,14 @@ public final class ObjectAdapterI implements ObjectAdapter
if(end == beg)
{
- ++end;
- continue;
+ throw new EndpointParseException("invalid empty object adapter endpoint");
}
String s = endpts.substring(beg, end);
com.zeroc.IceInternal.EndpointI endp = _instance.endpointFactoryManager().create(s, oaEndpoints);
if(endp == null)
{
- EndpointParseException e = new EndpointParseException();
- e.str = "invalid object adapter endpoint `" + s + "'";
- throw e;
+ throw new EndpointParseException("invalid object adapter endpoint `" + s + "'");
}
endpoints.add(endp);
diff --git a/java/test/src/main/java/test/Ice/proxy/AllTests.java b/java/test/src/main/java/test/Ice/proxy/AllTests.java
index be50024641a..841481a9899 100644
--- a/java/test/src/main/java/test/Ice/proxy/AllTests.java
+++ b/java/test/src/main/java/test/Ice/proxy/AllTests.java
@@ -246,7 +246,7 @@ public class AllTests
try
{
- b1 = communicator.stringToProxy("test:tcp@adapterId");
+ communicator.stringToProxy("test:tcp@adapterId");
test(false);
}
catch(com.zeroc.Ice.EndpointParseException ex)
@@ -264,7 +264,37 @@ public class AllTests
//}
try
{
- b1 = communicator.stringToProxy("test::tcp");
+ communicator.stringToProxy("test: :tcp");
+ test(false);
+ }
+ catch(com.zeroc.Ice.EndpointParseException ex)
+ {
+ }
+
+ //
+ // Test invalid endpoint syntax
+ //
+ try
+ {
+ communicator.createObjectAdapterWithEndpoints("BadAdapter", " : ");
+ test(false);
+ }
+ catch(com.zeroc.Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ communicator.createObjectAdapterWithEndpoints("BadAdapter", "tcp: ");
+ test(false);
+ }
+ catch(com.zeroc.Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ communicator.createObjectAdapterWithEndpoints("BadAdapter", ":tcp");
test(false);
}
catch(com.zeroc.Ice.EndpointParseException ex)