You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by "Peter Donald (JIRA)" <ji...@apache.org> on 2011/06/22 12:10:53 UTC
[jira] [Closed] (BUILDR-524) Optimized and more robust reading of
jar MANIFEST.MF
[ https://issues.apache.org/jira/browse/BUILDR-524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Peter Donald closed BUILDR-524.
-------------------------------
> Optimized and more robust reading of jar MANIFEST.MF
> ----------------------------------------------------
>
> Key: BUILDR-524
> URL: https://issues.apache.org/jira/browse/BUILDR-524
> Project: Buildr
> Issue Type: Improvement
> Components: Core features
> Affects Versions: 1.4.2
> Reporter: Hugues Malphettes
> Assignee: Alex Boisvert
> Fix For: 1.4.3
>
> Attachments: xsharpplugin.nuxeo-3.0.0-SNAPSHOT.jar
>
>
> When trying to read a jar's manifest with ::Buildr::Packaging::Java::Manifest.from_zip
> We observed a crash "cant dup nilClass" line 1132 of zip.rb
> It turns out that the jar generated by maven-3-beta contains a suspicious entry for the META-INF/maven folder.
> Opening this jar with kde's ark that entry's permissions is marked as ?rwxrwxrwx
> Opening this jar with gnome's archive utility that entry has a transparent blank icon and a size of 0 bytes: neither a file neither folder
> Anyways, java is content and linux is happy unzipping this jar without complains.
> A workaround to read the manifest of such jar is to use in lib/buildr/java/packaging.rb around line 54:
> # :call-seq:
> # from_zip(file) => manifest
> #
> # Parse the MANIFEST.MF entry of a ZIP (or JAR) file and return a new Manifest.
> def from_zip(file)
> Zip::ZipInputStream::open(file.to_s) { |io|
> while (entry = io.get_next_entry)
> if entry.name == 'META-INF/MANIFEST.MF'
> return Manifest.parse io.read rescue Manifest.new
> end
> end
> }
> return Manifest.new
> # Zip::ZipFile.open(file.to_s) do |zip|
> # Manifest.parse zip.read('META-INF/MANIFEST.MF') rescue Manifest.new
> # end
> end
> This method stops as soon as it encounters the MANIFEST.MF hence avoiding all possible following entries.
> It is a lot faster for a well formed jar where the MANIFEST is always the first entry.
> Thanks
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira