Mercurial > lada > lada-server
changeset 400:deafba50e931
Avoid NPE in "orts typ" while validating.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 08 Jan 2014 15:04:17 +0100 (2014-01-08) |
parents | 6a5b506f4559 |
children | 857341d9c879 |
files | src/main/java/de/intevation/lada/validation/LOrtValidator.java |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/validation/LOrtValidator.java Wed Jan 08 15:03:08 2014 +0100 +++ b/src/main/java/de/intevation/lada/validation/LOrtValidator.java Wed Jan 08 15:04:17 2014 +0100 @@ -71,7 +71,7 @@ * @param warnings */ private void validateVerwaltungseinheit(LOrt ort, Map<String, Integer> warnings) { - if (!ort.getOrtsTyp().equals("E")) { + if (!"E".equals(ort.getOrtsTyp())) { return; } QueryBuilder<Ort> ortBuilder = @@ -84,6 +84,10 @@ readonlyRepo.getEntityManager(), SVerwaltungseinheit.class); veBuilder.and("gemId", orte.get(0).getGemId()); Response ver = readonlyRepo.filter(veBuilder.getQuery()); + if (((List<SVerwaltungseinheit>)ver.getData()).isEmpty()) { + warnings.put("verwaltungseinheit", 653); + return; + } SVerwaltungseinheit ve = ((List<SVerwaltungseinheit>)ver.getData()).get(0); QueryBuilder<DeVg> vg = new QueryBuilder<DeVg>(readonlyRepo.getEntityManager(), DeVg.class);