diff options
author | Raphael <raphael@google.com> | 2011-10-18 11:34:08 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-10-18 11:34:08 -0700 |
commit | 95a064732bb0cdea806ddd3167442c9e688eaf84 (patch) | |
tree | d9a3e3d8ccd258320dafa31812733b1e251aac09 /anttasks/src/com | |
parent | 911a1f2914352fc0b64ec034b2ba0874a3ec11e3 (diff) | |
parent | 796b6c0491833587ba096a33bd0d34329f6213c5 (diff) | |
download | sdk-95a064732bb0cdea806ddd3167442c9e688eaf84.zip sdk-95a064732bb0cdea806ddd3167442c9e688eaf84.tar.gz sdk-95a064732bb0cdea806ddd3167442c9e688eaf84.tar.bz2 |
Merge "Code cleanup: make sure FileInputStreams are closed."
Diffstat (limited to 'anttasks/src/com')
-rw-r--r-- | anttasks/src/com/android/ant/TaskHelper.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/anttasks/src/com/android/ant/TaskHelper.java b/anttasks/src/com/android/ant/TaskHelper.java index a360eaf..8a3d6bc 100644 --- a/anttasks/src/com/android/ant/TaskHelper.java +++ b/anttasks/src/com/android/ant/TaskHelper.java @@ -59,7 +59,20 @@ final class TaskHelper { // tools folder must exist, or this custom task wouldn't run! File toolsFolder= new File(sdkFile, SdkConstants.FD_TOOLS); File sourceProp = new File(toolsFolder, SdkConstants.FN_SOURCE_PROP); - p.load(new FileInputStream(sourceProp)); + + FileInputStream fis = null; + try { + fis = new FileInputStream(sourceProp); + p.load(fis); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (IOException ignore) { + } + } + } + String value = p.getProperty("Pkg.Revision"); //$NON-NLS-1$ if (value != null) { return Integer.parseInt(value); |