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