changeset 397:ae8fa86e6503

Fixed a potential NullPointerException while creating a longitudinal section chart. flys-artifacts/trunk@1827 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 05 May 2011 04:52:47 +0000
parents 5d0e973f203e
children 435058da0eae
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java
diffstat 2 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed May 04 17:01:22 2011 +0000
+++ b/flys-artifacts/ChangeLog	Thu May 05 04:52:47 2011 +0000
@@ -1,3 +1,9 @@
+2011-05-05  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java:
+	  Fixed a potential NullPointerException if there is just a single
+	  kilometer given to create a longitudinal section.
+
 2011-05-04	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* pom.xml: Added http://repository.jboss.org/maven2 repo
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Wed May 04 17:01:22 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Thu May 05 04:52:47 2011 +0000
@@ -138,17 +138,17 @@
             int      size   = tmp.size();
 
             if (logger.isDebugEnabled()) {
-                logger.debug("Generate series: " + series.getKey());
-
-                logger.debug("Start km: " + tmp.getKms(0));
-                logger.debug("End   km: " + tmp.getKms(size-1));
-                logger.debug("Values  : " + size);
+                if (tmp.size() > 0) {
+                    logger.debug("Generate series: " + series.getKey());
+                    logger.debug("Start km: " + tmp.getKms(0));
+                    logger.debug("End   km: " + tmp.getKms(size-1));
+                    logger.debug("Values  : " + size);
+                }
             }
 
             for (int i = 0; i < size; i++) {
                 target = tmp.get(i, target);
 
-                //logger.debug("++ W Tuple: " + target[2] + " -> " + target[0]);
                 series.add(target[2], target[0]);
             }
 
@@ -173,11 +173,12 @@
             int      size   = tmp.size();
 
             if (logger.isDebugEnabled()) {
-                logger.debug("Generate series: " + series.getKey());
-
-                logger.debug("Start km: " + tmp.getKms(0));
-                logger.debug("End   km: " + tmp.getKms(size-1));
-                logger.debug("Values  : " + size);
+                if (tmp.size() > 0) {
+                    logger.debug("Generate series: " + series.getKey());
+                    logger.debug("Start km: " + tmp.getKms(0));
+                    logger.debug("End   km: " + tmp.getKms(size-1));
+                    logger.debug("Values  : " + size);
+                }
             }
 
             for (int i = 0; i < size; i++) {

http://dive4elements.wald.intevation.org