You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ec...@apache.org on 2019/01/11 10:25:17 UTC
[beam] 03/08: Fix SerializationDebugger
This is an automated email from the ASF dual-hosted git repository.
echauchot pushed a commit to branch spark-runner_structured-streaming
in repository https://gitbox.apache.org/repos/asf/beam.git
commit 43c737b2f4b0e22c41a41fb5a0196acce92627d0
Author: Etienne Chauchot <ec...@apache.org>
AuthorDate: Fri Jan 11 10:17:35 2019 +0100
Fix SerializationDebugger
---
.../structuredstreaming/utils/SerializationDebugger.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/runners/spark-structured-streaming/src/test/java/org/apache/beam/runners/spark/structuredstreaming/utils/SerializationDebugger.java b/runners/spark-structured-streaming/src/test/java/org/apache/beam/runners/spark/structuredstreaming/utils/SerializationDebugger.java
index 0e47969..a0ef7cc 100644
--- a/runners/spark-structured-streaming/src/test/java/org/apache/beam/runners/spark/structuredstreaming/utils/SerializationDebugger.java
+++ b/runners/spark-structured-streaming/src/test/java/org/apache/beam/runners/spark/structuredstreaming/utils/SerializationDebugger.java
@@ -19,6 +19,8 @@
/** Testing utils for spark structured streaming runner. */
package org.apache.beam.runners.spark.structuredstreaming.utils;
+import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
@@ -28,9 +30,9 @@ import java.util.List;
public class SerializationDebugger {
- public static void testSerialization(Object object) throws IOException {
+ public static void testSerialization(Object object, File to) throws IOException {
DebuggingObjectOutputStream out =
- new DebuggingObjectOutputStream();
+ new DebuggingObjectOutputStream(new FileOutputStream(to));
try {
out.writeObject(object);
} catch (Exception e) {
@@ -42,8 +44,6 @@ public class SerializationDebugger {
private static class DebuggingObjectOutputStream extends ObjectOutputStream {
- public DebuggingObjectOutputStream() throws IOException, SecurityException {
- }
private static final Field DEPTH_FIELD;
@@ -56,7 +56,7 @@ public class SerializationDebugger {
}
}
- final List<Object> stack = new ArrayList<Object>();
+ final List<Object> stack = new ArrayList<>();
/**
* Indicates whether or not OOS has tried to
@@ -75,6 +75,7 @@ public class SerializationDebugger {
* Abuse {@code replaceObject()} as a hook to
* maintain our stack.
*/
+ @Override
protected Object replaceObject(Object o) {
// ObjectOutputStream writes serialization
// exceptions to the stream. Ignore