Menu

#34 Unzip fails with TypeError (can't dup NilClass)

open
nobody
None
5
2012-07-18
2010-04-08
Anonymous
No

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:ineach'
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:indup'
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:innew'
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:inunzip'
from ./deployscript.rb:58:in activemq' from ./deployscript.rb:136:inactivemq'
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

Discussion

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.