summaryrefslogtreecommitdiffstats
path: root/jack/tests
diff options
context:
space:
mode:
authormikaelpeltier <mikaelpeltier@google.com>2015-04-03 09:58:11 +0200
committermikaelpeltier <mikaelpeltier@google.com>2015-04-07 16:39:49 +0200
commita26140be0f0575cc9c046ffe03908e1fc0435fe7 (patch)
treeee0478845926fc51ff960340c08fdb2e37e665a8 /jack/tests
parentb645908a436ee68af9a556ad12570d4c4653f55c (diff)
downloadtoolchain_jack-a26140be0f0575cc9c046ffe03908e1fc0435fe7.tar.gz
toolchain_jack-a26140be0f0575cc9c046ffe03908e1fc0435fe7.tar.bz2
toolchain_jack-a26140be0f0575cc9c046ffe03908e1fc0435fe7.zip
Remove warnings
Change-Id: I9c5eb7bc2bf9a7ee1a07e7620eed16f739f2b965
Diffstat (limited to 'jack/tests')
-rw-r--r--jack/tests/com/android/jack/TestTools.java5
-rw-r--r--jack/tests/com/android/jack/test/TestsProperties.java23
2 files changed, 20 insertions, 8 deletions
diff --git a/jack/tests/com/android/jack/TestTools.java b/jack/tests/com/android/jack/TestTools.java
index 41712bb6..223e4daa 100644
--- a/jack/tests/com/android/jack/TestTools.java
+++ b/jack/tests/com/android/jack/TestTools.java
@@ -261,8 +261,9 @@ public class TestTools {
public static Options buildCommandLineArgs(@Nonnull File fileOrSourcelist,
@CheckForNull File jarjarRules) throws IOException {
Options options = buildCommandLineArgs(null /* classpath */, new File[] {fileOrSourcelist});
- options.setJarjarRulesFile(jarjarRules);
-
+ if (jarjarRules != null) {
+ options.setJarjarRulesFile(jarjarRules);
+ }
return options;
}
diff --git a/jack/tests/com/android/jack/test/TestsProperties.java b/jack/tests/com/android/jack/test/TestsProperties.java
index a11c3e02..1956f18f 100644
--- a/jack/tests/com/android/jack/test/TestsProperties.java
+++ b/jack/tests/com/android/jack/test/TestsProperties.java
@@ -54,13 +54,24 @@ public class TestsProperties {
if (!propertyFile.exists()) {
throw new TestConfigurationException("Configuration file not found: '" + filePath + "'");
}
- try {
- testsProperties.load(new FileInputStream(propertyFile));
- } catch (FileNotFoundException e) {
- throw new TestConfigurationException(e);
- } catch (IOException e) {
- throw new TestConfigurationException(e);
+
+ FileInputStream is = null;
+ try {
+ is = new FileInputStream(propertyFile);
+ testsProperties.load(is);
+ } catch (FileNotFoundException e) {
+ throw new TestConfigurationException(e);
+ } catch (IOException e) {
+ throw new TestConfigurationException(e);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // No need to manage failure when closing input stream
+ }
}
+ }
String jackHome = testsProperties.getProperty("jack.home");