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;
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.samskivert.util.HashIntMap;
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
|
||||
@@ -79,7 +80,14 @@ public class ObjectInputStream extends DataInputStream
|
||||
|
||||
// sanity check
|
||||
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 + "]";
|
||||
throw new RuntimeException(errmsg);
|
||||
}
|
||||
@@ -147,6 +155,16 @@ public class ObjectInputStream extends DataInputStream
|
||||
_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
|
||||
* Streamable} instances.
|
||||
|
||||
Reference in New Issue
Block a user