[Lada-commits] [PATCH] Avoid NPE by rejecting invalid requests

Wald Commits scm-commit at wald.intevation.org
Fri Feb 12 14:22:56 CET 2016


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1455283373 -3600
# Node ID 2e264556f186fb7869a8a1c15a36c0736e5e67bd
# Parent  2e9007297e78ce52c524227c9d9023aa9918a794
Avoid NPE by rejecting invalid requests.

diff -r 2e9007297e78 -r 2e264556f186 src/main/java/de/intevation/lada/rest/StatusService.java
--- a/src/main/java/de/intevation/lada/rest/StatusService.java	Fri Feb 12 12:10:09 2016 +0100
+++ b/src/main/java/de/intevation/lada/rest/StatusService.java	Fri Feb 12 14:22:53 2016 +0100
@@ -223,6 +223,13 @@
         @Context HttpServletRequest request,
         LStatusProtokoll status
     ) {
+        if (status.getMessungsId() == null
+            || status.getErzeuger() == null
+            || status.getStatusWert() == null
+        ) {
+            return new Response(false, 631, null);
+        }
+
         UserInfo userInfo = authorization.getInfo(request);
         LMessung messung = defaultRepo.getByIdPlain(
             LMessung.class, status.getMessungsId(), "land");


More information about the Lada-commits mailing list