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) {
+ }
}
}
}