changeset 1919:9bec7d2f8c35

Prevent ArrayIndexOutOfBounds, log method entry. flys-artifacts/trunk@3279 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 17 Nov 2011 09:14:42 +0000
parents 5afdf7ed0937
children 346044bd523d
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Nov 17 09:13:26 2011 +0000
+++ b/flys-artifacts/ChangeLog	Thu Nov 17 09:14:42 2011 +0000
@@ -1,3 +1,8 @@
+2011-11-17  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java:
+	  Prevent ArrayIndexOutOfBounds, log method entry.
+
 2011-11-17  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java	Thu Nov 17 09:13:26 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java	Thu Nov 17 09:14:42 2011 +0000
@@ -658,6 +658,7 @@
      * @return [[q0, q1, .. qx] , [w0, w1, .. wx]] (can contain NaNs)
      */
     public double [][] interpolateWQColumnwise(double km) {
+        log.debug("WstValueTable.interpolateWQColumnwise");
         double [] qs = new double[columns.length];
         double [] ws = new double[columns.length];
 
@@ -667,6 +668,8 @@
         if (rowIndex < 0) {
             rowIndex = -rowIndex -1;
         }
+        if (rowIndex >= rows.size())
+            rowIndex = rows.size() -1;
 
         Row startRow = rows.get(rowIndex);
 

http://dive4elements.wald.intevation.org