Round-trip serialization of BigDecimal using Marshal creates invalid Ruby
value, which triggers native Java NPE
---------------------------------------------------------------------------------------------------------------
Key: JRUBY-2272
URL: http://jira.codehaus.org/browse/JRUBY-2272
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.0.3
Environment: Rails 2.0.2
Reporter: Robin Salkeld
The bug in a nutshell is expressed in the following:
Marshal.load(Marshal.dump(BigDecimal.new('0.0'))).inspect
The inspect is arbitrary, as the result of Marshal.load is a corrupted value
that throws the following on pretty much any method call:
NativeException: java.lang.NullPointerException: null
from RubyBigDecimal.java:670:in `org.jruby.RubyBigDecimal.to_s'
from null:-1:in `org.jruby.RubyBigDecimalInvokerto_sxx1.call'
from FastInvocationCallback.java:49:in
`org.jruby.runtime.callback.FastInvocationCallback.execute'
from SimpleCallbackMethod.java:81:in
`org.jruby.internal.runtime.methods.SimpleCallbackMethod.call'
from AliasMethod.java:71:in
`org.jruby.internal.runtime.methods.AliasMethod.call'
from EvaluationState.java:1039:in
`org.jruby.evaluator.EvaluationState.fCallNode'
(...etc...)
This is because the RubyBigDecimal value points to a null java.math.BigDecimal.
FYI, this was originally discovered in Rails, while trying to put an
ActiveRecord object with a BigDecimal attribute value into the session.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
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