Return-Path: Delivered-To: apmail-felix-dev-archive@www.apache.org Received: (qmail 40455 invoked from network); 6 Aug 2008 04:27:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Aug 2008 04:27:45 -0000 Received: (qmail 23493 invoked by uid 500); 6 Aug 2008 04:27:44 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 23302 invoked by uid 500); 6 Aug 2008 04:27:43 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 23291 invoked by uid 99); 6 Aug 2008 04:27:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Aug 2008 21:27:43 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Aug 2008 04:26:47 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5E8A7234C189 for ; Tue, 5 Aug 2008 21:26:44 -0700 (PDT) Message-ID: <541482010.1217996804372.JavaMail.jira@brutus> Date: Tue, 5 Aug 2008 21:26:44 -0700 (PDT) From: "Stuart McCulloch (JIRA)" To: dev@felix.apache.org Subject: [jira] Commented: (FELIX-661) maven bundle plugin does not close the accessed fie /jar streams In-Reply-To: <366593997.1217977124417.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/FELIX-661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12620131#action_12620131 ] Stuart McCulloch commented on FELIX-661: ---------------------------------------- > Maven bundle plugin is doing the following. > > i) When someone (from a pom.xml) uses this plug-in, to bundlize their project jars, this plugin first opens a jar file for reading. And then later after in some other method call, it opens the SAME file for writing. Basically it dynamically changes the content of the jar for reading and writing. Could you be a bit clearer about which jarfile is being read and written - Bnd actually does most of the building of the bundle in memory, and only writes this out to "target/classes" when that particular build is complete. This file is then installed to the local repository, and subsequent builds in the Maven reactor will either use the file from the local repository, or the one in "target/classes" which is at that point no longer being written. There is some potential for confusion, because the Bnd Jar class can actually work off a jarfile, a directory, or its own internal storage (memory) - so not all the places you mention technically need to be closed, because for some of them there is no underlying jarfile to close. However, it is definitely good practice to be consistent and call close in all places where we're done with that Bnd Jar object :) > ii) This plugin forgets to call the close() method on the file / zip/jar/ resource of jdk and aQute packages. > > How to fix: > > i) Please call close() at places wherever your are trying to read and write ZipFile JarFile or aQute's Analyzer , ZipResource , Jar class files from > biz/aQute/bndlib/0.0.255/.. /OSGI-OPT/src/aQute/lib/osgi could you work with Peter Kriens (http://aqute.biz/Code/Bnd) to get the appropriate fixes into Bnd? then we can pick up the new Bnd library in the next release. > And also at > > org/apache/maven/shared/maven-osgi/0.2.0/tt/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java this will need to be handled by the Maven team - contact Carlos Sanchez (carlos@apache.org) or raise an issue at http://jira.codehaus.org/browse/MSHARED > ii) At org/apache/felix/bundleplugin/BundlePlugin.java > > where where "classpath" variable is actually an Array of Jar files that need to closed upon task is done. > Note that the Jar here is from aQute and it has got resource map. So each Jar object might have recursive resources. So, please walk through the map > and close each resource if it is FileResource/ JarResource / ZipResource. well we can definitely loop through the array and call close on the jars, but will need to rely on Bnd to close the internal resource map. > iii) At org/apache/felix/bundleplugin/BundlePlugin.java > I also suspect the place in the same BundlePlugin.java, where we call unpackBundle(...) and call ManifestPlugin.writeManifest(... , ..) > Please make sure the streams are closed. unpackBundle uses the Maven archiver component, which does close the stream - similarly writeManifest closes its stream with a finally block. > -- A generic message. > We need this very urgently. We appreciate your timely action. Any comments, questions please send it to me directly. > I can work with you to provide the fix and verify the fix. > > Many thanks in advance. > > Harsha > maven bundle plugin does not close the accessed fie /jar streams > ---------------------------------------------------------------- > > Key: FELIX-661 > URL: https://issues.apache.org/jira/browse/FELIX-661 > Project: Felix > Issue Type: Bug > Components: Maven Bundle Plugin > Affects Versions: maven-bundle-plugin-1.4.2 > Environment: maven 2 > jdk 5 or 6 > any OS where JDK is supported > Reporter: Harsha Godugu > Priority: Blocker > Fix For: maven-bundle-plugin-1.4.3 > > > Maven bundle plugin is doing the following. > i) When someone (from a pom.xml) uses this plug-in, to bundlize their project jars, this plugin first opens a jar file for reading. And then later after in some other method call, it opens the SAME file for writing. Basically it dynamically changes the content of the jar for reading and writing. > ii) This plugin forgets to call the close() method on the file / zip/jar/ resource of jdk and aQute packages. > How to fix: > i) Please call close() at places wherever your are trying to read and write ZipFile JarFile or aQute's Analyzer , ZipResource , Jar class files from > biz/aQute/bndlib/0.0.255/.. /OSGI-OPT/src/aQute/lib/osgi > And also at > org/apache/maven/shared/maven-osgi/0.2.0/tt/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java > ii) At org/apache/felix/bundleplugin/BundlePlugin.java > where where "classpath" variable is actually an Array of Jar files that need to closed upon task is done. > Note that the Jar here is from aQute and it has got resource map. So each Jar object might have recursive resources. So, please walk through the map > and close each resource if it is FileResource/ JarResource / ZipResource. > > iii) At org/apache/felix/bundleplugin/BundlePlugin.java > I also suspect the place in the same BundlePlugin.java, where we call unpackBundle(...) and call ManifestPlugin.writeManifest(... , ..) > Please make sure the streams are closed. > -- A generic message. > We need this very urgently. We appreciate your timely action. Any comments, questions please send it to me directly. > I can work with you to provide the fix and verify the fix. > Many thanks in advance. > Harsha -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.