Zip::ZipFile.open(file) fails on some zip files (e.g. http://mirrors.enquira.co.uk/apache/activemq/apache-activemq/5.3.0/apache-activemq-5.3.0-bin.zip) with the stack trace:
c:/jruby-1.4.0/lib/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1163:in dup': can't dup NilClass (TypeError)
from c:/jruby-1.4.0/lib/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1163:in
each'
from c:/jruby-1.4.0/lib/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1163:in map'
from c:/jruby-1.4.0/lib/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1163:in
dup'
from c:/jruby-1.4.0/lib/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1399:in initialize'
from c:/jruby-1.4.0/lib/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1410:in
new'
from c:/jruby-1.4.0/lib/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1410:in open'
from ./deployscript.rb:87:in
unzip'
from ./deployscript.rb:58:in activemq'
from ./deployscript.rb:136:in
activemq'
from ../../test/ruby/example.rb:3
Same error in MRI 1.8.6.
The file opens fine with WinZip and the unzip utility supplied with Oracle XE 10.2.0. If extracted and then zipped up again with Winzip, rubyzip handles the resulting file fine.
I assume there's something strange going on with this particular zip file, but afraid I don't know enough about the format to figure out what.
Environment:
Windows XP, JRuby 1.4.0 (on Java 1.5.0_20)/MRI 1.8.6
Anonymous