JRuby

YAML ParserException when reading ja.yml from redMine

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.0.0RC2
  • Fix Version/s: JRuby 1.0.0RC3
  • Component/s: Core Classes/Modules
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    2

Description

The YAML parser fails when loading the attached file which comes from redMine. It's Japanese text, so maybe it isn't supported yet?

The code:

require 'yaml'
raw_hash = YAML::load(File.read('ja.yml'))

The error:

ParserImpl.java:496:in `org.jvyamlb.ParserImpl$26.produce': org.jvyamlb.ParserException: ParserException while scanning a block mapping we had this expected <block end>, but found org.jvyamlb.tokens.ScalarToken (NativeException)
from ParserImpl.java:823:in `org.jvyamlb.ParserImpl.parseStreamNext'
from ParserImpl.java:774:in `org.jvyamlb.ParserImpl.peekEvent'
from ComposerImpl.java:161:in `org.jvyamlb.ComposerImpl.composeNode'
from ComposerImpl.java:100:in `org.jvyamlb.ComposerImpl.composeDocument'
from ComposerImpl.java:76:in `org.jvyamlb.ComposerImpl.getNode'
from BaseConstructorImpl.java:97:in `org.jvyamlb.BaseConstructorImpl.getData'
from RubyYAML.java:221:in `org.jruby.RubyYAML.load'
from null:-1:in `org.jruby.RubyYAMLInvokerSload1.call'
... 48 levels...
from Main.java:190:in `org.jruby.Main.runInterpreter'
from Main.java:120:in `org.jruby.Main.run'
from Main.java:95:in `org.jruby.Main.main'
Complete Java stackTrace
while scanning a block mapping
expected <block end>, but found org.jvyamlb.tokens.ScalarToken
org.jvyamlb.ParserException: ParserException while scanning a block mapping we had this expected <block end>, but found org.jvyamlb.tokens.ScalarToken
at org.jvyamlb.ParserImpl$26.produce(ParserImpl.java:496)
at org.jvyamlb.ParserImpl.parseStreamNext(ParserImpl.java:823)
at org.jvyamlb.ParserImpl.peekEvent(ParserImpl.java:774)
at org.jvyamlb.ComposerImpl.composeNode(ComposerImpl.java:161)
at org.jvyamlb.ComposerImpl.composeDocument(ComposerImpl.java:100)
at org.jvyamlb.ComposerImpl.getNode(ComposerImpl.java:76)
at org.jvyamlb.BaseConstructorImpl.getData(BaseConstructorImpl.java:97)
at org.jruby.RubyYAML.load(RubyYAML.java:221)
at org.jruby.RubyYAMLInvokerSload1.call(Unknown Source)
at org.jruby.runtime.callback.FastInvocationCallback.execute(FastInvocationCallback.java:49)
at org.jruby.internal.runtime.methods.SimpleCallbackMethod.call(SimpleCallbackMethod.java:81)
at org.jruby.RubyObject.compilerCallMethod(RubyObject.java:510)
at org.jruby.javasupport.util.CompilerHelpers.doInvokeDynamic(CompilerHelpers.java:123)
at EVAL8970973._file_(EVAL8970973:2)
at EVAL8970973.run(EVAL8970973)
at org.jruby.Ruby.compileOrFallbackAndRun(Ruby.java:306)
at org.jruby.Main.runInterpreter(Main.java:233)
at org.jruby.Main.runInterpreter(Main.java:190)
at org.jruby.Main.run(Main.java:120)
at org.jruby.Main.main(Main.java:95)

  1. ja.yml
    20/May/07 3:31 PM
    17 kB
    Albert Strasheim
  2. zh.yml
    20/May/07 3:34 PM
    15 kB
    Albert Strasheim

Activity

Hide
Albert Strasheim added a comment -

Also fails with the attached zh.yml, for what that's worth.

Show
Albert Strasheim added a comment - Also fails with the attached zh.yml, for what that's worth.
Hide
Charles Oliver Nutter added a comment -

No pressure Ola...but you're probably the only one prepared to tackle this sort of thing. If one of us others have a chance, we'll have a look too.

Show
Charles Oliver Nutter added a comment - No pressure Ola...but you're probably the only one prepared to tackle this sort of thing. If one of us others have a chance, we'll have a look too.
Hide
Ola Bini added a comment -

For some reason, the YAML code believed that \u0085 was a space, and when it was encountered as part of characters it was used to split on. Fixed this by not treating 85 special anymore.

Show
Ola Bini added a comment - For some reason, the YAML code believed that \u0085 was a space, and when it was encountered as part of characters it was used to split on. Fixed this by not treating 85 special anymore.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: