summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2013-07-04 11:20:07 +0200
committerBenoit Foucher <benoit@zeroc.com>2013-07-04 11:20:07 +0200
commit0df052034b03907de02d8eac162e84e5ba50bfd5 (patch)
treef424142a198431b2a8981bfaebe79410ef4f5481 /java
parentFixed ICE-5340 - FileLock jlint errors in android (diff)
downloadice-0df052034b03907de02d8eac162e84e5ba50bfd5.tar.bz2
ice-0df052034b03907de02d8eac162e84e5ba50bfd5.tar.xz
ice-0df052034b03907de02d8eac162e84e5ba50bfd5.zip
Fixed ICE-5369 - fixed asserting on AMD response if memory limit exception was raised
Diffstat (limited to 'java')
-rw-r--r--java/test/Ice/exceptions/AMDServer.java1
-rw-r--r--java/test/Ice/exceptions/AMDThrowerI.java7
-rw-r--r--java/test/Ice/exceptions/AllTests.java51
-rw-r--r--java/test/Ice/exceptions/Client.java1
-rw-r--r--java/test/Ice/exceptions/Server.java1
-rw-r--r--java/test/Ice/exceptions/Test.ice3
-rw-r--r--java/test/Ice/exceptions/TestAMD.ice3
-rw-r--r--java/test/Ice/exceptions/ThrowerI.java6
8 files changed, 73 insertions, 0 deletions
diff --git a/java/test/Ice/exceptions/AMDServer.java b/java/test/Ice/exceptions/AMDServer.java
index 0e4aae17c71..86d47bd6e84 100644
--- a/java/test/Ice/exceptions/AMDServer.java
+++ b/java/test/Ice/exceptions/AMDServer.java
@@ -33,6 +33,7 @@ public class AMDServer extends test.Util.Application
initData.properties = Ice.Util.createProperties(argsH);
initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions.AMD");
initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
// We don't need to disable warnings, because we have a dummy logger.
// properties.setProperty("Ice.Warn.Dispatch", "0");
diff --git a/java/test/Ice/exceptions/AMDThrowerI.java b/java/test/Ice/exceptions/AMDThrowerI.java
index bb69ac2a1da..9f924e42f56 100644
--- a/java/test/Ice/exceptions/AMDThrowerI.java
+++ b/java/test/Ice/exceptions/AMDThrowerI.java
@@ -16,6 +16,7 @@ import test.Ice.exceptions.AMD.Test.AMD_Thrower_supportsUndeclaredExceptions;
import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAasA;
import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAorDasAorD;
import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAssertException;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwMemoryLimitException;
import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwBasA;
import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwBasB;
import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwCasA;
@@ -189,6 +190,12 @@ public final class AMDThrowerI extends _ThrowerDisp
}
public void
+ throwMemoryLimitException_async(AMD_Thrower_throwMemoryLimitException cb, byte[] seq, Ice.Current current)
+ {
+ cb.ice_response(new byte[1024 * 20]); // 20KB is over the configured 10KB message size max.
+ }
+
+ public void
throwLocalExceptionIdempotent_async(AMD_Thrower_throwLocalExceptionIdempotent cb, Ice.Current current)
{
cb.ice_exception(new Ice.TimeoutException());
diff --git a/java/test/Ice/exceptions/AllTests.java b/java/test/Ice/exceptions/AllTests.java
index 88f6a4271fd..e45abf76b64 100644
--- a/java/test/Ice/exceptions/AllTests.java
+++ b/java/test/Ice/exceptions/AllTests.java
@@ -1739,6 +1739,57 @@ public class AllTests
out.println("ok");
}
+ out.print("testing memory limit marshal exception...");
+ out.flush();
+ {
+ try
+ {
+ thrower.throwMemoryLimitException(null);
+ test(collocated);
+ }
+ catch(Ice.UnknownLocalException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwMemoryLimitException(new byte[20 * 1024]); // 20KB
+ test(collocated);
+ }
+ catch(Ice.MemoryLimitException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ if(!collocated)
+ {
+ try
+ {
+ thrower.end_throwMemoryLimitException(
+ thrower.begin_throwMemoryLimitException(new byte[20 * 1024])); // 20KB
+ test(false);
+ }
+ catch(Ice.MemoryLimitException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ }
+ }
+ out.println("ok");
+
out.print("catching object not exist exception... ");
out.flush();
diff --git a/java/test/Ice/exceptions/Client.java b/java/test/Ice/exceptions/Client.java
index 51b6f072a81..e26144144a6 100644
--- a/java/test/Ice/exceptions/Client.java
+++ b/java/test/Ice/exceptions/Client.java
@@ -27,6 +27,7 @@ public class Client extends test.Util.Application
initData.properties = Ice.Util.createProperties(argsH);
initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions");
initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
return initData;
}
diff --git a/java/test/Ice/exceptions/Server.java b/java/test/Ice/exceptions/Server.java
index 97e4c3048b0..767526a7c36 100644
--- a/java/test/Ice/exceptions/Server.java
+++ b/java/test/Ice/exceptions/Server.java
@@ -29,6 +29,7 @@ public class Server extends test.Util.Application
initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions");
initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
// We don't need to disable warnings, because we have a dummy logger.
// properties.setProperty("Ice.Warn.Dispatch", "0");
diff --git a/java/test/Ice/exceptions/Test.ice b/java/test/Ice/exceptions/Test.ice
index 2731dd1ec79..9df91f3013f 100644
--- a/java/test/Ice/exceptions/Test.ice
+++ b/java/test/Ice/exceptions/Test.ice
@@ -9,6 +9,8 @@
#pragma once
+#include <Ice/BuiltinSequences.ice>
+
[["java:package:test.Ice.exceptions"]]
module Test
{
@@ -59,6 +61,7 @@ exception D
void throwLocalException();
void throwNonIceException();
void throwAssertException();
+ Ice::ByteSeq throwMemoryLimitException(Ice::ByteSeq seq);
idempotent void throwLocalExceptionIdempotent();
diff --git a/java/test/Ice/exceptions/TestAMD.ice b/java/test/Ice/exceptions/TestAMD.ice
index 830815c621c..a9b8b7be0a2 100644
--- a/java/test/Ice/exceptions/TestAMD.ice
+++ b/java/test/Ice/exceptions/TestAMD.ice
@@ -9,6 +9,8 @@
#pragma once
+#include <Ice/BuiltinSequences.ice>
+
[["java:package:test.Ice.exceptions.AMD"]]
module Test
{
@@ -54,6 +56,7 @@ exception D
void throwLocalException();
void throwNonIceException();
void throwAssertException();
+ Ice::ByteSeq throwMemoryLimitException(Ice::ByteSeq seq);
idempotent void throwLocalExceptionIdempotent();
diff --git a/java/test/Ice/exceptions/ThrowerI.java b/java/test/Ice/exceptions/ThrowerI.java
index 1d190443fd1..47441831694 100644
--- a/java/test/Ice/exceptions/ThrowerI.java
+++ b/java/test/Ice/exceptions/ThrowerI.java
@@ -155,6 +155,12 @@ public final class ThrowerI extends _ThrowerDisp
throw new java.lang.AssertionError();
}
+ public byte[]
+ throwMemoryLimitException(byte[] seq, Ice.Current current)
+ {
+ return new byte[1024 * 20]; // 20KB is over the configured 10KB message size max.
+ }
+
public void
throwAfterResponse(Ice.Current current)
{