changeset 3313:1a9ab048573a

Prevent nasty NPE. flys-artifacts/trunk@5002 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 13 Jul 2012 19:01:03 +0000 (2012-07-13)
parents 41a7b171bd59
children fbeed0ded014
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Jul 13 16:11:13 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Jul 13 19:01:03 2012 +0000
@@ -1,3 +1,8 @@
+2012-07-13	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/WaterlevelExporter.java:
+	  Prevent nasty NPE (hidden by autobox).
+
 2012-07-13	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/sq/SQRelationGenerator.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Fri Jul 13 16:11:13 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Fri Jul 13 19:01:03 2012 +0000
@@ -474,8 +474,13 @@
 
         long startTime = System.currentTimeMillis();
 
-        String colDesc = FLYSUtils.getNamedMainValue((WINFOArtifact)flys,
-            wqkms.getRawValue());
+        String colDesc = desc;
+        if (flys instanceof WINFOArtifact) {
+            if (wqkms != null && wqkms.getRawValue() != null) {
+                WINFOArtifact winfo = (WINFOArtifact) flys;
+                colDesc = FLYSUtils.getNamedMainValue(winfo, wqkms.getRawValue());
+            }
+        }
 
         for (int i = 0; i < size; i ++) {
             result = wqkms.get(i, result);

http://dive4elements.wald.intevation.org