From: Tomas Wenström Date: Mon, 25 Mar 2019 21:12:01 +0000 (+0100) Subject: Always return a configuration X-Git-Url: http://dolda2000.com/gitweb/?a=commitdiff_plain;ds=sidebyside;h=2d8ddb23fc7f3ead7114314704319fff4dcce1a8;p=kaka%2Fcakelight.git Always return a configuration --- diff --git a/src/kaka/cakelight/Configuration.java b/src/kaka/cakelight/Configuration.java index 4a6a6a6..4f1525c 100644 --- a/src/kaka/cakelight/Configuration.java +++ b/src/kaka/cakelight/Configuration.java @@ -21,24 +21,13 @@ public class Configuration { } public static Configuration from(String propertiesFile) { - InputStream input = null; - try { - input = new FileInputStream(propertiesFile); - Properties prop = new Properties(); + Properties prop = new Properties(); + try (InputStream input = new FileInputStream(propertiesFile)) { prop.load(input); - return new Configuration(prop); } catch (IOException ex) { ex.printStackTrace(); - } finally { - if (input != null) { - try { - input.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } } - return null; + return new Configuration(prop); } private String get(Properties prop, String name) {