[Lada-commits] [PATCH 2 of 4] Fixed Index out of Bounds exception in validation

Wald Commits scm-commit at wald.intevation.org
Wed May 13 13:58:03 CEST 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1431518243 -7200
# Node ID 0002475bc23df8e0540c9936dc957b0b3bc7da32
# Parent  f80f8ce38446f4065b0e03643cd5c726a5e9a02c
Fixed Index out of Bounds exception in validation.

diff -r f80f8ce38446 -r 0002475bc23d src/main/java/de/intevation/lada/validation/rules/probe/Deskriptor.java
--- a/src/main/java/de/intevation/lada/validation/rules/probe/Deskriptor.java	Wed May 13 13:56:29 2015 +0200
+++ b/src/main/java/de/intevation/lada/validation/rules/probe/Deskriptor.java	Wed May 13 13:57:23 2015 +0200
@@ -26,6 +26,11 @@
     public Violation execute(Object object) {
         LProbe probe = (LProbe)object;
         String[] mediaDesk = probe.getMediaDesk().split(" ");
+        if (mediaDesk.length <= 1) {
+            Violation violation = new Violation();
+            violation.addWarning("mediaDesk", 631);
+            return violation;
+        }
         boolean zebs = false;
         Integer parent = null;
         Integer hdParent = null;
diff -r f80f8ce38446 -r 0002475bc23d src/main/java/de/intevation/lada/validation/rules/probe/DeskriptorToUmwelt.java
--- a/src/main/java/de/intevation/lada/validation/rules/probe/DeskriptorToUmwelt.java	Wed May 13 13:56:29 2015 +0200
+++ b/src/main/java/de/intevation/lada/validation/rules/probe/DeskriptorToUmwelt.java	Wed May 13 13:57:23 2015 +0200
@@ -28,6 +28,9 @@
     public Violation execute(Object object) {
         LProbe probe = (LProbe)object;
         String[] mediaDesk = probe.getMediaDesk().split(" ");
+        if (mediaDesk.length <= 1) {
+            return null;
+        }
         List<Integer> mediaIds = new ArrayList<Integer>();
         boolean zebs = false;
         Integer parent = null;


More information about the Lada-commits mailing list