Issue Type: Bug Bug
Affects Versions: JRuby 1.7.2
Assignee: Thomas E Enebo
Created: 14/Jan/13 9:26 PM
Description:

While trying to port a project to JRuby I've noticed an oddity when dumping a hash to JSON. I'm not 100% on the root cause of it but I've reduced it to a small case.

Installed gems:
rails 3.2.11

Note that this occurs with master at b004d04 as well as 1.7.2.

h = {'test1' => 'test2'}
ih = ActiveSupport::HashWithIndifferentAccess.new(h)

puts JSON.dump(h)
puts JSON.dump(ih)

This is where it gets weird. Depending on which libraries are included can induce different behaviour.

With the requires:

require 'rails'
require 'activesupport/all'

The NullPointer is raised.

IfNode.java:115:in `interpret': java.lang.NullPointerException
  from NewlineNode.java:105:in `interpret'
  from IfNode.java:116:in `interpret'
  from LocalAsgnNode.java:123:in `interpret'
  from NewlineNode.java:105:in `interpret'
  from BlockNode.java:71:in `interpret'
  from ASTInterpreter.java:75:in `INTERPRET_METHOD'
  from InterpretedMethod.java:182:in `call'
  from DefaultMethod.java:188:in `call'
  ...

(full backtrace in attachment)

Requiring just activesupport causes slightly different issues:

require 'activesupport/all'

I haven't looked into the Ruby side of things yet to see if this is related.

NoMethodError: undefined method `merge' for #<JSON::Ext::Generator::State:0x1a06ec2>

Requiring just HashWithIndifferentAccess and JSON no problems occur.

require 'json'
require 'active_support/hash_with_indifferent_access'
Project: JRuby
Priority: Major Major
Reporter: Lucas Maxwell
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to