Repository: apex-core
Updated Branches:
  refs/heads/master b782835cc -> 25ca79f0b


APEXCORE-538 - Log raw data when RPC message fails to de-serialize

Conflicts:
        
engine/src/main/java/com/datatorrent/stram/util/AbstractWritableAdapter.java


Project: http://git-wip-us.apache.org/repos/asf/apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/apex-core/commit/25ca79f0
Tree: http://git-wip-us.apache.org/repos/asf/apex-core/tree/25ca79f0
Diff: http://git-wip-us.apache.org/repos/asf/apex-core/diff/25ca79f0

Branch: refs/heads/master
Commit: 25ca79f0b78ee9c384b883b6fea06a802526646a
Parents: b782835
Author: Vlad Rozov <v.ro...@datatorrent.com>
Authored: Thu Sep 22 09:31:32 2016 -0700
Committer: Thomas Weise <tho...@datatorrent.com>
Committed: Thu Sep 22 20:07:22 2016 -0700

----------------------------------------------------------------------
 .../datatorrent/stram/util/AbstractWritableAdapter.java   | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/apex-core/blob/25ca79f0/engine/src/main/java/com/datatorrent/stram/util/AbstractWritableAdapter.java
----------------------------------------------------------------------
diff --git 
a/engine/src/main/java/com/datatorrent/stram/util/AbstractWritableAdapter.java 
b/engine/src/main/java/com/datatorrent/stram/util/AbstractWritableAdapter.java
index 89d7f2f..10579ff 100644
--- 
a/engine/src/main/java/com/datatorrent/stram/util/AbstractWritableAdapter.java
+++ 
b/engine/src/main/java/com/datatorrent/stram/util/AbstractWritableAdapter.java
@@ -29,8 +29,14 @@ import java.io.Serializable;
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.HashMap;
 import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import org.apache.hadoop.io.Writable;
 
 /**
@@ -41,6 +47,7 @@ import org.apache.hadoop.io.Writable;
 public abstract class AbstractWritableAdapter implements Writable, Serializable
 {
   private static final long serialVersionUID = 201306061421L;
+  private static final Logger logger = 
LoggerFactory.getLogger(AbstractWritableAdapter.class);
 
   @Override
   public void readFields(DataInput arg0) throws IOException
@@ -63,6 +70,9 @@ public abstract class AbstractWritableAdapter implements 
Writable, Serializable
       }
       ois.close();
     } catch (Exception e) {
+      final Path path = Files.createTempFile("apex-rpc-raw-dump-", ".ser");
+      logger.error("Failed to de-serialize {}. Writing raw data to {}.", 
this.getClass().getName(), path, e);
+      Files.write(path, bytes);
       throw new IOException(e);
     }
   }

Reply via email to