This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.6 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git
commit cfe23d45095630652460302c20c633ff0c8c2d07 Author: Bertrand Delacretaz <[email protected]> AuthorDate: Thu Jan 14 14:17:04 2010 +0000 SLING-1285 - Launchpad did not start under Windows git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/osgi@899208 13f79535-47bb-0310-9956-ffa450edef68 --- .../osgi/bundleversion/FileBundleVersionInfo.java | 43 +++++++++++++--------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/apache/sling/commons/osgi/bundleversion/FileBundleVersionInfo.java b/src/main/java/org/apache/sling/commons/osgi/bundleversion/FileBundleVersionInfo.java index 627e5b1..9a9a68f 100644 --- a/src/main/java/org/apache/sling/commons/osgi/bundleversion/FileBundleVersionInfo.java +++ b/src/main/java/org/apache/sling/commons/osgi/bundleversion/FileBundleVersionInfo.java @@ -37,26 +37,33 @@ public class FileBundleVersionInfo extends BundleVersionInfo<File> { public FileBundleVersionInfo(File bundle) throws IOException { source = bundle; - final Manifest m = new JarFile(bundle).getManifest(); - if(m == null) { - symbolicName = null; - version = null; - isSnapshot = false; - lastModified = BND_LAST_MODIFIED_MISSING; - } else { - symbolicName = m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME); - final String v = m.getMainAttributes().getValue(Constants.BUNDLE_VERSION); - version = v == null ? null : new Version(v); - isSnapshot = v != null && v.contains(SNAPSHOT_MARKER); - final String last = m.getMainAttributes().getValue(BND_LAST_MODIFIED); - long lastMod = BND_LAST_MODIFIED_MISSING; - if(last != null) { - try { - lastMod = Long.parseLong(last); - } catch(NumberFormatException ignore) { + final JarFile f = new JarFile(bundle); + try { + final Manifest m = f.getManifest(); + if(m == null) { + symbolicName = null; + version = null; + isSnapshot = false; + lastModified = BND_LAST_MODIFIED_MISSING; + } else { + symbolicName = m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME); + final String v = m.getMainAttributes().getValue(Constants.BUNDLE_VERSION); + version = v == null ? null : new Version(v); + isSnapshot = v != null && v.contains(SNAPSHOT_MARKER); + final String last = m.getMainAttributes().getValue(BND_LAST_MODIFIED); + long lastMod = BND_LAST_MODIFIED_MISSING; + if(last != null) { + try { + lastMod = Long.parseLong(last); + } catch(NumberFormatException ignore) { + } } + lastModified = lastMod; + } + } finally { + if(f != null) { + f.close(); } - lastModified = lastMod; } } -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
