[Lada-commits] [PATCH 2 of 5] Avoid NPEs
Wald Commits
scm-commit at wald.intevation.org
Tue Feb 2 15:33:15 CET 2016
# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1454423363 -3600
# Node ID c3a5e1ee63b8701e580a191cf6a306471f8ff419
# Parent 36b1104c3c22a57c7da399db69545fc19e2ae9b0
Avoid NPEs.
diff -r 36b1104c3c22 -r c3a5e1ee63b8 src/main/java/de/intevation/lada/query/QueryTools.java
--- a/src/main/java/de/intevation/lada/query/QueryTools.java Tue Feb 02 15:29:09 2016 +0100
+++ b/src/main/java/de/intevation/lada/query/QueryTools.java Tue Feb 02 15:29:23 2016 +0100
@@ -211,6 +211,9 @@
filters,
params,
repository.entityManager("land"));
+ if (q == null) {
+ return new ArrayList();
+ }
return prepareResult(q.getResultList(), results);
}
@@ -223,6 +226,9 @@
javax.persistence.Query query = manager.createNativeQuery(sql);
for (Filter filter: filters) {
List<String> param = params.get(filter.getDataIndex());
+ if (param == null) {
+ return null;
+ }
List<String> clean = new ArrayList<String>();
for(String p : param) {
clean.add(p.replace(",", "|"));
More information about the Lada-commits
mailing list