changeset 805:a549700c338d

Fixed encoding problem for query configuration.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 25 Nov 2015 13:34:39 +0100
parents 183396bac3fa
children fee42d7b2f33
files src/main/java/de/intevation/lada/query/QueryTools.java
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/query/QueryTools.java	Thu Nov 19 16:55:32 2015 +0100
+++ b/src/main/java/de/intevation/lada/query/QueryTools.java	Wed Nov 25 13:34:39 2015 +0100
@@ -14,6 +14,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Scanner;
 
 import javax.json.Json;
 import javax.json.JsonArray;
@@ -43,14 +44,13 @@
     public static String readConfigFile(String file) {
         try {
             InputStream inputStream = QueryConfig.class.getResourceAsStream(file);
-            int ch;
-            StringBuilder builder = new StringBuilder();
-            while((ch = inputStream.read()) != -1) {
-                builder.append((char)ch);
-            }
-            return builder.toString();
+            Scanner scanner = new Scanner(inputStream, "UTF-8");
+            scanner.useDelimiter("\\A");
+            String configString = scanner.next();
+            scanner.close();
+            return configString;
         }
-        catch (IOException ioe) {
+        catch (Exception ioe) {
             ioe.printStackTrace();
             return null;
         }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)