From 0a8a63c3db6f7dd719b06aecadacacd1e1dac796 Mon Sep 17 00:00:00 2001 From: Steven Daniels Date: Fri, 30 Dec 2016 11:24:33 -0500 Subject: [PATCH] JRuby fixes for OpenOffice Updated travis JRuby --- .travis.yml | 6 ++++-- lib/roo/open_office.rb | 5 +++-- test/test_roo.rb | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7dc7ba4b..be16dc02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,16 +4,18 @@ rvm: - 2.3.1 - 2.4.0 - ruby-head - - jruby-19mode # JRuby in 1.9 mode - rbx-2 + - jruby-9.1.6.0 matrix: include: - rvm: 2.0.0 gemfile: Gemfile_ruby2 - rvm: 2.1.8 gemfile: Gemfile_ruby2 + - rvm: jruby-19mode + gemfile: Gemfile_ruby2 allow_failures: - rvm: ruby-head - - rvm: jruby-19mode + - rvm: jruby-9.1.6.0 - rvm: rbx-2 bundler_args: --without local_development diff --git a/lib/roo/open_office.rb b/lib/roo/open_office.rb index 41abc779..6ccbe852 100644 --- a/lib/roo/open_office.rb +++ b/lib/roo/open_office.rb @@ -5,6 +5,7 @@ require 'roo/font' require 'roo/tempdir' require 'base64' +require 'openssl' module Roo class OpenOffice < Roo::Base @@ -345,7 +346,7 @@ def perform_decryption( def find_cipher(*args) fail ArgumentError, 'Unknown algorithm ' + algorithm unless args[0] == 'http://www.w3.org/2001/04/xmlenc#aes256-cbc' - cipher = OpenSSL::Cipher.new('AES-256-CBC') + cipher = ::OpenSSL::Cipher.new('AES-256-CBC') cipher.decrypt cipher.padding = 0 cipher.key = find_cipher_key(cipher, *args[1..4]) @@ -358,7 +359,7 @@ def find_cipher(*args) def find_cipher_key(*args) fail ArgumentError, 'Unknown key derivation name ', args[1] unless args[1] == 'PBKDF2' - OpenSSL::PKCS5.pbkdf2_hmac_sha1(args[2], args[3], args[4], args[0].key_len) + ::OpenSSL::PKCS5.pbkdf2_hmac_sha1(args[2], args[3], args[4], args[0].key_len) end # Block decrypt raw bytes from the zip file based on the cipher diff --git a/test/test_roo.rb b/test/test_roo.rb index afe2e6f4..31127b75 100644 --- a/test/test_roo.rb +++ b/test/test_roo.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 # Dump warnings that come from the test to open files # with the wrong spreadsheet class @@ -1494,6 +1495,8 @@ def test_close # process and passed the temp directories from the forked process in # order to check if they were removed properly. def test_finalize + skip if defined? JRUBY_VERSION + read, write = IO.pipe pid = Process.fork do with_each_spreadsheet(name: "numbers1") do |oo|