summaryrefslogtreecommitdiff
path: root/java-compat
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 /java-compat
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
Diffstat (limited to 'java-compat')
-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
2 files changed, 38 insertions, 7 deletions
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)