Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.6
-
Fix Version/s: JRuby 1.7.0.pre1
-
Component/s: None
-
Labels:None
-
Patch Submitted:Yes
-
Number of attachments :
Description
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
# 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 })
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.
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
This does not happen in JRuby-1.6.6 1.8 mode. I believe this is a regression from JRuby-1.6.5.1 as it only started happening after we upgraded.