make inputstream auto-closeable
@@ -2,6 +2,7 @@ package mage.utils.properties;
import org.apache.log4j.Logger;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
@@ -19,16 +20,13 @@ public final class PropertiesUtil {
private static Properties properties = new Properties();
static {
- InputStream in = PropertiesUtil.class.getResourceAsStream("/xmage.properties");
- if (in != null) {
- try {
+ try (InputStream in = PropertiesUtil.class.getResourceAsStream("/xmage.properties")) {
properties.load(in);
- } catch (IOException e) {
- logger.error("Couldn't load properties", e);
- }
- } else {
+ } catch (FileNotFoundException fnfe) {
logger.warn("No xmage.properties were found on classpath");
-
+ } catch (IOException e) {
+ logger.error("Couldn't load properties");
+ e.printStackTrace();
}
}
