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

mohamedhafez opened this issue Jun 18, 2018 · 1 comment

NullPointerException when deserializing a Set with YAML.load #5222

mohamedhafez opened this issue Jun 18, 2018 · 1 comment


Copy link

On JRuby, 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(

here's the stack trace:

Traceback (most recent call last):
       16: from
       15: from
       14: from org.jruby.RubyProc$INVOKER$i$0$0$$INVOKER$i$0$0$call.gen)
       13: from
       12: from
       11: from
       10: from
        9: from org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(
        8: from
        7: from
        6: from
        5: from
        4: from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(
        3: from org.jruby.ext.set.RubySet$INVOKER$i$0$0$$INVOKER$i$0$0$inspect.gen)
        2: from org.jruby.ext.set.RubySet.inspect(
        1: from org.jruby.ext.set.RubySet.size(
Java::JavaLang::NullPointerException ()

My environment info:

JRuby version: jruby (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

Copy link

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 milestone Jun 18, 2018
@kares kares closed this as completed in 5a244b8 Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants