changeset 2081:aa9cc91c8193

#444 Take care on NullPointerExceptions in getWQMode. Take 'false' as default value if no 'wq_free' item is existing. flys-artifacts/trunk@3597 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 05 Jan 2012 14:15:07 +0000
parents 0553e31d25e7
children 007a8f5ed9f1
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Jan 05 13:55:17 2012 +0000
+++ b/flys-artifacts/ChangeLog	Thu Jan 05 14:15:07 2012 +0000
@@ -1,3 +1,10 @@
+2012-01-05  Ingo Weinzierl <ingo@intevation.de>
+
+	flys/issue444 (error_no_export_found bei "W bei ungleichwertigem Abfluss")
+
+	* src/main/java/de/intevation/flys/utils/FLYSUtils.java: If no boolean
+	  value "wq_free" exists in getWQMode(), false is the default.
+
 2011-01-05	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	flys/issue443 (Querprofile: Hibernate LazyInitializationException) 
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Thu Jan 05 13:55:17 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Thu Jan 05 14:15:07 2012 +0000
@@ -157,8 +157,14 @@
      * @return an enum WQ_MODE.
      */
     public static WQ_MODE getWQMode(FLYSArtifact flys) {
+        if (flys == null) {
+            return WQ_MODE.NONE;
+        }
+
         String  mode = flys.getDataAsString("wq_mode");
-        boolean free = flys.getDataAsBoolean("wq_free");
+        Boolean free = flys.getDataAsBoolean("wq_free");
+
+        free = free != null ? free : false;
 
         if (mode != null && mode.equals("Q")) {
             return free ? WQ_MODE.QFREE : WQ_MODE.QGAUGE;

http://dive4elements.wald.intevation.org