Enhanced debuggery, reenabled new streaming bits because now they should really
really work. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4705 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -87,8 +87,7 @@ public class ObjectInputStream
|
||||
var cname :String = Translations.getFromServer(jname);
|
||||
cmap = new ClassMapping(code, cname, streamer);
|
||||
_classMap[code] = cmap;
|
||||
if (DEBUG) log.debug(DEBUG_ID +
|
||||
"Created mapping: (" + code + "): " + cname);
|
||||
if (DEBUG) log.debug(DEBUG_ID + "Created mapping: (" + code + "): " + cname);
|
||||
|
||||
} else {
|
||||
cmap = (_classMap[code] as ClassMapping);
|
||||
@@ -96,8 +95,9 @@ public class ObjectInputStream
|
||||
throw new IOError("Read object for which we have no " +
|
||||
"registered class metadata [code=" + code + "].");
|
||||
}
|
||||
if (DEBUG) log.debug(DEBUG_ID + "Read known code: (" +
|
||||
code + ": " + cmap.classname + ")");
|
||||
if (DEBUG) {
|
||||
log.debug(DEBUG_ID + "Read known code: (" + code + ": " + cmap.classname + ")");
|
||||
}
|
||||
}
|
||||
|
||||
// log.debug("Creating object sleeve...");
|
||||
|
||||
@@ -70,6 +70,10 @@ public class ObjectOutputStream
|
||||
throw new Error("Too many unique classes written to ObjectOutputStream");
|
||||
}
|
||||
|
||||
if (ObjectInputStream.DEBUG) {
|
||||
log.debug("Assigning class code [code=" + cmap.code + ", class=" + cname + "].");
|
||||
}
|
||||
|
||||
writeShort(-cmap.code);
|
||||
writeUTF((streamer == null) ? Translations.getToServer(cname)
|
||||
: streamer.getJavaClassName());
|
||||
|
||||
@@ -57,8 +57,6 @@ public abstract class FieldMarshaller
|
||||
createMarshallers();
|
||||
}
|
||||
|
||||
if (false) { // TEMP DISABLE
|
||||
|
||||
// first look to see if this field has custom reader/writer methods
|
||||
Method reader = null, writer = null;
|
||||
try {
|
||||
@@ -78,8 +76,6 @@ public abstract class FieldMarshaller
|
||||
// fall through to using reflection on the fields...
|
||||
}
|
||||
|
||||
} // END TEMP DISABLE
|
||||
|
||||
Class ftype = field.getType();
|
||||
if (ftype.isInterface()) {
|
||||
// if the class is a pure interface, use Object.
|
||||
@@ -151,6 +147,11 @@ public abstract class FieldMarshaller
|
||||
}
|
||||
}
|
||||
|
||||
public String toString ()
|
||||
{
|
||||
return "StreamerMarshaller:" + _streamer.toString();
|
||||
}
|
||||
|
||||
/** The streamer we use to read and write our field. */
|
||||
protected Streamer _streamer;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class ObjectInputStream extends DataInputStream
|
||||
Class sclass = Class.forName(cname, true, _loader);
|
||||
Streamer streamer = Streamer.getStreamer(sclass);
|
||||
if (STREAM_DEBUG) {
|
||||
log.info(hashCode() + ": New class '" + cname + "'.");
|
||||
log.info(hashCode() + ": New class '" + cname + "' [code=" + code + "].");
|
||||
}
|
||||
|
||||
// sanity check
|
||||
|
||||
@@ -26,29 +26,12 @@ import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import static com.threerings.NaryaLog.log;
|
||||
|
||||
/**
|
||||
* Used to write {@link Streamable} objects to an {@link OutputStream}. Other common object types
|
||||
* are supported as well:
|
||||
*
|
||||
* <pre>
|
||||
* Boolean
|
||||
* Byte
|
||||
* Character
|
||||
* Short
|
||||
* Integer
|
||||
* Long
|
||||
* Float
|
||||
* Double
|
||||
* boolean[]
|
||||
* byte[]
|
||||
* char[]
|
||||
* short[]
|
||||
* int[]
|
||||
* long[]
|
||||
* float[]
|
||||
* double[]
|
||||
* Object[]
|
||||
* </pre>
|
||||
* are supported as well: <code>Boolean, Byte, Character, Short, Integer, Long, Float, Double,
|
||||
* boolean[], byte[], char[], short[], int[], long[], float[], double[], Object[]</code>.
|
||||
*
|
||||
* @see Streamable
|
||||
*/
|
||||
@@ -102,6 +85,10 @@ public class ObjectOutputStream extends DataOutputStream
|
||||
// we specifically do not inline the getStreamer() call into the ClassMapping
|
||||
// constructor because we want to be sure not to call _nextCode++ if getStreamer()
|
||||
// throws an exception
|
||||
if (ObjectInputStream.STREAM_DEBUG) {
|
||||
log.info(hashCode() + ": Creating class mapping [code=" + _nextCode +
|
||||
", class=" + sclass.getName() + "].");
|
||||
}
|
||||
cmap = new ClassMapping(_nextCode++, sclass, streamer);
|
||||
_classmap.put(sclass, cmap);
|
||||
|
||||
|
||||
@@ -372,7 +372,8 @@ public class Streamer
|
||||
}
|
||||
try {
|
||||
if (ObjectInputStream.STREAM_DEBUG) {
|
||||
log.info(in.hashCode() + ": Reading field '" + field.getName() + "'.");
|
||||
log.info(in.hashCode() + ": Reading field '" + field.getName() + "' " +
|
||||
"with " + fm + ".");
|
||||
}
|
||||
// gracefully deal with objects that have had new fields added to their class
|
||||
// definition
|
||||
|
||||
Reference in New Issue
Block a user