diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/src/Ice/src/main/java/com/zeroc/Ice/ObjectAdapterI.java | 11 | ||||
-rw-r--r-- | java/test/src/main/java/test/Ice/proxy/AllTests.java | 34 |
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) |