Deal as gracefully as possible if we don't have any data for the final
field or fields of a streamed object. This allows us to add new fields to the end of a streamable without causing all existing serialized versions to become unreadable. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2629 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: Streamer.java,v 1.6 2003/04/10 17:47:45 mdb Exp $
|
// $Id: Streamer.java,v 1.7 2003/06/02 17:24:18 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.io;
|
package com.threerings.io;
|
||||||
|
|
||||||
@@ -324,7 +324,15 @@ public class Streamer
|
|||||||
Log.info(in.hashCode() +
|
Log.info(in.hashCode() +
|
||||||
": Reading field '" + field.getName() + "'.");
|
": Reading field '" + field.getName() + "'.");
|
||||||
}
|
}
|
||||||
fm.readField(field, object, in);
|
// gracefully deal with objects that have had new fields
|
||||||
|
// added to their class definition
|
||||||
|
if (in.available() > 0) {
|
||||||
|
fm.readField(field, object, in);
|
||||||
|
} else {
|
||||||
|
Log.info("Streamed instance missing field (probably " +
|
||||||
|
"newly added) [class=" + _target.getName() +
|
||||||
|
", field=" + field.getName() + "].");
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.logStackTrace(e);
|
Log.logStackTrace(e);
|
||||||
String errmsg = "Failure reading streamable field " +
|
String errmsg = "Failure reading streamable field " +
|
||||||
|
|||||||
Reference in New Issue
Block a user