Skip to content

Commit

Permalink
Fix to avoid the error: undefined field 'map' for class 'Java::OrgJru…
Browse files Browse the repository at this point in the history
…by::RubyObjectSpace::WeakMap' with JRuby 9.4.6.0 or later
  • Loading branch information
rammpeter committed Jun 18, 2024
1 parent 88c5ae2 commit 85425df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

module Panorama
# VERSION and RELEASE_DATE should have fix syntax and positions because they are parsed from other sites
VERSION = '2.17.46'
VERSION = '2.17.47'
RELEASE_DATE = Date.parse('2024-06-18')

RELEASE_DAY = "%02d" % RELEASE_DATE.day
Expand Down
13 changes: 13 additions & 0 deletions config/boot.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

require "bundler/setup" # Set up gems listed in the Gemfile.


# Workaround to avoid the error: undefined field 'map' for class 'Java::OrgJruby::RubyObjectSpace::WeakMap'
# with oracle-enhanced-adapter 6.1.6 and JRuby 9.4.6.0 and following versions
# Prevent execution of the code block in the if statement by comparing RUBY_ENGINE with a not existing value
# This patches the gem each time it is installed again
# Peter Ramm, 2024-06-18
# See also: https://github.com/rsim/oracle-enhanced/pull/2360

file_path = File.join(Dir.pwd, 'vendor', 'bundle', 'jruby', '3.1.0', 'gems', 'activerecord-oracle_enhanced-adapter-6.1.6', 'lib', 'active_record', 'connection_adapters', 'oracle_enhanced_adapter.rb')
content = File.read(file_path)
new_content = content.gsub("if RUBY_ENGINE == \"jruby\"", "if RUBY_ENGINE == \"xjruby\"")
File.open(file_path, 'w') { |file| file.write(new_content) }

0 comments on commit 85425df

Please sign in to comment.