|
21 | 21 | import org.jruby.anno.JRubyClass; |
22 | 22 | import org.jruby.anno.JRubyMethod; |
23 | 23 | import org.jruby.util.ByteList; |
24 | | -import org.jruby.ext.stringio.StringIO; |
25 | 24 |
|
26 | 25 | import static org.jruby.runtime.Visibility.PRIVATE; |
27 | 26 |
|
28 | 27 | @JRubyClass(name="MessagePack::Unpacker") |
29 | 28 | public class Unpacker extends RubyObject { |
30 | 29 | private static final long serialVersionUID = 8451264671199362492L; |
31 | | - private final ExtensionRegistry registry; |
| 30 | + private transient final ExtensionRegistry registry; |
32 | 31 |
|
33 | | - private IRubyObject stream; |
34 | | - private IRubyObject data; |
35 | | - private Decoder decoder; |
| 32 | + private transient IRubyObject stream; |
| 33 | + private transient IRubyObject data; |
| 34 | + private transient Decoder decoder; |
36 | 35 | private final RubyClass underflowErrorClass; |
37 | 36 | private boolean symbolizeKeys; |
38 | 37 | private boolean freeze; |
@@ -129,10 +128,9 @@ public IRubyObject registeredTypesInternal(ThreadContext ctx) { |
129 | 128 |
|
130 | 129 | @JRubyMethod(name = "register_type", required = 1, optional = 2) |
131 | 130 | public IRubyObject registerType(ThreadContext ctx, IRubyObject[] args, final Block block) { |
| 131 | + testFrozen("MessagePack::Unpacker"); |
| 132 | + |
132 | 133 | Ruby runtime = ctx.runtime; |
133 | | - if (isFrozen()) { |
134 | | - throw runtime.newFrozenError("MessagePack::Unpacker"); |
135 | | - } |
136 | 134 | IRubyObject type = args[0]; |
137 | 135 |
|
138 | 136 | RubyModule extModule; |
@@ -334,9 +332,7 @@ public IRubyObject getStream(ThreadContext ctx) { |
334 | 332 | @JRubyMethod(name = "stream=", required = 1) |
335 | 333 | public IRubyObject setStream(ThreadContext ctx, IRubyObject stream) { |
336 | 334 | RubyString str; |
337 | | - if (stream instanceof StringIO) { |
338 | | - str = stream.callMethod(ctx, "string").asString(); |
339 | | - } else if (stream instanceof RubyIO) { |
| 335 | + if (stream instanceof RubyIO) { |
340 | 336 | str = stream.callMethod(ctx, "read").asString(); |
341 | 337 | } else if (stream.respondsTo("read")) { |
342 | 338 | str = stream.callMethod(ctx, "read").asString(); |
|
0 commit comments