changeset 7657:84573d5935be

Improved logging.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 05 Dec 2013 22:22:37 +0100 (2013-12-05)
parents ad5238e3e736
children 4fb5e89e7bd3
files artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelSelectState.java
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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();

http://dive4elements.wald.intevation.org