diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsColumnFactory.java @ 2620:cc0fa1798a3c

FixingsKMChartService: Generate chart and deliver the image as the response of the service. flys-artifacts/trunk@4205 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 05 Apr 2012 18:07:47 +0000
parents 6ed24efc80de
children 8bc1e1cb7f7b
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsColumnFactory.java	Thu Apr 05 15:29:52 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsColumnFactory.java	Thu Apr 05 18:07:47 2012 +0000
@@ -53,8 +53,9 @@
                 return (FixingsColumn)element.getValue();
             }
 
-            result = getUncached(column);
-            cache.put(new Element(cacheKey, result));
+            if ((result = getUncached(column)) != null) {
+                cache.put(new Element(cacheKey, result));
+            }
         }
         else {
             result = getUncached(column);
@@ -74,6 +75,10 @@
 
         List<Object []> results = sqlQuery.list();
 
+        if (results.isEmpty()) {
+            return null;
+        }
+
         double [] kms = new double[results.size()];
         double [] ws  = new double[kms.length];
 
@@ -92,6 +97,10 @@
 
         results = sqlQuery.list();
 
+        if (results.isEmpty()) {
+            return null;
+        }
+
         QRangeTree qs = new QRangeTree(
             results, QRangeTree.WITHOUT_COLUMN, 0, results.size());
 

http://dive4elements.wald.intevation.org