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