summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-05-23 18:47:34 +0200
committerBenoit Foucher <benoit@zeroc.com>2017-05-23 18:47:34 +0200
commit0593db2ff6438f0c259144822c6f0ada1f7b79df (patch)
tree8400faa0d5bbdd95fcfe03fb9adfb8e117f9da07
parentFix whitespace (diff)
downloadice-0593db2ff6438f0c259144822c6f0ada1f7b79df.tar.bz2
ice-0593db2ff6438f0c259144822c6f0ada1f7b79df.tar.xz
ice-0593db2ff6438f0c259144822c6f0ada1f7b79df.zip
Fixed ICE-7884 - TwowayOnlyException is now raised for twoway invocations on oneway proxies
-rw-r--r--cpp/src/Glacier2Lib/SessionHelper.cpp4
-rw-r--r--cpp/src/Ice/Proxy.cpp16
-rw-r--r--cpp/src/IceSSL/OpenSSLCertificateI.cpp4
-rw-r--r--cpp/src/IceSSL/SChannelCertificateI.cpp4
-rw-r--r--cpp/src/IceSSL/SecureTransportCertificateI.cpp4
-rw-r--r--cpp/test/Ice/ami/AllTests.cpp4
-rw-r--r--cpp/test/Ice/binding/AllTests.cpp3
-rw-r--r--cpp/test/Ice/operations/Oneways.cpp16
-rw-r--r--cpp/test/Ice/operations/OnewaysAMI.cpp28
-rw-r--r--cpp/test/Ice/proxy/AllTests.cpp36
-rw-r--r--csharp/src/Ice/Proxy.cs2
-rw-r--r--csharp/test/Ice/ami/AllTests.cs4
-rw-r--r--csharp/test/Ice/binding/AllTests.cs2
-rw-r--r--csharp/test/Ice/operations/Oneways.cs2
-rw-r--r--csharp/test/Ice/operations/OnewaysAMI.cs14
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java116
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsync.java3
-rw-r--r--java/test/src/main/java/test/Ice/binding/AllTests.java2
-rw-r--r--java/test/src/main/java/test/Ice/operations/Oneways.java2
-rw-r--r--java/test/src/main/java/test/Ice/operations/OnewaysAMI.java8
-rw-r--r--js/src/Ice/ObjectPrx.js2
-rw-r--r--js/test/Ice/operations/Oneways.js4
22 files changed, 160 insertions, 120 deletions
diff --git a/cpp/src/Glacier2Lib/SessionHelper.cpp b/cpp/src/Glacier2Lib/SessionHelper.cpp
index 3891e31ab7f..b5d436c7503 100644
--- a/cpp/src/Glacier2Lib/SessionHelper.cpp
+++ b/cpp/src/Glacier2Lib/SessionHelper.cpp
@@ -1041,7 +1041,11 @@ Glacier2::SessionFactoryHelper::setProtocol(const string& protocol)
protocol != "ws" &&
protocol != "wss")
{
+#ifdef ICE_CPP11_MAPPING
+ throw invalid_argument("Unknown protocol `" + protocol + "'");
+#else
throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "Unknown protocol `" + protocol + "'");
+#endif
}
_protocol = protocol;
}
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index b46545c35c1..7b7a7311fa6 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -239,9 +239,7 @@ Ice::ObjectPrx::_checkTwowayOnly(const string& name) const
//
if(!ice_isTwoway())
{
- throw IceUtil::IllegalArgumentException(__FILE__,
- __LINE__,
- "`" + name + "' can only be called with a twoway proxy");
+ throw Ice::TwowayOnlyException(__FILE__, __LINE__, name);
}
}
@@ -852,7 +850,11 @@ ICE_OBJECT_PRX::ice_locatorCacheTimeout(Int newTimeout) const
{
ostringstream s;
s << "invalid value passed to ice_locatorCacheTimeout: " << newTimeout;
+#ifdef ICE_CPP11_MAPPING
+ throw invalid_argument(s.str());
+#else
throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, s.str());
+#endif
}
if(newTimeout == _reference->getLocatorCacheTimeout())
{
@@ -1059,7 +1061,11 @@ ICE_OBJECT_PRX::ice_invocationTimeout(Int newTimeout) const
{
ostringstream s;
s << "invalid value passed to ice_invocationTimeout: " << newTimeout;
+#ifdef ICE_CPP11_MAPPING
+ throw invalid_argument(s.str());
+#else
throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, s.str());
+#endif
}
if(newTimeout == _reference->getInvocationTimeout())
{
@@ -1201,7 +1207,11 @@ ICE_OBJECT_PRX::ice_timeout(int t) const
{
ostringstream s;
s << "invalid value passed to ice_timeout: " << t;
+#ifdef ICE_CPP11_MAPPING
+ throw invalid_argument(s.str());
+#else
throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, s.str());
+#endif
}
ReferencePtr ref = _reference->changeTimeout(t);
if(ref == _reference)
diff --git a/cpp/src/IceSSL/OpenSSLCertificateI.cpp b/cpp/src/IceSSL/OpenSSLCertificateI.cpp
index 03c0d304d51..afdd6b7c815 100644
--- a/cpp/src/IceSSL/OpenSSLCertificateI.cpp
+++ b/cpp/src/IceSSL/OpenSSLCertificateI.cpp
@@ -349,7 +349,11 @@ OpenSSLCertificateI::OpenSSLCertificateI(x509_st* cert) : _cert(cert)
{
if(!_cert)
{
+#ifdef ICE_CPP11_MAPPING
+ throw invalid_argument("Invalid certificate reference");
+#else
throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "Invalid certificate reference");
+#endif
}
}
diff --git a/cpp/src/IceSSL/SChannelCertificateI.cpp b/cpp/src/IceSSL/SChannelCertificateI.cpp
index c0a357fd63e..0767bd4efb9 100644
--- a/cpp/src/IceSSL/SChannelCertificateI.cpp
+++ b/cpp/src/IceSSL/SChannelCertificateI.cpp
@@ -312,7 +312,11 @@ SChannelCertificateI::SChannelCertificateI(CERT_SIGNED_CONTENT_INFO* cert) :
{
if(!_cert)
{
+#ifdef ICE_CPP11_MAPPING
+ throw invalid_argument("Invalid certificate reference");
+#else
throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "Invalid certificate reference");
+#endif
}
try
diff --git a/cpp/src/IceSSL/SecureTransportCertificateI.cpp b/cpp/src/IceSSL/SecureTransportCertificateI.cpp
index 0e90b61ae00..00b60e1854b 100644
--- a/cpp/src/IceSSL/SecureTransportCertificateI.cpp
+++ b/cpp/src/IceSSL/SecureTransportCertificateI.cpp
@@ -409,7 +409,11 @@ SecureTransportCertificateI::SecureTransportCertificateI(SecCertificateRef cert)
{
if(!_cert)
{
+#ifdef ICE_CPP11_MAPPING
+ throw invalid_argument("Invalid certificate reference");
+#else
throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "Invalid certificate reference");
+#endif
}
}
diff --git a/cpp/test/Ice/ami/AllTests.cpp b/cpp/test/Ice/ami/AllTests.cpp
index da4b801009c..4d58e2e2165 100644
--- a/cpp/test/Ice/ami/AllTests.cpp
+++ b/cpp/test/Ice/ami/AllTests.cpp
@@ -1408,7 +1408,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
});
test(false);
}
- catch(const IceUtil::IllegalArgumentException&)
+ catch(const Ice::TwowayOnlyException&)
{
}
}
@@ -1466,7 +1466,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
p->ice_oneway()->opWithResultAsync().get();
test(false);
}
- catch(const IceUtil::IllegalArgumentException&)
+ catch(const Ice::TwowayOnlyException&)
{
}
diff --git a/cpp/test/Ice/binding/AllTests.cpp b/cpp/test/Ice/binding/AllTests.cpp
index 8846dba22e2..0024e1b740d 100644
--- a/cpp/test/Ice/binding/AllTests.cpp
+++ b/cpp/test/Ice/binding/AllTests.cpp
@@ -842,9 +842,6 @@ allTests(const Ice::CommunicatorPtr& communicator)
catch(const Ice::TwowayOnlyException&)
{
}
- catch(const IceUtil::IllegalArgumentException&)
- {
- }
}
cout << "ok" << endl;
diff --git a/cpp/test/Ice/operations/Oneways.cpp b/cpp/test/Ice/operations/Oneways.cpp
index 693cbf68755..474d38ca3b8 100644
--- a/cpp/test/Ice/operations/Oneways.cpp
+++ b/cpp/test/Ice/operations/Oneways.cpp
@@ -28,11 +28,7 @@ oneways(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy)
p->ice_isA("dummy");
test(false);
}
-#ifdef ICE_CPP11_MAPPING
- catch(const IceUtil::IllegalArgumentException&)
-#else
catch(const Ice::TwowayOnlyException&)
-#endif
{
}
}
@@ -43,11 +39,7 @@ oneways(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy)
p->ice_id();
test(false);
}
-#ifdef ICE_CPP11_MAPPING
- catch(const IceUtil::IllegalArgumentException&)
-#else
catch(const Ice::TwowayOnlyException&)
-#endif
{
}
}
@@ -58,11 +50,7 @@ oneways(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy)
p->ice_ids();
test(false);
}
-#ifdef ICE_CPP11_MAPPING
- catch(const IceUtil::IllegalArgumentException&)
-#else
catch(const Ice::TwowayOnlyException&)
-#endif
{
}
}
@@ -87,11 +75,7 @@ oneways(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy)
p->opByte(Ice::Byte(0xff), Ice::Byte(0x0f), b);
test(false);
}
-#ifdef ICE_CPP11_MAPPING
- catch(const IceUtil::IllegalArgumentException&)
-#else
catch(const Ice::TwowayOnlyException&)
-#endif
{
}
}
diff --git a/cpp/test/Ice/operations/OnewaysAMI.cpp b/cpp/test/Ice/operations/OnewaysAMI.cpp
index 681f55ac74b..a067c6f2d8d 100644
--- a/cpp/test/Ice/operations/OnewaysAMI.cpp
+++ b/cpp/test/Ice/operations/OnewaysAMI.cpp
@@ -120,7 +120,11 @@ onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy)
#endif
test(false);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const Ice::TwowayOnlyException&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
}
}
@@ -139,7 +143,11 @@ onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy)
#endif
test(false);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const Ice::TwowayOnlyException&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
}
}
@@ -157,7 +165,11 @@ onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy)
#endif
test(false);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const Ice::TwowayOnlyException&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
}
}
@@ -239,7 +251,11 @@ onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy)
#endif
test(false);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const Ice::TwowayOnlyException&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
}
}
@@ -271,7 +287,11 @@ onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy)
p->ice_isAAsync(Test::MyClass::ice_staticId());
test(false);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const Ice::TwowayOnlyException&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
}
}
@@ -282,7 +302,11 @@ onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy)
p->ice_idAsync();
test(false);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const Ice::TwowayOnlyException&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
}
}
@@ -293,7 +317,11 @@ onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr& proxy)
p->ice_idsAsync();
test(false);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const Ice::TwowayOnlyException&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
}
}
diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp
index d3785ad6eef..8c04095bc86 100644
--- a/cpp/test/Ice/proxy/AllTests.cpp
+++ b/cpp/test/Ice/proxy/AllTests.cpp
@@ -600,7 +600,11 @@ allTests(const Ice::CommunicatorPtr& communicator)
base->ice_timeout(0);
test(false);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const invalid_argument&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
}
@@ -608,7 +612,11 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
base->ice_timeout(-1);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const invalid_argument&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
test(false);
}
@@ -618,7 +626,11 @@ allTests(const Ice::CommunicatorPtr& communicator)
base->ice_timeout(-2);
test(false);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const invalid_argument&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
}
@@ -627,7 +639,11 @@ allTests(const Ice::CommunicatorPtr& communicator)
base->ice_invocationTimeout(0);
test(false);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const invalid_argument&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
}
@@ -636,7 +652,11 @@ allTests(const Ice::CommunicatorPtr& communicator)
base->ice_invocationTimeout(-1);
base->ice_invocationTimeout(-2);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const invalid_argument&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
test(false);
}
@@ -646,7 +666,11 @@ allTests(const Ice::CommunicatorPtr& communicator)
base->ice_invocationTimeout(-3);
test(false);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const invalid_argument&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
}
@@ -654,7 +678,11 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
base->ice_locatorCacheTimeout(0);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const invalid_argument&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
test(false);
}
@@ -663,7 +691,11 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
base->ice_locatorCacheTimeout(-1);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const invalid_argument&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
test(false);
}
@@ -673,7 +705,11 @@ allTests(const Ice::CommunicatorPtr& communicator)
base->ice_locatorCacheTimeout(-2);
test(false);
}
+#ifdef ICE_CPP11_MAPPING
+ catch(const invalid_argument&)
+#else
catch(const IceUtil::IllegalArgumentException&)
+#endif
{
}
diff --git a/csharp/src/Ice/Proxy.cs b/csharp/src/Ice/Proxy.cs
index eb0b93a52ae..2394512604b 100644
--- a/csharp/src/Ice/Proxy.cs
+++ b/csharp/src/Ice/Proxy.cs
@@ -2486,7 +2486,7 @@ namespace Ice
if(!ice_isTwoway())
{
- throw new ArgumentException("`" + name + "' can only be called with a twoway proxy");
+ throw new TwowayOnlyException(name);
}
}
diff --git a/csharp/test/Ice/ami/AllTests.cs b/csharp/test/Ice/ami/AllTests.cs
index 985c1f77eed..3e819949085 100644
--- a/csharp/test/Ice/ami/AllTests.cs
+++ b/csharp/test/Ice/ami/AllTests.cs
@@ -1291,7 +1291,7 @@ public class AllTests : TestCommon.AllTests
r = ((Test.TestIntfPrx)p.ice_oneway()).begin_opWithResult();
test(false);
}
- catch(System.ArgumentException)
+ catch(Ice.TwowayOnlyException)
{
}
@@ -1343,7 +1343,7 @@ public class AllTests : TestCommon.AllTests
((Test.TestIntfPrx)p.ice_oneway()).opWithResultAsync();
test(false);
}
- catch(System.ArgumentException)
+ catch(Ice.TwowayOnlyException)
{
}
diff --git a/csharp/test/Ice/binding/AllTests.cs b/csharp/test/Ice/binding/AllTests.cs
index b7cb26d2502..9d462301169 100644
--- a/csharp/test/Ice/binding/AllTests.cs
+++ b/csharp/test/Ice/binding/AllTests.cs
@@ -742,7 +742,7 @@ public class AllTests : TestCommon.AllTests
{
testUDP.getAdapterName();
}
- catch(System.ArgumentException)
+ catch(Ice.TwowayOnlyException)
{
}
}
diff --git a/csharp/test/Ice/operations/Oneways.cs b/csharp/test/Ice/operations/Oneways.cs
index 5e80da2e57c..d291c4be95f 100644
--- a/csharp/test/Ice/operations/Oneways.cs
+++ b/csharp/test/Ice/operations/Oneways.cs
@@ -45,7 +45,7 @@ class Oneways
p.opByte((byte)0xff, (byte)0x0f, out b);
test(false);
}
- catch(System.ArgumentException)
+ catch(Ice.TwowayOnlyException)
{
}
}
diff --git a/csharp/test/Ice/operations/OnewaysAMI.cs b/csharp/test/Ice/operations/OnewaysAMI.cs
index f9d8feecc6d..21a46e6a475 100644
--- a/csharp/test/Ice/operations/OnewaysAMI.cs
+++ b/csharp/test/Ice/operations/OnewaysAMI.cs
@@ -113,7 +113,7 @@ public class OnewaysAMI
p.ice_isAAsync("::Test::MyClass");
test(false);
}
- catch(ArgumentException)
+ catch(Ice.TwowayOnlyException)
{
}
}
@@ -124,7 +124,7 @@ public class OnewaysAMI
p.begin_ice_isA("::Test::MyClass");
test(false);
}
- catch(ArgumentException)
+ catch(Ice.TwowayOnlyException)
{
}
}
@@ -135,7 +135,7 @@ public class OnewaysAMI
p.ice_idAsync();
test(false);
}
- catch(ArgumentException)
+ catch(Ice.TwowayOnlyException)
{
}
}
@@ -146,7 +146,7 @@ public class OnewaysAMI
p.begin_ice_id();
test(false);
}
- catch(ArgumentException)
+ catch(Ice.TwowayOnlyException)
{
}
}
@@ -157,7 +157,7 @@ public class OnewaysAMI
p.begin_ice_ids();
test(false);
}
- catch(ArgumentException)
+ catch(Ice.TwowayOnlyException)
{
}
}
@@ -261,7 +261,7 @@ public class OnewaysAMI
p.opByteAsync(0xff, 0x0f);
test(false);
}
- catch(ArgumentException)
+ catch(Ice.TwowayOnlyException)
{
}
}
@@ -272,7 +272,7 @@ public class OnewaysAMI
p.begin_opByte(0xff, 0x0f);
test(false);
}
- catch(ArgumentException)
+ catch(Ice.TwowayOnlyException)
{
}
}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java
index 4c7d7e63c4c..2d35e26ce02 100644
--- a/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java
@@ -11,6 +11,8 @@ package com.zeroc.Ice;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
import com.zeroc.IceInternal.OutgoingAsync;
@@ -29,37 +31,25 @@ public class _ObjectPrxI implements ObjectPrx, java.io.Serializable
return ice_isA(id, ObjectPrx.noExplicitContext);
}
- public boolean ice_isA(String id, java.util.Map<String, String> context)
+ public boolean ice_isA(String id, Map<String, String> context)
{
return _iceI_ice_isAAsync(id, context, true).waitForResponse();
}
- public java.util.concurrent.CompletableFuture<java.lang.Boolean> ice_isAAsync(String id)
+ public CompletableFuture<Boolean> ice_isAAsync(String id)
{
return _iceI_ice_isAAsync(id, ObjectPrx.noExplicitContext, false);
}
- public java.util.concurrent.CompletableFuture<java.lang.Boolean> ice_isAAsync(
- String id,
- java.util.Map<String, String> context)
+ public CompletableFuture<Boolean> ice_isAAsync(String id, Map<String, String> context)
{
return _iceI_ice_isAAsync(id, context, false);
}
- private OutgoingAsync<java.lang.Boolean> _iceI_ice_isAAsync(
- String id,
- java.util.Map<String, String> context,
- boolean sync)
- {
- OutgoingAsync<java.lang.Boolean> f =
- new OutgoingAsync<>(this, "ice_isA", OperationMode.Nonmutating, sync, null);
- f.invoke(true, context, null, ostr -> {
- ostr.writeString(id);
- }, istr -> {
- boolean ret;
- ret = istr.readBool();
- return ret;
- });
+ private OutgoingAsync<Boolean> _iceI_ice_isAAsync(String id, Map<String, String> context, boolean sync)
+ {
+ OutgoingAsync<Boolean> f = new OutgoingAsync<>(this, "ice_isA", OperationMode.Nonmutating, sync, null);
+ f.invoke(true, context, null, ostr -> ostr.writeString(id), istr -> istr.readBool());
return f;
}
@@ -68,24 +58,22 @@ public class _ObjectPrxI implements ObjectPrx, java.io.Serializable
ice_ping(ObjectPrx.noExplicitContext);
}
- public void ice_ping(java.util.Map<String, String> context)
+ public void ice_ping(Map<String, String> context)
{
_iceI_ice_pingAsync(context, true).waitForResponse();
}
- public java.util.concurrent.CompletableFuture<Void> ice_pingAsync()
+ public CompletableFuture<Void> ice_pingAsync()
{
return _iceI_ice_pingAsync(ObjectPrx.noExplicitContext, false);
}
- public java.util.concurrent.CompletableFuture<Void> ice_pingAsync(java.util.Map<String, String> context)
+ public CompletableFuture<Void> ice_pingAsync(Map<String, String> context)
{
return _iceI_ice_pingAsync(context, false);
}
- private OutgoingAsync<Void> _iceI_ice_pingAsync(
- java.util.Map<String, String> context,
- boolean sync)
+ private OutgoingAsync<Void> _iceI_ice_pingAsync(Map<String, String> context, boolean sync)
{
OutgoingAsync<Void> f = new OutgoingAsync<>(this, "ice_ping", OperationMode.Nonmutating, sync, null);
f.invoke(false, context, null, null, null);
@@ -97,30 +85,25 @@ public class _ObjectPrxI implements ObjectPrx, java.io.Serializable
return ice_ids(ObjectPrx.noExplicitContext);
}
- public String[] ice_ids(java.util.Map<String, String> context)
+ public String[] ice_ids(Map<String, String> context)
{
return _iceI_ice_idsAsync(context, true).waitForResponse();
}
- public java.util.concurrent.CompletableFuture<String[]> ice_idsAsync()
+ public CompletableFuture<String[]> ice_idsAsync()
{
return _iceI_ice_idsAsync(ObjectPrx.noExplicitContext, false);
}
- public java.util.concurrent.CompletableFuture<String[]> ice_idsAsync(java.util.Map<String, String> context)
+ public CompletableFuture<String[]> ice_idsAsync(Map<String, String> context)
{
return _iceI_ice_idsAsync(context, false);
}
- private OutgoingAsync<String[]> _iceI_ice_idsAsync(
- java.util.Map<String, String> context,
- boolean sync)
+ private OutgoingAsync<String[]> _iceI_ice_idsAsync(Map<String, String> context, boolean sync)
{
- OutgoingAsync<String[]> f =
- new OutgoingAsync<>(this, "ice_ids", OperationMode.Nonmutating, sync, null);
- f.invoke(true, context, null, null, istr -> {
- return istr.readStringSeq();
- });
+ OutgoingAsync<String[]> f = new OutgoingAsync<>(this, "ice_ids", OperationMode.Nonmutating, sync, null);
+ f.invoke(true, context, null, null, istr -> istr.readStringSeq());
return f;
}
@@ -129,72 +112,56 @@ public class _ObjectPrxI implements ObjectPrx, java.io.Serializable
return ice_id(ObjectPrx.noExplicitContext);
}
- public String ice_id(java.util.Map<String, String> context)
+ public String ice_id(Map<String, String> context)
{
return _iceI_ice_idAsync(context, true).waitForResponse();
}
- public java.util.concurrent.CompletableFuture<java.lang.String> ice_idAsync()
+ public CompletableFuture<String> ice_idAsync()
{
return _iceI_ice_idAsync(ObjectPrx.noExplicitContext, false);
}
- public java.util.concurrent.CompletableFuture<java.lang.String> ice_idAsync(java.util.Map<String, String> context)
+ public CompletableFuture<String> ice_idAsync(Map<String, String> context)
{
return _iceI_ice_idAsync(context, false);
}
- private OutgoingAsync<java.lang.String> _iceI_ice_idAsync(
- java.util.Map<String, String> context,
- boolean sync)
+ private OutgoingAsync<String> _iceI_ice_idAsync(Map<String, String> context, boolean sync)
{
- OutgoingAsync<java.lang.String> f =
- new OutgoingAsync<>(this, "ice_id", OperationMode.Nonmutating, sync, null);
- f.invoke(true, context, null, null, istr -> {
- String ret;
- ret = istr.readString();
- return ret;
- });
+ OutgoingAsync<String> f = new OutgoingAsync<>(this, "ice_id", OperationMode.Nonmutating, sync, null);
+ f.invoke(true, context, null, null, istr -> istr.readString());
return f;
}
- public com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(String operation, OperationMode mode, byte[] inParams)
+ public Object.Ice_invokeResult ice_invoke(String operation, OperationMode mode, byte[] inParams)
{
return ice_invoke(operation, mode, inParams, ObjectPrx.noExplicitContext);
}
- public com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(String operation, OperationMode mode, byte[] inParams,
- java.util.Map<String, String> context)
+ public Object.Ice_invokeResult ice_invoke(String operation, OperationMode mode, byte[] inParams,
+ Map<String, String> context)
{
return _iceI_ice_invokeAsync(operation, mode, inParams, context, true).waitForResponse();
}
- public java.util.concurrent.CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> ice_invokeAsync(
- String operation,
- OperationMode mode,
- byte[] inParams)
+ public CompletableFuture<Object.Ice_invokeResult> ice_invokeAsync(String operation, OperationMode mode,
+ byte[] inParams)
{
return ice_invokeAsync(operation, mode, inParams, ObjectPrx.noExplicitContext);
}
- public java.util.concurrent.CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> ice_invokeAsync(
- String operation,
- OperationMode mode,
- byte[] inParams,
- java.util.Map<String, String> context)
+ public CompletableFuture<Object.Ice_invokeResult> ice_invokeAsync(String operation, OperationMode mode,
+ byte[] inParams, Map<String, String> context)
{
return _iceI_ice_invokeAsync(operation, mode, inParams, context, false);
}
- private com.zeroc.IceInternal.ProxyIceInvoke _iceI_ice_invokeAsync(
- String operation,
- OperationMode mode,
- byte[] inParams,
- java.util.Map<String, String> context,
- boolean sync)
+ private com.zeroc.IceInternal.ProxyIceInvoke _iceI_ice_invokeAsync(String operation, OperationMode mode,
+ byte[] inParams, Map<String, String> context,
+ boolean sync)
{
- com.zeroc.IceInternal.ProxyIceInvoke f =
- new com.zeroc.IceInternal.ProxyIceInvoke(this, operation, mode, sync);
+ com.zeroc.IceInternal.ProxyIceInvoke f = new com.zeroc.IceInternal.ProxyIceInvoke(this, operation, mode, sync);
f.invoke(inParams, context);
return f;
}
@@ -222,7 +189,7 @@ public class _ObjectPrxI implements ObjectPrx, java.io.Serializable
}
}
- public java.util.Map<String, String> ice_getContext()
+ public Map<String, String> ice_getContext()
{
return new java.util.HashMap<>(_reference.getContext());
}
@@ -348,7 +315,7 @@ public class _ObjectPrxI implements ObjectPrx, java.io.Serializable
return _iceI_ice_getConnectionAsync().waitForResponse();
}
- public java.util.concurrent.CompletableFuture<Connection> ice_getConnectionAsync()
+ public CompletableFuture<Connection> ice_getConnectionAsync()
{
return _iceI_ice_getConnectionAsync();
}
@@ -386,7 +353,7 @@ public class _ObjectPrxI implements ObjectPrx, java.io.Serializable
_iceI_ice_flushBatchRequestsAsync().waitForResponse();
}
- public java.util.concurrent.CompletableFuture<Void> ice_flushBatchRequestsAsync()
+ public CompletableFuture<Void> ice_flushBatchRequestsAsync()
{
return _iceI_ice_flushBatchRequestsAsync();
}
@@ -644,7 +611,7 @@ public class _ObjectPrxI implements ObjectPrx, java.io.Serializable
String s = in.readUTF();
try
{
- Communicator communicator = ((com.zeroc.Ice.ObjectInputStream)in).getCommunicator();
+ Communicator communicator = ((ObjectInputStream)in).getCommunicator();
if(communicator == null)
{
throw new java.io.IOException("Cannot deserialize proxy: no communicator provided");
@@ -655,8 +622,7 @@ public class _ObjectPrxI implements ObjectPrx, java.io.Serializable
}
catch(ClassCastException ex)
{
- java.io.IOException e =
- new java.io.IOException("Cannot deserialize proxy: com.zeroc.Ice.ObjectInputStream not found");
+ java.io.IOException e = new java.io.IOException("Cannot deserialize proxy: ObjectInputStream not found");
e.initCause(ex);
throw e;
}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsync.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsync.java
index dfddc2dbcb3..a45f43a2e30 100644
--- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsync.java
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsync.java
@@ -58,8 +58,7 @@ public class OutgoingAsync<T> extends ProxyOutgoingAsyncBaseI<T>
if(twowayOnly && !_proxy.ice_isTwoway())
{
- throw new java.lang.IllegalArgumentException("`" + _operation +
- "' can only be called with a twoway proxy");
+ throw new com.zeroc.Ice.TwowayOnlyException(_operation);
}
if(format == null)
diff --git a/java/test/src/main/java/test/Ice/binding/AllTests.java b/java/test/src/main/java/test/Ice/binding/AllTests.java
index 2bc222828d6..be41de07ea4 100644
--- a/java/test/src/main/java/test/Ice/binding/AllTests.java
+++ b/java/test/src/main/java/test/Ice/binding/AllTests.java
@@ -755,7 +755,7 @@ public class AllTests
{
testUDP.getAdapterName();
}
- catch(java.lang.IllegalArgumentException ex)
+ catch(com.zeroc.Ice.TwowayOnlyException ex)
{
}
}
diff --git a/java/test/src/main/java/test/Ice/operations/Oneways.java b/java/test/src/main/java/test/Ice/operations/Oneways.java
index c4efa9ba238..7f3f79c8432 100644
--- a/java/test/src/main/java/test/Ice/operations/Oneways.java
+++ b/java/test/src/main/java/test/Ice/operations/Oneways.java
@@ -47,7 +47,7 @@ class Oneways
p.opByte((byte)0xff, (byte)0x0f);
test(false);
}
- catch(java.lang.IllegalArgumentException ex)
+ catch(com.zeroc.Ice.TwowayOnlyException ex)
{
}
}
diff --git a/java/test/src/main/java/test/Ice/operations/OnewaysAMI.java b/java/test/src/main/java/test/Ice/operations/OnewaysAMI.java
index 04fdc3c3288..ec7fdfe2823 100644
--- a/java/test/src/main/java/test/Ice/operations/OnewaysAMI.java
+++ b/java/test/src/main/java/test/Ice/operations/OnewaysAMI.java
@@ -82,7 +82,7 @@ class OnewaysAMI
p.ice_isAAsync("::Test::MyClass").join();
test(false);
}
- catch(java.lang.IllegalArgumentException ex)
+ catch(com.zeroc.Ice.TwowayOnlyException ex)
{
}
}
@@ -93,7 +93,7 @@ class OnewaysAMI
p.ice_idAsync();
test(false);
}
- catch(java.lang.IllegalArgumentException ex)
+ catch(com.zeroc.Ice.TwowayOnlyException ex)
{
}
}
@@ -104,7 +104,7 @@ class OnewaysAMI
p.ice_idsAsync();
test(false);
}
- catch(java.lang.IllegalArgumentException ex)
+ catch(com.zeroc.Ice.TwowayOnlyException ex)
{
}
}
@@ -151,7 +151,7 @@ class OnewaysAMI
p.opByteAsync((byte)0xff, (byte)0x0f);
test(false);
}
- catch(java.lang.IllegalArgumentException ex)
+ catch(com.zeroc.Ice.TwowayOnlyException ex)
{
}
}
diff --git a/js/src/Ice/ObjectPrx.js b/js/src/Ice/ObjectPrx.js
index ff512010e94..ae4d66ed156 100644
--- a/js/src/Ice/ObjectPrx.js
+++ b/js/src/Ice/ObjectPrx.js
@@ -570,7 +570,7 @@ class ObjectPrx
{
if(!this.ice_isTwoway())
{
- throw new Error("`" + name + "' can only be called with a twoway proxy");
+ throw new Ice.TwowayOnlyException(name);
}
}
diff --git a/js/test/Ice/operations/Oneways.js b/js/test/Ice/operations/Oneways.js
index 68908665a8d..b339cc21037 100644
--- a/js/test/Ice/operations/Oneways.js
+++ b/js/test/Ice/operations/Oneways.js
@@ -46,6 +46,7 @@
catch(ex)
{
// Expected: twoway proxy required
+ test(ex instanceof Ice.TwowayOnlyException);
}
try
@@ -56,6 +57,7 @@
catch(ex)
{
// Expected: twoway proxy required
+ test(ex instanceof Ice.TwowayOnlyException);
}
try
@@ -66,6 +68,7 @@
catch(ex)
{
// Expected: twoway proxy required
+ test(ex instanceof Ice.TwowayOnlyException);
}
return prx.opVoid();
@@ -82,6 +85,7 @@
catch(ex)
{
// Expected: twoway proxy required
+ test(ex instanceof Ice.TwowayOnlyException);
}
}
).then(p.resolve, p.reject);