Permalink
Browse files

Ugh. Java's jar tool doesn't like empty zips. Fix paranoid checks.

git-svn-id: https://svn.apache.org/repos/asf/buildr/trunk@1038294 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 2655934 commit b5f0e28f3fdff60e66a30e4386a1a693d9f1810c Alex Boisvert committed Nov 23, 2010
Showing with 6 additions and 1 deletion.
  1. +6 −1 spec/packaging/archive_spec.rb
@@ -430,13 +430,18 @@ def inspect_archive
# they are stricter than rubyzip
def checkZip(file)
return unless File.exist?(file)
+ empty = true
zip = Java.java.util.zip.ZipInputStream.new(Java.java.io.FileInputStream.new(file))
while entry = zip.getNextEntry do
# just iterate over all entries
+ empty = false
end
zip.close()
- sh "#{File.join(ENV['JAVA_HOME'], 'bin', 'jar')} tvf #{file}"
+ # jar tool fails with "ZipException: error in opening zip file" if empty
+ unless empty
+ sh "#{File.join(ENV['JAVA_HOME'], 'bin', 'jar')} tvf #{file}"
+ end
end
def inspect_archive

0 comments on commit b5f0e28

Please sign in to comment.