diff options
author | Florian Frank <flori@ping.de> | 2015-01-02 23:55:20 +0100 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2015-01-02 23:55:20 +0100 |
commit | 9b4302c7d59cc83e9b4733da9da26df569e0d278 (patch) | |
tree | 09cf604c6e7df08c956f850aecb1093986cd08fa /java/src/json/ext/Parser.rl | |
parent | 05ba45c2d46c8ff4807613b60b204f85a7720997 (diff) | |
parent | 737bb637c7accfb1a704bc15560ab8bb83fccfa4 (diff) | |
download | json-9b4302c7d59cc83e9b4733da9da26df569e0d278.tar.gz |
Merge branch 'master' into zzak-ruby-2.2
Diffstat (limited to 'java/src/json/ext/Parser.rl')
-rw-r--r-- | java/src/json/ext/Parser.rl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/java/src/json/ext/Parser.rl b/java/src/json/ext/Parser.rl index 7dcdd2e..6d65963 100644 --- a/java/src/json/ext/Parser.rl +++ b/java/src/json/ext/Parser.rl @@ -246,7 +246,7 @@ public class Parser extends RubyObject { */ @JRubyMethod public IRubyObject parse(ThreadContext context) { - return new ParserSession(this, context).parse(); + return new ParserSession(this, context, info).parse(); } /** @@ -302,6 +302,7 @@ public class Parser extends RubyObject { private static class ParserSession { private final Parser parser; private final ThreadContext context; + private final RuntimeInfo info; private final ByteList byteList; private final ByteList view; private final byte[] data; @@ -313,9 +314,10 @@ public class Parser extends RubyObject { // no idea about the origins of this value, ask Flori ;) private static final int EVIL = 0x666; - private ParserSession(Parser parser, ThreadContext context) { + private ParserSession(Parser parser, ThreadContext context, RuntimeInfo info) { this.parser = parser; this.context = context; + this.info = info; this.byteList = parser.checkAndGetSource().getByteList(); this.data = byteList.unsafeBytes(); this.view = new ByteList(data, false); @@ -646,8 +648,7 @@ public class Parser extends RubyObject { } } - if (cs >= JSON_string_first_final && result != null) { - RuntimeInfo info = RuntimeInfo.forRuntime(context.getRuntime()); + if (cs >= JSON_string_first_final && result != null) { if (info.encodingsSupported() && result instanceof RubyString) { ((RubyString)result).force_encoding(context, info.utf8.get()); } |