Log the shit out of everything if we come across an invalid class code in
the object input stream. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2012 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ObjectInputStream.java,v 1.1 2002/07/23 05:42:34 mdb Exp $
|
// $Id: ObjectInputStream.java,v 1.2 2002/12/02 22:10:10 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.io;
|
package com.threerings.io;
|
||||||
|
|
||||||
@@ -8,6 +8,7 @@ import java.io.DataInputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.presents.Log;
|
import com.threerings.presents.Log;
|
||||||
|
|
||||||
@@ -79,7 +80,14 @@ public class ObjectInputStream extends DataInputStream
|
|||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
if (cmap == null) {
|
if (cmap == null) {
|
||||||
String errmsg = "Aiya! Read object code for which we " +
|
// this will help with debugging
|
||||||
|
Log.warning("Internal stream error, no class metadata " +
|
||||||
|
"[code=" + code + ", ois=" + this + "].");
|
||||||
|
Thread.dumpStack();
|
||||||
|
Log.warning("ObjectInputStream mappings " +
|
||||||
|
StringUtil.toString(_classmap.entrySet()) +
|
||||||
|
".");
|
||||||
|
String errmsg = "Read object code for which we " +
|
||||||
"have no registered class metadata [code=" + code + "]";
|
"have no registered class metadata [code=" + code + "]";
|
||||||
throw new RuntimeException(errmsg);
|
throw new RuntimeException(errmsg);
|
||||||
}
|
}
|
||||||
@@ -147,6 +155,16 @@ public class ObjectInputStream extends DataInputStream
|
|||||||
_streamer.readObject(_current, this, false);
|
_streamer.readObject(_current, this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a string representation of this instance.
|
||||||
|
*/
|
||||||
|
public String toString ()
|
||||||
|
{
|
||||||
|
return "[hash=" + hashCode() + ", mappings=" + _classmap.size() +
|
||||||
|
", current=" + StringUtil.safeToString(_current) +
|
||||||
|
", streamer=" + _streamer + "]";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by a {@link Streamer} that is reading an array of {@link
|
* Used by a {@link Streamer} that is reading an array of {@link
|
||||||
* Streamable} instances.
|
* Streamable} instances.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: Streamer.java,v 1.1 2002/07/23 05:42:34 mdb Exp $
|
// $Id: Streamer.java,v 1.2 2002/12/02 22:10:10 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.io;
|
package com.threerings.io;
|
||||||
|
|
||||||
@@ -299,6 +299,16 @@ public class Streamer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a string representation of this instance.
|
||||||
|
*/
|
||||||
|
public String toString ()
|
||||||
|
{
|
||||||
|
return "[target=" + _target.getName() + ", delegate=" + _delegate +
|
||||||
|
", fcount=" + _fields.length + ", reader=" + _reader +
|
||||||
|
", writer=" + _writer + "]";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constructor used by the basic streamers.
|
* The constructor used by the basic streamers.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user