diff flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java @ 1367:ab8eb2f544f2

Replaced stdout and stderr logging with log4j loggers in server classes. flys-client/trunk@3069 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 25 Oct 2011 12:31:15 +0000
parents 460b8e0f0563
children bc06a671ef60
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java	Tue Oct 25 11:07:14 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java	Tue Oct 25 12:31:15 2011 +0000
@@ -12,6 +12,8 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+import org.apache.log4j.Logger;
+
 import com.google.gwt.user.server.rpc.RemoteServiceServlet;
 
 import de.intevation.artifacts.common.ArtifactNamespaceContext;
@@ -40,6 +42,10 @@
 extends      RemoteServiceServlet
 implements   ChartInfoService
 {
+    private static final Logger logger =
+        Logger.getLogger(ChartInfoServiceImpl.class);
+
+
     public static final String XPATH_TRANSFORM_MATRIX =
         "/art:chartinfo/art:transformation-matrix/art:matrix";
 
@@ -60,7 +66,7 @@
         Map<String, String> attr)
     throws ServerException
     {
-        System.out.println("ChartInfoServiceImpl.getChartInfo");
+        logger.info("ChartInfoServiceImpl.getChartInfo");
 
         Document request = ClientProtocolUtils.newOutCollectionDocument(
                 collection.identifier(),
@@ -86,7 +92,7 @@
             e.printStackTrace();
         }
 
-        System.err.println("Error while fetching chart info.");
+        logger.debug("Error while fetching chart info.");
 
         throw new ServerException(EXCEPTION_STRING);
     }
@@ -102,7 +108,7 @@
 
 
     protected Axis[] parseXAxes(Document doc) {
-        System.out.println("ChartInfoServiceImpl.parseXAxes");
+        logger.debug("ChartInfoServiceImpl.parseXAxes");
 
         NodeList axes = (NodeList) XMLUtils.xpath(
             doc,
@@ -115,7 +121,7 @@
 
 
     protected Axis[] parseYAxes(Document doc) {
-        System.out.println("ChartInfoServiceImpl.parseYAxes");
+        logger.debug("ChartInfoServiceImpl.parseYAxes");
 
         NodeList axes = (NodeList) XMLUtils.xpath(
             doc,
@@ -128,11 +134,11 @@
 
 
     protected Axis[] parseAxes(NodeList axes) {
-        System.out.println("ChartInfoServiceImpl.parseAxes");
+        logger.debug("ChartInfoServiceImpl.parseAxes");
 
         int count = axes != null ? axes.getLength() : 0;
 
-        System.out.println("Chart has " + count + " axes.");
+        logger.debug("Chart has " + count + " axes.");
 
         if (count == 0) {
             return null;
@@ -167,7 +173,7 @@
 
                 if (pos >= result.length) {
                     // this should never happen
-                    System.err.println("The axis is out of valid range: " + pos);
+                    logger.debug("The axis is out of valid range: " + pos);
                     continue;
                 }
 
@@ -178,7 +184,7 @@
             }
         }
 
-        System.out.println("Parsed " + result.length + " axes");
+        logger.debug("Parsed " + result.length + " axes");
 
         return result;
     }
@@ -193,7 +199,7 @@
      * coordinates.
      */
     protected Transform2D[] parseTransformationMatrix(Document doc) {
-        System.out.println("ChartInfoServiceImpl.parseTransformationMatrix");
+        logger.debug("ChartInfoServiceImpl.parseTransformationMatrix");
 
         NodeList matrix = (NodeList) XMLUtils.xpath(
             doc,
@@ -209,7 +215,7 @@
             Transform2D t = createTransformer(matrix.item(i));
 
             if (t == null) {
-                System.err.println("Broken transformation matrix at pos: " + i);
+                logger.warn("Broken transformation matrix at pos: " + i);
                 continue;
             }
 
@@ -242,11 +248,11 @@
                     Double.parseDouble(ty));
             }
             catch (NumberFormatException nfe) {
-                System.err.println("Error while parsing matrix values.");
+                logger.warn("Error while parsing matrix values.");
             }
         }
 
-        System.err.println("No matrix values found.");
+        logger.warn("No matrix values found.");
 
         return new Transform2D(1d, 1d, 0d, 0d);
     }

http://dive4elements.wald.intevation.org