Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-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 A11ED75EE for ; Thu, 28 Jul 2011 11:59:31 +0000 (UTC) Received: (qmail 45275 invoked by uid 500); 28 Jul 2011 11:59:30 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 45201 invoked by uid 500); 28 Jul 2011 11:59:28 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 45193 invoked by uid 99); 28 Jul 2011 11:59:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jul 2011 11:59:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jul 2011 11:59:25 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id A794823889BB; Thu, 28 Jul 2011 11:59:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1151805 - in /sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl: BootstrapInstaller.java Sling.java Date: Thu, 28 Jul 2011 11:59:05 -0000 To: commits@sling.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110728115905.A794823889BB@eris.apache.org> Author: cziegeler Date: Thu Jul 28 11:59:04 2011 New Revision: 1151805 URL: http://svn.apache.org/viewvc?rev=1151805&view=rev Log: SLING-2160 : Close input streams Modified: sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/BootstrapInstaller.java sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/Sling.java Modified: sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/BootstrapInstaller.java URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/BootstrapInstaller.java?rev=1151805&r1=1151804&r2=1151805&view=diff ============================================================================== --- sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/BootstrapInstaller.java (original) +++ sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/BootstrapInstaller.java Thu Jul 28 11:59:04 2011 @@ -202,7 +202,7 @@ class BootstrapInstaller implements Bund File slingStartupDir = getSlingStartupDir(slingHome); // execute bootstrap commands, if needed - BootstrapCommandFile cmd = new BootstrapCommandFile(logger, new File(slingHome, BOOTSTRAP_CMD_FILENAME)); + final BootstrapCommandFile cmd = new BootstrapCommandFile(logger, new File(slingHome, BOOTSTRAP_CMD_FILENAME)); cmd.execute(context); boolean shouldInstall = false; @@ -420,23 +420,30 @@ class BootstrapInstaller implements Bund continue; } - // ensure we have a directory for the startlevel only when - // needed - if (startUpLevelDir == null) { - startUpLevelDir = getOrCreateDirectory(slingStartupDir, - String.valueOf(startLevel)); - } - - // copy over the bundle based on the startlevel - String bundleFileName = extractFileName(path); - File bundleFile = new File(startUpLevelDir, bundleFileName); try { - copyStreamToFile(ins, bundleFile); - } catch (IOException e) { - // should this fail here or just log a warning? - throw new RuntimeException("Failure copying file from " - + path + " to startup dir (" + startUpLevelDir - + ") and name (" + bundleFileName + "): " + e, e); + // ensure we have a directory for the startlevel only when + // needed + if (startUpLevelDir == null) { + startUpLevelDir = getOrCreateDirectory(slingStartupDir, + String.valueOf(startLevel)); + } + + // copy over the bundle based on the startlevel + String bundleFileName = extractFileName(path); + File bundleFile = new File(startUpLevelDir, bundleFileName); + try { + copyStreamToFile(ins, bundleFile); + } catch (IOException e) { + // should this fail here or just log a warning? + throw new RuntimeException("Failure copying file from " + + path + " to startup dir (" + startUpLevelDir + + ") and name (" + bundleFileName + "): " + e, e); + } + } finally { + try { + ins.close(); + } catch (IOException ignore) { + } } } } Modified: sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/Sling.java URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/Sling.java?rev=1151805&r1=1151804&r2=1151805&view=diff ============================================================================== --- sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/Sling.java (original) +++ sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/base/impl/Sling.java Thu Jul 28 11:59:04 2011 @@ -862,6 +862,13 @@ public class Sling implements BundleActi } catch (IOException ioe) { this.logger.log(Logger.LOG_ERROR, "Error loading config properties from " + file, ioe); + } finally { + if ( is != null ) { + try { + is.close(); + } catch (IOException ignore) { + } + } } } } @@ -884,6 +891,11 @@ public class Sling implements BundleActi } catch (IOException ioe) { this.logger.log(Logger.LOG_ERROR, "Error loading config properties from " + resource, ioe); + } finally { + try { + is.close(); + } catch (IOException ignore) { + } } } }