This is an automated email from the ASF dual-hosted git repository.
bschuchardt pushed a commit to branch feature/GEODE-6196
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/feature/GEODE-6196 by this
push:
new d28c694 adding new serializable class to excludedClasses.txt
d28c694 is described below
commit d28c694787f91653cb6b7c5557c32b2f79f0dae9
Author: Bruce Schuchardt <[email protected]>
AuthorDate: Wed Mar 6 10:52:55 2019 -0800
adding new serializable class to excludedClasses.txt
also reverting another test change that is no longer needed.
---
.../geode/tools/pulse/PulseDataExportTest.java | 2 +-
.../apache/geode/codeAnalysis/excludedClasses.txt | 1 +
.../internal/cli/json/QueryResultFormatter.java | 53 ++++++++++++++--------
.../sanctioned-geode-core-serializables.txt | 2 +-
4 files changed, 38 insertions(+), 20 deletions(-)
diff --git
a/geode-assembly/src/integrationTest/java/org/apache/geode/tools/pulse/PulseDataExportTest.java
b/geode-assembly/src/integrationTest/java/org/apache/geode/tools/pulse/PulseDataExportTest.java
index 9b1b81c..0dbb0ed 100644
---
a/geode-assembly/src/integrationTest/java/org/apache/geode/tools/pulse/PulseDataExportTest.java
+++
b/geode-assembly/src/integrationTest/java/org/apache/geode/tools/pulse/PulseDataExportTest.java
@@ -57,6 +57,6 @@ public class PulseDataExportTest {
.hasStatusCode(200)
.hasResponseBody()
.isEqualToIgnoringWhitespace(
-
"{\"result\":[[\"[Lorg.apache.geode.management.model.SubOrder;\",[[\"org.apache.geode.management.model.SubOrder\",{\"id\":\"null1\",\"items\":[\"java.util.ArrayList\",[]]}],null]]]}");
+ "{\"result\":[\"value1\",\"value2\",\"value3\"]}");
}
}
diff --git
a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
index 9886bd5..23a7c42 100644
---
a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
+++
b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
@@ -77,6 +77,7 @@ org/apache/geode/internal/tcp/VersionedByteBufferInputStream
org/apache/geode/internal/util/concurrent/StoppableReadWriteLock
org/apache/geode/management/internal/cli/commands/ShowMetricsCommand$Category
org/apache/geode/management/internal/cli/exceptions/UserErrorException
+org/apache/geode/management/internal/cli/json/QueryResultFormatter$PreventReserializationModule
org/apache/geode/security/ResourcePermission
org/apache/geode/security/ResourcePermission$Operation
org/apache/geode/security/ResourcePermission$Resource
diff --git
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/json/QueryResultFormatter.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/json/QueryResultFormatter.java
index 55f2d0e..ef5590e 100644
---
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/json/QueryResultFormatter.java
+++
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/json/QueryResultFormatter.java
@@ -86,24 +86,10 @@ public class QueryResultFormatter {
this.serializedObjects = new IdentityHashMap<>();
this.mapper = new ObjectMapper();
- // install a modifier that prevents recursive serialization in cases where
- // there are cyclical references
- SimpleModule mapperModule = new SimpleModule() {
- @Override
- public void setupModule(SetupContext context) {
- // install a modifier that prevents recursive serialization in cases
where
- // there are cyclical references
- super.setupModule(context);
- context.addBeanSerializerModifier(new BeanSerializerModifier() {
- @Override
- public JsonSerializer<?> modifySerializer(
- SerializationConfig config, BeanDescription desc,
JsonSerializer<?> serializer) {
- return new PreventReserializationSerializer(serializer,
serializedObjects,
- serializationDepth);
- }
- });
- }
- };
+
+ SimpleModule mapperModule =
+ new PreventReserializationModule(serializedObjects,
serializationDepth);
+
// insert a collection serializer that limits the number of elements
generated
mapperModule.addSerializer(Collection.class, new
CollectionSerializer(maxCollectionElements));
// insert a PdxInstance serializer that knows about PDX fields/values
@@ -436,4 +422,35 @@ public class QueryResultFormatter {
return Region.Entry.class;
}
}
+
+ /**
+ * A Jackson module that installs a serializer-modifier to detect and prevent
+ * reserialization of objects that have already been serialized. W/o this
+ * Jackson would throw infinite-recursion exceptions.
+ */
+ private static class PreventReserializationModule extends SimpleModule {
+ private final Map<Object, Object> serializedObjects;
+ private final int serializationDepth;
+
+ PreventReserializationModule(Map<Object, Object> serializedObjects, int
serializationDepth) {
+ this.serializedObjects = serializedObjects;
+ this.serializationDepth = serializationDepth;
+ }
+
+ @Override
+ public void setupModule(SetupContext context) {
+ // install a modifier that prevents recursive serialization in cases
where
+ // there are cyclical references
+ super.setupModule(context);
+ context.addBeanSerializerModifier(new BeanSerializerModifier() {
+ @Override
+ public JsonSerializer<?> modifySerializer(
+ SerializationConfig config, BeanDescription desc,
JsonSerializer<?> serializer) {
+ return new PreventReserializationSerializer(serializer,
serializedObjects,
+ serializationDepth);
+ }
+ });
+ }
+
+ }
}
diff --git
a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
index 25aee89..4d46693 100644
---
a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
+++
b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt
@@ -837,4 +837,4 @@
org/apache/geode/redis/internal/executor/sortedset/GeoRadiusParameters$SortOrder
org/apache/geode/security/AuthenticationFailedException,true,-8202866472279088879
org/apache/geode/security/AuthenticationRequiredException,true,4675976651103154919
org/apache/geode/security/GemFireSecurityException,true,3814254578203076926,cause:java/lang/Throwable
-org/apache/geode/security/NotAuthorizedException,true,419215768216387745,principal:java/security/Principal
\ No newline at end of file
+org/apache/geode/security/NotAuthorizedException,true,419215768216387745,principal:java/security/Principal