changeset 558:609ced80bcf0

Fixed: used java 7 feature although java 6 comliance level is configured
author gernotbelger
date Thu, 28 Jun 2018 19:16:06 +0200
parents 5e487570d855
children 06257387b98f
files artifacts-common/src/main/java/org/dive4elements/artifacts/common/utils/Config.java
diffstat 1 files changed, 17 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts-common/src/main/java/org/dive4elements/artifacts/common/utils/Config.java	Wed Jun 27 14:41:15 2018 +0200
+++ b/artifacts-common/src/main/java/org/dive4elements/artifacts/common/utils/Config.java	Thu Jun 28 19:16:06 2018 +0200
@@ -8,11 +8,11 @@
 
 package org.dive4elements.artifacts.common.utils;
 
+import java.io.BufferedInputStream;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
+import java.io.InputStream;
 import java.util.Properties;
 
 import javax.xml.namespace.QName;
@@ -76,21 +76,26 @@
         return config;
     }
 
-    public static Properties loadProperties(final String CONFIG_FILE_LOCAL) {
+    public static Properties loadProperties(final String CONFIG_FILE_LOCAL) throws IOException {
         final File configDir = getConfigDirectory();
         final File configFile = new File(configDir, CONFIG_FILE_LOCAL);
 
-        final Properties properties = new Properties();
-        InputStreamReader reader;
+        InputStream reader = null;
         try {
-            reader = new InputStreamReader(Files.newInputStream(configFile.toPath()), StandardCharsets.ISO_8859_1);
+            reader = new BufferedInputStream(new FileInputStream(configFile));
+
+            final Properties properties = new Properties();
             properties.load(reader);
+            return properties;
+        } finally {
+            try {
+                if (reader != null)
+                    reader.close();
+            }
+            catch (final IOException e1) {
+                e1.printStackTrace();
+            }
         }
-        catch (final IOException e) {
-            e.printStackTrace();
-        }
-
-        return properties;
     }
 
     /**

http://dive4elements.wald.intevation.org