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

jruby 1.7.10 raises unexpected arity error (1 for 0) when creating a java.math.BigDecimal #2039

Closed
peter-ryan opened this issue Oct 10, 2014 · 1 comment

Comments

@peter-ryan
Copy link

@peter-ryan peter-ryan commented Oct 10, 2014

When using the oracle enhanced adapter I ran into the following issue:

ArgumentError: wrong number of arguments (1 for 0)
activerecord-oracle_enhanced-adapter-1.4.2/lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb:426:in `ruby_to_java_value'
activerecord-oracle_enhanced-adapter-1.4.2/lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb:313:in `bind_param'
activerecord-oracle_enhanced-adapter-1.4.2/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:718:in `exec_insert'

Take a look at the oracle enhanced adapters code but the exception is thrown from here:

java.math.BigDecimal.new(value.to_s)

value.to_s satisfies a when String test and takes no arguments.
java.math.BigDecimal.new does have 1 argument constructors.

This exception has occurred once in a production environment and has not been reproducible. This function is being passed a string and a symbol (in this particular case the string "114.0" and a symbol :decimal). Most of the time it works exactly as expected and creates a BigDecimal.

The error does not make any sense. Since the exception appears to originate from jruby and not java it seems like this must be a jruby bug although I have no idea what could be causing it. The code being run has not made any modification to String or java.math.BigDecimal

Our specific environment:

  • jdk1.7.0_51
  • jruby-1.7.10
@kares
Copy link
Member

@kares kares commented Jun 4, 2015

greetings, this is very likely related to Java integration's concurrent proxy class initialization ... which has been much improved in 1.7.20 and errors such as these are no longer expected.
however if you do seem to reproduce with 1.7.20 (or later), please do let us know. thank you!

@kares kares closed this Jun 4, 2015
@kares kares modified the milestones: JRuby 1.7.20, JRuby 1.7.21 Jul 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.