diff options
-rw-r--r-- | CHANGELOG-3.7.md | 4 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 9 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.h | 1 | ||||
-rw-r--r-- | cpp/test/Ice/proxy/AllTests.cpp | 19 | ||||
-rw-r--r-- | csharp/src/Ice/Reference.cs | 5 | ||||
-rw-r--r-- | csharp/test/Ice/proxy/AllTests.cs | 20 | ||||
-rw-r--r-- | java-compat/src/Ice/src/main/java/IceInternal/FixedReference.java | 8 | ||||
-rw-r--r-- | java-compat/test/src/main/java/test/Ice/proxy/AllTests.java | 20 | ||||
-rw-r--r-- | java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java | 8 | ||||
-rw-r--r-- | java/test/src/main/java/test/Ice/proxy/AllTests.java | 20 | ||||
-rw-r--r-- | js/src/Ice/Reference.js | 5 | ||||
-rw-r--r-- | js/test/Ice/proxy/Client.js | 30 |
12 files changed, 110 insertions, 39 deletions
diff --git a/CHANGELOG-3.7.md b/CHANGELOG-3.7.md index bb4faca446a..b6c123396f6 100644 --- a/CHANGELOG-3.7.md +++ b/CHANGELOG-3.7.md @@ -93,6 +93,10 @@ 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. +- Fixed proxies stringification: `Communicator::proxyToString` and equivalent + "to string" methods on fixed proxies no longer raise a `FixedProxyException`; + the proxy is just stringified without endpoints. + - An empty endpoint in an Object Adapter endpoint list is now rejected with an `EndpointParseException`; such an endpoint was ignored in previous releases. diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index c55b3037a33..188ad33e5ee 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -734,15 +734,6 @@ IceInternal::FixedReference::streamWrite(OutputStream*) const throw FixedProxyException(__FILE__, __LINE__); } -string -IceInternal::FixedReference::toString() const -{ - throw FixedProxyException(__FILE__, __LINE__); - - assert(false); // Cannot be reached. - return string(); // To keep the compiler from complaining. -} - PropertyDict IceInternal::FixedReference::toProperty(const string&) const { diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h index d3612f6cedd..a48a61c66e4 100644 --- a/cpp/src/Ice/Reference.h +++ b/cpp/src/Ice/Reference.h @@ -212,7 +212,6 @@ public: virtual bool isWellKnown() const; virtual void streamWrite(Ice::OutputStream*) const; - virtual std::string toString() const; virtual Ice::PropertyDict toProperty(const std::string&) const; virtual RequestHandlerPtr getRequestHandler(const Ice::ObjectPrxPtr&) const; diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp index 82655d278e5..285dc5fae3f 100644 --- a/cpp/test/Ice/proxy/AllTests.cpp +++ b/cpp/test/Ice/proxy/AllTests.cpp @@ -380,6 +380,25 @@ allTests(const Ice::CommunicatorPtr& communicator) cout << "ok" << endl; + cout << "testing proxyToString... " << flush; + b1 = communicator->stringToProxy(ref); + Ice::ObjectPrxPtr b2 = communicator->stringToProxy(communicator->proxyToString(b1)); + test(Ice::targetEqualTo(b1, b2)); + + if(b1->ice_getConnection()) // not colloc-optimized target + { + b2 = b1->ice_getConnection()->createProxy(Ice::stringToIdentity("fixed")); + string str = communicator->proxyToString(b2); + test(b2->ice_toString() == str); + string str2 = b1->ice_identity(b2->ice_getIdentity())->ice_toString(); + + // Verify that the stringified fixed proxy is the same as a regular stringified proxy + // but without endpoints + test(str2.substr(0, str.size()) == str); + test(str2[str.size()] == ':'); + } + cout << "ok" << endl; + cout << "testing propertyToProxy... " << flush; Ice::PropertiesPtr prop = communicator->getProperties(); string propertyPrefix = "Foo.Proxy"; diff --git a/csharp/src/Ice/Reference.cs b/csharp/src/Ice/Reference.cs index 7c951193cac..cfd1019cc74 100644 --- a/csharp/src/Ice/Reference.cs +++ b/csharp/src/Ice/Reference.cs @@ -657,11 +657,6 @@ namespace IceInternal throw new Ice.FixedProxyException(); } - public override string ToString() - { - throw new Ice.FixedProxyException(); - } - public override Dictionary<string, string> toProperty(string prefix) { throw new Ice.FixedProxyException(); diff --git a/csharp/test/Ice/proxy/AllTests.cs b/csharp/test/Ice/proxy/AllTests.cs index 9647d0f271e..e611beaaeb4 100644 --- a/csharp/test/Ice/proxy/AllTests.cs +++ b/csharp/test/Ice/proxy/AllTests.cs @@ -364,6 +364,26 @@ public class AllTests : TestCommon.AllTests WriteLine("ok"); + Write("testing proxyToString... "); + Flush(); + b1 = communicator.stringToProxy(rf); + Ice.ObjectPrx b2 = communicator.stringToProxy(communicator.proxyToString(b1)); + test(b1.Equals(b2)); + + if(b1.ice_getConnection() != null) // not colloc-optimized target + { + b2 = b1.ice_getConnection().createProxy(Ice.Util.stringToIdentity("fixed")); + String str = communicator.proxyToString(b2); + test(b2.ToString() == str); + String str2 = b1.ice_identity(b2.ice_getIdentity()).ToString(); + + // Verify that the stringified fixed proxy is the same as a regular stringified proxy + // but without endpoints + test(str2.StartsWith(str)); + test(str2[str.Length] == ':'); + } + WriteLine("ok"); + Write("testing propertyToProxy... "); Flush(); Ice.Properties prop = communicator.getProperties(); diff --git a/java-compat/src/Ice/src/main/java/IceInternal/FixedReference.java b/java-compat/src/Ice/src/main/java/IceInternal/FixedReference.java index ed8532e8d12..ebc59c5e690 100644 --- a/java-compat/src/Ice/src/main/java/IceInternal/FixedReference.java +++ b/java-compat/src/Ice/src/main/java/IceInternal/FixedReference.java @@ -195,14 +195,6 @@ public class FixedReference extends Reference } @Override - public String - toString() - throws Ice.MarshalException - { - throw new Ice.FixedProxyException(); - } - - @Override public java.util.Map<String, String> toProperty(String prefix) { 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 23b30d28039..11669609013 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 @@ -382,6 +382,26 @@ public class AllTests out.println("ok"); + out.print("testing proxyToString... "); + out.flush(); + b1 = communicator.stringToProxy(ref); + Ice.ObjectPrx b2 = communicator.stringToProxy(communicator.proxyToString(b1)); + test(b1.equals(b2)); + + if(b1.ice_getConnection() != null) // not colloc-optimized target + { + b2 = b1.ice_getConnection().createProxy(Ice.Util.stringToIdentity("fixed")); + String str = communicator.proxyToString(b2); + test(b2.toString().equals(str)); + String str2 = b1.ice_identity(b2.ice_getIdentity()).toString(); + + // Verify that the stringified fixed proxy is the same as a regular stringified proxy + // but without endpoints + test(str2.startsWith(str)); + test(str2.charAt(str.length()) == ':'); + } + out.println("ok"); + out.print("testing propertyToProxy... "); out.flush(); Ice.Properties prop = communicator.getProperties(); diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java index d7d7ce1ba09..cfa3d1e871b 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java @@ -196,14 +196,6 @@ public class FixedReference extends Reference } @Override - public String - toString() - throws com.zeroc.Ice.MarshalException - { - throw new com.zeroc.Ice.FixedProxyException(); - } - - @Override public java.util.Map<String, String> toProperty(String prefix) { 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 841481a9899..27f39bdf452 100644 --- a/java/test/src/main/java/test/Ice/proxy/AllTests.java +++ b/java/test/src/main/java/test/Ice/proxy/AllTests.java @@ -384,6 +384,26 @@ public class AllTests out.println("ok"); + out.print("testing proxyToString... "); + out.flush(); + b1 = communicator.stringToProxy(ref); + com.zeroc.Ice.ObjectPrx b2 = communicator.stringToProxy(communicator.proxyToString(b1)); + test(b1.equals(b2)); + + if(b1.ice_getConnection() != null) // not colloc-optimized target + { + b2 = b1.ice_getConnection().createProxy(com.zeroc.Ice.Util.stringToIdentity("fixed")); + String str = communicator.proxyToString(b2); + test(b2.toString().equals(str)); + String str2 = b1.ice_identity(b2.ice_getIdentity()).toString(); + + // Verify that the stringified fixed proxy is the same as a regular stringified proxy + // but without endpoints + test(str2.startsWith(str)); + test(str2.charAt(str.length()) == ':'); + } + out.println("ok"); + out.print("testing propertyToProxy... "); out.flush(); com.zeroc.Ice.Properties prop = communicator.getProperties(); diff --git a/js/src/Ice/Reference.js b/js/src/Ice/Reference.js index fd2402b8371..043947c5191 100644 --- a/js/src/Ice/Reference.js +++ b/js/src/Ice/Reference.js @@ -1592,11 +1592,6 @@ class FixedReference extends Reference throw new Ice.FixedProxyException(); } - toString() - { - throw new Ice.FixedProxyException(); - } - toProperty(prefix) { throw new Ice.FixedProxyException(); diff --git a/js/test/Ice/proxy/Client.js b/js/test/Ice/proxy/Client.js index ab86fc63f1e..98f735c6e93 100644 --- a/js/test/Ice/proxy/Client.js +++ b/js/test/Ice/proxy/Client.js @@ -1106,9 +1106,33 @@ ).then(() => { out.writeLine("ok"); - var derived = Test.MyDerivedClassPrx.uncheckedCast(communicator.stringToProxy("test:default -p 12010")); - return derived.shutdown(); - }); + + out.write("testing proxyToString... "); + b1 = communicator.stringToProxy(ref); + b2 = communicator.stringToProxy(communicator.proxyToString(b1)); + test(b1.equals(b2)); + + return b1.ice_getConnection(); + } + ).then(con => + { + b2 = con.createProxy(Ice.stringToIdentity("fixed")); + str = communicator.proxyToString(b2); + test(b2.toString() === str); + str2 = b1.ice_identity(b2.ice_getIdentity()).toString(); + + // Verify that the stringified fixed proxy is the same as a regular stringified proxy + // but without endpoints + test(str2.startsWith(str)); + test(str2.charAt(str.length) === ':'); + + out.writeLine("ok"); + } + ).then(() => + { + var derived = Test.MyDerivedClassPrx.uncheckedCast(communicator.stringToProxy("test:default -p 12010")); + return derived.shutdown(); + }); } var run = function(out, id) |