Regression: to_java fails on arrays containing nil element
----------------------------------------------------------

                 Key: JRUBY-2957
                 URL: http://jira.codehaus.org/browse/JRUBY-2957
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.1.4
            Reporter: Dmitry Jemerov
            Priority: Critical


The following simple program completes successfully on JRuby 1.1.3 and earlier 
and throws an exception on JRuby 1.1.4:

{code}
include Java

values = [nil]
values.to_java(:'java.lang.Runnable')
{code}

The exception stacktrace is:
{code}
java.lang.reflect.Array:-2:in `set': java.lang.IllegalArgumentException: array 
element type mismatch
        from org.jruby.javasupport.JavaArray:121:in `setWithExceptionHandling'
        from org.jruby.java.addons.ArrayJavaAddons:108:in `copyDataToJavaArray'
        from org.jruby.javasupport.JavaClass:1511:in `javaArrayFromRubyArray'
        from org.jruby.java.addons.ArrayJavaAddons:80:in `to_java'
        from 
org.jruby.java.addons.ArrayJavaAddons$s_method_multi$RUBYFRAMEDINVOKER$to_java:-1:in
 `call'
        from org.jruby.runtime.CallSite$InlineCachingCallSite:156:in 
`cacheAndCall'
        from org.jruby.runtime.CallSite$InlineCachingCallSite:394:in `call'
        from test:4:in `__file__'
        from test:-1:in `__file__'
        from test:-1:in `load'
        from org.jruby.Ruby:544:in `runScript'
        from org.jruby.Ruby:457:in `runNormally'
        from org.jruby.Ruby:330:in `runFromMain'
        from org.jruby.Main:214:in `run'
        from org.jruby.Main:100:in `run'
        from org.jruby.Main:84:in `main'
{code}

Suggested fix (not tested): replace java_to_ruby with ruby_to_java in 
JavaUtil.java:318 (and similar contexts, like line 328).

-- 
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


Reply via email to