You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by to...@apache.org on 2010/04/12 00:39:12 UTC

svn commit: r933004 - in /buildr/trunk: CHANGELOG lib/buildr/java/packaging.rb spec/java/packaging_spec.rb

Author: toulmean
Date: Sun Apr 11 22:39:12 2010
New Revision: 933004

URL: http://svn.apache.org/viewvc?rev=933004&view=rev
Log:
fix for BUILDR-423 MANIFEST.MF files are not closed, leading to open files leak.

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

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=933004&r1=933003&r2=933004&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Sun Apr 11 22:39:12 2010
@@ -127,6 +127,7 @@
 * Fixed:  BUILDR-414 Provide tag_name method on GitRelease as part of API
 * Fixed:  BUILDR-419 Exclusion patterns only work if they contain a wildcard
 * Fixed:  BUILDR-421 The MANIFEST.MF file packaged by Buildr as permissions set to 600
+* Fixed:  BUILDR-423 MANIFEST.MF files are not closed, leading to open files leak.
 1.3.5 (2009-10-05)
 * Added:  Interactive shell (REPL) support
 * Added:  BeanShell as default shell for java projects, bsh is small and it's

Modified: buildr/trunk/lib/buildr/java/packaging.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/packaging.rb?rev=933004&r1=933003&r2=933004&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/packaging.rb (original)
+++ buildr/trunk/lib/buildr/java/packaging.rb Sun Apr 11 22:39:12 2010
@@ -178,7 +178,7 @@ module Buildr
               #@manifest_tmp.write Manifest::STANDARD_HEADER
               @manifest_tmp.write manifest.to_s
               @manifest_tmp.write "\n"
-              @manifest_tmp.rewind
+              @manifest_tmp.close
               path('META-INF').include @manifest_tmp.path, :as=>'MANIFEST.MF'
             end
           end

Modified: buildr/trunk/spec/java/packaging_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/packaging_spec.rb?rev=933004&r1=933003&r2=933004&view=diff
==============================================================================
--- buildr/trunk/spec/java/packaging_spec.rb (original)
+++ buildr/trunk/spec/java/packaging_spec.rb Sun Apr 11 22:39:12 2010
@@ -120,6 +120,16 @@ shared_examples_for 'package with manife
       manifest.main['bar'].should eql('Bar')
     end
   end
+  
+  it 'should close the temporary file used for packaging the MANIFEST.MF file' do
+    package_with_manifest 'Foo'=>1, :bar=>'Bar'
+    package = project('foo').package(@packaging)
+    package.invoke
+    module AccessManifestTMP
+      attr_reader :manifest_tmp
+    end
+    (package.dup.extend(AccessManifestTMP).manifest_tmp.closed?).should be_true
+  end
 
   it 'should end hash manifest with EOL' do
     package_with_manifest 'Foo'=>1, :bar=>'Bar'