Return-Path: X-Original-To: apmail-buildr-commits-archive@www.apache.org Delivered-To: apmail-buildr-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 79E8C6E50 for ; Wed, 22 Jun 2011 10:11:35 +0000 (UTC) Received: (qmail 63362 invoked by uid 500); 22 Jun 2011 10:11:35 -0000 Delivered-To: apmail-buildr-commits-archive@buildr.apache.org Received: (qmail 63344 invoked by uid 500); 22 Jun 2011 10:11:35 -0000 Mailing-List: contact commits-help@buildr.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@buildr.apache.org Delivered-To: mailing list commits@buildr.apache.org Received: (qmail 63337 invoked by uid 500); 22 Jun 2011 10:11:35 -0000 Delivered-To: apmail-incubator-buildr-commits@incubator.apache.org Received: (qmail 63334 invoked by uid 99); 22 Jun 2011 10:11:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jun 2011 10:11:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jun 2011 10:11:34 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id EF565428617 for ; Wed, 22 Jun 2011 10:10:53 +0000 (UTC) Date: Wed, 22 Jun 2011 10:10:53 +0000 (UTC) From: "Peter Donald (JIRA)" To: buildr-commits@incubator.apache.org Message-ID: <1855737935.28023.1308737453977.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Closed] (BUILDR-524) Optimized and more robust reading of jar MANIFEST.MF MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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