summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorJoe George <joe@zeroc.com>2020-07-07 16:57:51 -0400
committerGitHub <noreply@github.com>2020-07-07 16:57:51 -0400
commit6c0e7e6fcabde691e7c38a814b6171f9f4e77d09 (patch)
treeaed41fdff6561e134c73da214e580be0910e6f6a /java
parentCopy python dependencies to the extension directory - Close #926 (#927) (diff)
downloadice-6c0e7e6fcabde691e7c38a814b6171f9f4e77d09.tar.bz2
ice-6c0e7e6fcabde691e7c38a814b6171f9f4e77d09.tar.xz
ice-6c0e7e6fcabde691e7c38a814b6171f9f4e77d09.zip
Add class cycle detection during unmarshaling (#946)
Add support for detection of class cycles during unmarshaling in languages which do no have garbage collection: C++, Swift, and Objective-C. A `MarshalException` is thrown when a cycle is detected. The property `Ice.AcceptClassCycles` can be set to a value greater than `0` to change this behavior.
Diffstat (limited to 'java')
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java3
-rw-r--r--java/test/src/main/java/test/Ice/objects/AllTests.java18
-rw-r--r--java/test/src/main/java/test/Ice/objects/InitialI.java11
-rw-r--r--java/test/src/main/java/test/Ice/objects/Test.ice3
4 files changed, 34 insertions, 1 deletions
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java
index 60078543e6f..3ba05d0bde6 100644
--- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java
@@ -1,7 +1,7 @@
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
-// Generated by makeprops.py from file ./config/PropertyNames.xml, Fri Sep 6 18:11:04 2019
+// Generated by makeprops.py from file ./config/PropertyNames.xml, Thu Jul 2 14:55:02 2020
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -11,6 +11,7 @@ public final class PropertyNames
{
public static final Property IceProps[] =
{
+ new Property("Ice\\.AcceptClassCycles", false, null),
new Property("Ice\\.ACM\\.Client", true, null),
new Property("Ice\\.ACM\\.Server", true, null),
new Property("Ice\\.ACM\\.Timeout", false, null),
diff --git a/java/test/src/main/java/test/Ice/objects/AllTests.java b/java/test/src/main/java/test/Ice/objects/AllTests.java
index aa11250a6fa..d161292e807 100644
--- a/java/test/src/main/java/test/Ice/objects/AllTests.java
+++ b/java/test/src/main/java/test/Ice/objects/AllTests.java
@@ -435,6 +435,24 @@ public class AllTests
}
out.println("ok");
+ out.print("testing sending class cycle... ");
+ out.flush();
+ {
+ Recursive rec = new Recursive();
+ rec.v = rec;
+ boolean acceptsCycles = initial.acceptsClassCycles();
+ try
+ {
+ initial.setCycle(rec);
+ test(acceptsCycles);
+ }
+ catch(com.zeroc.Ice.UnknownLocalException ex)
+ {
+ test(!acceptsCycles);
+ }
+ }
+ out.println("ok");
+
return initial;
}
}
diff --git a/java/test/src/main/java/test/Ice/objects/InitialI.java b/java/test/src/main/java/test/Ice/objects/InitialI.java
index 7760480f1e9..125427eb06a 100644
--- a/java/test/src/main/java/test/Ice/objects/InitialI.java
+++ b/java/test/src/main/java/test/Ice/objects/InitialI.java
@@ -112,6 +112,17 @@ public final class InitialI implements Initial
}
@Override
+ public void setCycle(Recursive r, com.zeroc.Ice.Current current)
+ {
+ }
+
+ @Override
+ public boolean acceptsClassCycles(com.zeroc.Ice.Current current)
+ {
+ return true;
+ }
+
+ @Override
public com.zeroc.Ice.Value getI(com.zeroc.Ice.Current current)
{
return new II();
diff --git a/java/test/src/main/java/test/Ice/objects/Test.ice b/java/test/src/main/java/test/Ice/objects/Test.ice
index 50e6248fd4a..a0862f9f4f4 100644
--- a/java/test/src/main/java/test/Ice/objects/Test.ice
+++ b/java/test/src/main/java/test/Ice/objects/Test.ice
@@ -216,6 +216,9 @@ interface Initial
void setRecursive(Recursive p);
bool supportsClassGraphDepthMax();
+ void setCycle(Recursive r);
+ bool acceptsClassCycles();
+
["marshaled-result"] B getMB();
["amd", "marshaled-result"] B getAMDMB();