Lenny Marks created JRUBY-6438:
----------------------------------

             Summary: "TypeError: can't convert Array into String" from ffi 
code in 1.9 mode
                 Key: JRUBY-6438
                 URL: https://jira.codehaus.org/browse/JRUBY-6438
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.6.6
            Reporter: Lenny Marks
            Assignee: Thomas E Enebo


{noformat}
TypeError: can't convert Array into String
                join at org/jruby/RubyArray.java:1868
          initialize at 
/projects/eds_test/share/jruby-1.6.6/lib/ruby/site_ruby/shared/ffi/ffi.rb:65
     attach_function at 
/projects/eds_test/share/jruby-1.6.6/lib/ruby/site_ruby/shared/ffi/library.rb:154
                each at org/jruby/RubyArray.java:1614
     attach_function at 
/projects/eds_test/share/jruby-1.6.6/lib/ruby/site_ruby/shared/ffi/library.rb:150
              LibXML at 
/Users/Shared/RubyGems/gems/nokogiri-1.4.4-java/lib/nokogiri/ffi/libxml.rb:275
            Nokogiri at 
/Users/Shared/RubyGems/gems/nokogiri-1.4.4-java/lib/nokogiri/ffi/libxml.rb:42
              (root) at 
/Users/Shared/RubyGems/gems/nokogiri-1.4.4-java/lib/nokogiri/ffi/libxml.rb:41

{noformat}

{noformat}
# jruby-1.6.6/lib/ruby/site_ruby/shared/ffi/library.rb" line 154
raise FFI::NotFoundError.new(cname.to_s, ffi_libraries.map { |lib| lib.name })
{noformat}

The code above is passing an array to FFI::NotFoundError#initialize(function, 
*libraries)

The following monkey patch to jruby-1.6.6/lib/ruby/site_ruby/shared/ffi/ffi.rb 
seemed to resolve the issue for me.

{noformat}
require 'ffi'

module FFI
  class NotFoundError < NativeError
    def initialize(function, *libraries)
      libraries.flatten!
      super("Function '#{function}' not found in [#{libraries[0].nil? ? 
'current process' : libraries.join(", ")}]")
    end
  end
end
{noformat}



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.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