From 9bba738a2f169b6e51a3eb8625492a16664ad6af Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Thu, 22 Jul 2004 09:00:25 +0000 Subject: 2004-07-22 Michael Koch * java/io/ObjectInputStream.java: Merge debug code with libgcj. (depth): New field. * java/io/ObjectOutputStream.java (writeObject): Revert not intended change in my last commit. --- java/io/ObjectInputStream.java | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'java/io/ObjectInputStream.java') diff --git a/java/io/ObjectInputStream.java b/java/io/ObjectInputStream.java index 6ad245210..ca7fe35ef 100644 --- a/java/io/ObjectInputStream.java +++ b/java/io/ObjectInputStream.java @@ -134,6 +134,9 @@ public class ObjectInputStream extends InputStream this.isDeserializing = true; byte marker = this.realInputStream.readByte(); + + depth += 2; + if(dump) dumpElement("MARKER: 0x" + Integer.toHexString(marker) + " "); try @@ -151,9 +154,9 @@ public class ObjectInputStream extends InputStream case TC_BLOCKDATALONG: { if (marker == TC_BLOCKDATALONG) - if(dump) dumpElementln("BLOCKDATALONG"); + { if(dump) dumpElementln("BLOCKDATALONG"); } else - if(dump) dumpElementln("BLOCKDATA"); + { if(dump) dumpElementln("BLOCKDATA"); } readNextBlock(marker); throw new StreamCorruptedException("Unexpected blockData"); } @@ -329,10 +332,10 @@ public class ObjectInputStream extends InputStream ("No end of block data seen for class with readObject (ObjectInputStream) method."); if(dump) dumpElementln("yes"); } - catch (EOFException e) - { - if(dump) dumpElementln("no, got EOFException"); - } +// catch (EOFException e) +// { +// if(dump) dumpElementln("no, got EOFException"); +// } catch (IOException e) { if(dump) dumpElementln("no, got IOException"); @@ -347,6 +350,7 @@ public class ObjectInputStream extends InputStream this.currentObject = null; this.currentObjectStreamClass = null; ret_val = processResolution(osc, obj, handle); + break; } @@ -375,6 +379,8 @@ public class ObjectInputStream extends InputStream this.isDeserializing = was_deserializing; + depth -= 2; + if (! was_deserializing) { if (validators.size() > 0) @@ -1838,6 +1844,9 @@ public class ObjectInputStream extends InputStream private static boolean dump = false && Configuration.DEBUG; + // The nesting depth for debugging output + private int depth = 0; + private void dumpElement (String msg) { System.out.print(msg); @@ -1846,6 +1855,9 @@ public class ObjectInputStream extends InputStream private void dumpElementln (String msg) { System.out.println(msg); + for (int i = 0; i < depth; i++) + System.out.print (" "); + System.out.print (Thread.currentThread() + ": "); } static -- cgit v1.2.1