Skip to content

NullPointerException when deserializing a Set with YAML.load #5222

@mohamedhafez

Description

@mohamedhafez

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions