changeset 4786:9a00be1acaee

TIMParser: Switch to log4j instead of System.err .
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 08 Jan 2013 12:41:48 +0100
parents 522b424c9c2a
children 9c1964fe3995
files flys-backend/src/main/java/de/intevation/flys/importer/parsers/tim/TIMParser.java
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/tim/TIMParser.java	Tue Jan 08 12:33:27 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/tim/TIMParser.java	Tue Jan 08 12:41:48 2013 +0100
@@ -11,12 +11,17 @@
 import java.util.Map;
 import java.util.TreeMap;
 
+import org.apache.log4j.Logger;
+
 import de.intevation.flys.utils.EpsilonComparator;
 
 /** Parser for single .tim files. */
 // TODO switch to proper logging.
 public class TIMParser
 {
+    /** Private logger. */
+    private static Logger logger = Logger.getLogger(TIMParser.class);
+
     /** Proper encoding. */
     public static final String ENCODING =
         System.getProperty("tim.encoding", "ISO-8859-1");
@@ -48,7 +53,7 @@
             String row;
             while ((row = reader.readLine()) != null) {
                 if (row.length() < 54) {
-                    System.err.println("row too short");
+                    logger.warn("row too short");
                     continue;
                 }
                 double station, x, y, z;
@@ -58,7 +63,7 @@
                     y       = Double.parseDouble(row.substring(30, 40))/1000d;
                     z       = Double.parseDouble(row.substring(47, 54))/10000d;
                 } catch (NumberFormatException nfe) {
-                    System.err.println("Invalid row");
+                    logger.warn("Invalid row");
                     continue;
                 }
 

http://dive4elements.wald.intevation.org