ObjectInputStream.java (readObject): Added code to conditionally dump out the serialized data.

* java/io/ObjectInputStream.java (readObject): Added code to
	conditionally dump out the serialized data.
	Handle ENDBLOCKDATA case a bit more gracefully since the current
	behavior doesn't seem to work as expected.
	(readStreamHeader): Added code for serialized data dumper.
	(readNextBlock): Ditto.
	(readFields): Ditto.
	(dump): New private static field for turning on/off dumper.
	(setDump): New native method.
	(dumpElement): New native method.
	(dumpElementln): New native method.
	* java/io/natObjectInputStream.cc (setDump): New method.
	(dumpElement): New method.
	(dumpElementln): New method.

Serialization dumper.  Enable by configuring with --enable-libgcj-debug
and calling java.io.ObjectInputStream.setDump(true) in your test program.
The output will be generated as the object is deserialized (i.e. the
readObject() method is executed).

From-SVN: r37223
This commit is contained in:
Warren Levy 2000-11-03 08:04:33 +00:00 committed by Warren Levy
parent 6678181b3c
commit a53785f90e
3 changed files with 136 additions and 21 deletions

View file

@ -20,6 +20,11 @@ details. */
#include <java/lang/reflect/Modifier.h>
#include <java/lang/reflect/Method.h>
#ifdef DEBUG
#include <java/lang/System.h>
#include <java/io/PrintStream.h>
#endif
jobject
java::io::ObjectInputStream::allocateObject (jclass klass)
{
@ -74,3 +79,39 @@ java::io::ObjectInputStream::getMethod (jclass klass, jstring name,
return klass->getPrivateMethod (name, arg_types);
}
#ifdef DEBUG
void
java::io::ObjectInputStream::setDump (jboolean dump)
{
java::io::ObjectInputStream::dump = dump;
}
void
java::io::ObjectInputStream::dumpElement (jstring msg)
{
if (dump)
java::lang::System::out->print (msg);
}
void
java::io::ObjectInputStream::dumpElementln (jstring msg)
{
if (dump)
java::lang::System::out->println (msg);
}
#else
void
java::io::ObjectInputStream::setDump (jboolean dump)
{
}
void
java::io::ObjectInputStream::dumpElement (jstring msg)
{
}
void
java::io::ObjectInputStream::dumpElementln (jstring msg)
{
}
#endif