[Dive4elements-commits] [PATCH 09 of 10] TIMParser: Switch to log4j instead of System.err

Wald Commits scm-commit at wald.intevation.org
Tue Jan 8 16:54:03 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1357645308 -3600
# Node ID 9a00be1acaee265712808f68151683efa6186b4d
# Parent  522b424c9c2aae410667ee0980fb366238a8f9b9
TIMParser: Switch to log4j instead of System.err .

diff -r 522b424c9c2a -r 9a00be1acaee flys-backend/src/main/java/de/intevation/flys/importer/parsers/tim/TIMParser.java
--- 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;
                 }
 


More information about the Dive4elements-commits mailing list