Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when deserializing a Set with YAML.load #5222

Closed
mohamedhafez opened this Issue Jun 18, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@mohamedhafez
Copy link
Contributor

mohamedhafez commented Jun 18, 2018

On JRuby 9.2.0.0, if you launch irb the following code will cause a NullPointerException

require 'yaml'
require 'set'

YAML.load "--- !ruby/object:Set\nhash: {}\n"   # the string is the result of YAML.dump(Set.new)

here's the stack trace:

Traceback (most recent call last):
       16: from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:202)
       15: from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:206)
       14: from org.jruby.RubyProc$INVOKER$i$0$0$call.call(RubyProc$INVOKER$i$0$0$call.gen)
       13: from org.jruby.RubyProc.call(RubyProc.java:266)
       12: from org.jruby.RubyProc.call(RubyProc.java:286)
       11: from org.jruby.runtime.Block.call(Block.java:124)
       10: from org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:79)
        9: from org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:153)
        8: from org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:129)
        7: from org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        6: from org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:344)
        5: from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:139)
        4: from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:323)
        3: from org.jruby.ext.set.RubySet$INVOKER$i$0$0$inspect.call(RubySet$INVOKER$i$0$0$inspect.gen)
        2: from org.jruby.ext.set.RubySet.inspect(RubySet.java:1096)
        1: from org.jruby.ext.set.RubySet.size(RubySet.java:1177)
Java::JavaLang::NullPointerException ()

My environment info:

JRuby version: jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 Java HotSpot(TM) 64-Bit Server VM 25.121-b13 on 1.8.0_121-b13 +jit [darwin-x86_64]

Operating system version: Darwin MoMac 17.6.0 Darwin Kernel Version 17.6.0: Tue May 8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64

@kares

This comment has been minimized.

Copy link
Member

kares commented Jun 18, 2018

oh, nice ... 'YAML' seems to be not treating a set like a set but like an object with @hash i-var ;(

@kares kares self-assigned this Jun 18, 2018

@kares kares added this to the JRuby 9.2.1.0 milestone Jun 18, 2018

@kares kares closed this in 5a244b8 Jun 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.