[PATCH 2 of 2] Improved logging

Wald Commits scm-commit at wald.intevation.org
Fri Dec 6 07:12:52 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1386278557 -3600
# Node ID 84573d5935be65edad81717010c162f8b55088c0
# Parent  ad5238e3e7362c59f12dabaadc34a490856c2d54
Improved logging.

diff -r ad5238e3e736 -r 84573d5935be artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelSelectState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelSelectState.java	Thu Dec 05 22:04:15 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelSelectState.java	Thu Dec 05 22:22:37 2013 +0100
@@ -55,6 +55,7 @@
     /**
      * @param flys ignored
      * @param cc   ignrored
+     * @param stateData ignored
      */
     @Override
     public StateData transform(
@@ -162,20 +163,26 @@
         }
         else {
             if (rawData == null) {
-                logger.error("Null data arrived at WaterlevelSelectState.");
+                logger.error("Do not know how to handle null data " +
+                    "from artifact class " + artifact.getClass());
             }
             else {
                 logger.error("Do not know how to handle " + rawData.getClass());
             }
 
             wkms = null;
+        if (wqkms == null || wqkms.length == 0) {
+            logger.error("No data for label generation.");
+            // This is critical, will fail without much grace later further down
+            // the road.
+            return new String[] {""};
         }
 
         int idx = -1;
         try {
             idx = Integer.parseInt(parts[2]);
             if (wkms[idx] == null) {
-                logger.warn("null label for " + value + " (" + parts[2] + ")");
+                logger.error("null label for " + value + " (" + parts[2] + ")");
                 return new String[] {""};
             }
             String name = wkms[idx].getName();


More information about the Dive4elements-commits mailing list