diff --git a/src/java/com/threerings/io/Streamer.java b/src/java/com/threerings/io/Streamer.java index d94ee08a3..de8dc8b2a 100644 --- a/src/java/com/threerings/io/Streamer.java +++ b/src/java/com/threerings/io/Streamer.java @@ -90,7 +90,7 @@ public class Streamer * does not implement {@link Streamable} and is not one of the basic * object types (@see {@link ObjectOutputStream}). */ - public synchronized static Streamer getStreamer (final Class target) + public synchronized static Streamer getStreamer (Class target) throws IOException { // if we have not yet initialized ourselves, do so now @@ -98,6 +98,12 @@ public class Streamer createStreamers(); } + // if the target class is an enum, convert it from its potentially + // enum-value specific class to the main class for that enum + if (target.isEnum()) { + target = target.getDeclaringClass(); + } + Streamer stream = _streamers.get(target); if (stream == null) { // make sure this is a streamable class @@ -114,10 +120,11 @@ public class Streamer // create our streamer in a privileged block so that it can // introspect on the to be streamed class try { + final Class ftarget = target; stream = AccessController.doPrivileged( new PrivilegedExceptionAction() { public Streamer run () throws IOException { - return new Streamer(target); + return new Streamer(ftarget); } }); } catch (PrivilegedActionException pae) {