Author: boisvert
Date: Tue Oct 12 17:05:35 2010
New Revision: 1021841

URL: http://svn.apache.org/viewvc?rev=1021841&view=rev
Log:
BUILDR-524 Optimized and more robust reading of jar MANIFEST.MF (Hugues 
Malphettes)

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/java/packaging.rb

Modified: buildr/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1021841&r1=1021840&r2=1021841&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Tue Oct 12 17:05:35 2010
@@ -9,6 +9,7 @@
           `include?' for nil:NilClass
 * Fixed:  BUILDR-515 -update-snapshot doesn't work as expected
 * Fixed:  BUILDR-517 package(:jar).include(directory, :as=>"foo") produces a 
corrupted jar
+* Fixed:  BUILDR-524 Optimized and more robust reading of jar MANIFEST.MF 
(Hugues Malphettes)
 * Fixed:  BUILDR-525 Documentation refers to repositories.upload_to rather than
           repositories.release_to (Peter Donald)
 * Fixed:  BUILDR-526 Gracefully handle h2 sections with no id in documentation 
(Peter Donald)

Modified: buildr/trunk/lib/buildr/java/packaging.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/packaging.rb?rev=1021841&r1=1021840&r2=1021841&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/packaging.rb (original)
+++ buildr/trunk/lib/buildr/java/packaging.rb Tue Oct 12 17:05:35 2010
@@ -56,9 +56,14 @@ module Buildr
           #
           # Parse the MANIFEST.MF entry of a ZIP (or JAR) file and return a 
new Manifest.
           def from_zip(file)
-            Zip::ZipFile.open(file.to_s) do |zip|
-              Manifest.parse zip.read('META-INF/MANIFEST.MF') rescue 
Manifest.new
+            Zip::ZipInputStream::open(file.to_s) do |zip|
+              while (entry = zip.get_next_entry)
+                if entry.name == 'META-INF/MANIFEST.MF'
+                  return Manifest.parse zip.read
+                end
+              end
             end
+            Manifest.new
           end
 
           # :call-seq:


Reply via email to