configatron breaks JRuby's YAML parser
jlandahl opened this issue · comments
John Landahl commented
I don't know if this is a JRuby (1.6.0) problem or a configatron (2.7.2) problem, but it's definitely a problem when the two of them get together:
$ cat test.yml
config:
x: 1
y: 2
$ irb
jruby-1.6.0 :001 > require 'yaml'
=> true
jruby-1.6.0 :002 > yml = YAML.load_file 'test.yml'
=> {"config"=>{"x"=>1, "y"=>2}}
jruby-1.6.0 :003 > require 'configatron'
=> true
jruby-1.6.0 :004 > yml = YAML.load_file 'test.yml'
Java::JavaLang::NullPointerException:
from org.yecht.ruby.RubyLoadHandler.handle(RubyLoadHandler.java:38)
from org.yecht.Parser.addNode(Parser.java:300)
from org.yecht.DefaultYAMLParser.yyparse(DefaultYAMLParser.java:676)
from org.yecht.Parser.yechtparse(Parser.java:290)
from org.yecht.Parser.parse(Parser.java:284)
from org.yecht.ruby.YParser.load(YParser.java:152)
from org.yecht.ruby.YParser$s$0$1$load.call(YParser$s$0$1$load.gen:65535)
from org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:630)
from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:205)
from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:282)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:139)
from org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
from org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:103)
from org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:190)
... 153 levels...
from org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
from org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:190)
from org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:179)
from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:282)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:139)
from usr.local.rvm.rubies.jruby_minus_1_dot_6_dot_0.bin.irb.__file__(/usr/local/rvm/rubies/jruby-1.6.0/bin/irb:17)
from usr.local.rvm.rubies.jruby_minus_1_dot_6_dot_0.bin.irb.load(/usr/local/rvm/rubies/jruby-1.6.0/bin/irb)
from org.jruby.Ruby.runScript(Ruby.java:670)
from org.jruby.Ruby.runNormally(Ruby.java:574)
from org.jruby.Ruby.runFromMain(Ruby.java:423)
from org.jruby.Main.doRunFromMain(Main.java:278)
from org.jruby.Main.internalRun(Main.java:198)
from org.jruby.Main.run(Main.java:164)
from org.jruby.Main.run(Main.java:148)
from org.jruby.Main.main(Main.java:128)jruby-1.6.0 :005 >
I initially thought the problem was isolated to configatron.configure_from_yaml
, but as the above sample shows the damage is done in require 'configatron'
.
Steeve Morin commented
It's because Configatron uses the Syck YAML parser, which is broken in JRuby (they don't want to support it because they say it's crap)...
Kurtis Rainbolt-Greene commented
Why does configatron even mess with YAML? Going to make a pull request that drops this.