Mercurial > lada > lada-server
changeset 664:0002475bc23d
Fixed Index out of Bounds exception in validation.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 13 May 2015 13:57:23 +0200 |
parents | f80f8ce38446 |
children | 3b1755df4f33 |
files | src/main/java/de/intevation/lada/validation/rules/probe/Deskriptor.java src/main/java/de/intevation/lada/validation/rules/probe/DeskriptorToUmwelt.java |
diffstat | 2 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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;