diff flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java @ 556:046f43e1d305

Avoid NPE while parsing axes in ChartInfoService. flys-client/trunk@2080 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 08 Jun 2011 12:43:38 +0000
parents c5fc3fa02edb
children 460b8e0f0563
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java	Wed Jun 08 10:57:28 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java	Wed Jun 08 12:43:38 2011 +0000
@@ -78,7 +78,10 @@
             return parseInfoDocument(info);
         }
         catch (IOException ioe) {
-            // do nothing
+            ioe.printStackTrace();
+        }
+        catch (Exception e) {
+            e.printStackTrace();
         }
 
         System.err.println("Error while fetching chart info.");
@@ -152,6 +155,12 @@
                 double from = Double.parseDouble(fromStr);
                 double to   = Double.parseDouble(toStr);
 
+                if (pos >= result.length) {
+                    // this should never happen
+                    System.err.println("The axis is out of valid range: " + pos);
+                    continue;
+                }
+
                 result[pos] = new Axis(pos, from, to);
             }
             catch (NumberFormatException nfe) {

http://dive4elements.wald.intevation.org