You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2010/11/23 20:29:53 UTC

svn commit: r1038294 - /buildr/trunk/spec/packaging/archive_spec.rb

Author: boisvert
Date: Tue Nov 23 19:29:53 2010
New Revision: 1038294

URL: http://svn.apache.org/viewvc?rev=1038294&view=rev
Log:
Ugh.  Java's jar tool doesn't like empty zips. Fix paranoid checks.

Modified:
    buildr/trunk/spec/packaging/archive_spec.rb

Modified: buildr/trunk/spec/packaging/archive_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/packaging/archive_spec.rb?rev=1038294&r1=1038293&r2=1038294&view=diff
==============================================================================
--- buildr/trunk/spec/packaging/archive_spec.rb (original)
+++ buildr/trunk/spec/packaging/archive_spec.rb Tue Nov 23 19:29:53 2010
@@ -430,13 +430,18 @@ describe "ZipTask" do
   # 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