From ca40eec05f7b3e6bd02014c30448af786aace969 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20D=C3=B6rre?= Date: Fri, 27 Oct 2017 00:05:16 +0200 Subject: [PATCH] fix: more spontaneous failing test cases Change-Id: I5bd3df024d647ca7793bc895f866c60aa6d9d55c --- src/club/wpia/gigi/Gigi.java | 7 ++++++- tests/club/wpia/gigi/pages/wot/TestVerification.java | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/club/wpia/gigi/Gigi.java b/src/club/wpia/gigi/Gigi.java index 19818767..6a0b7936 100644 --- a/src/club/wpia/gigi/Gigi.java +++ b/src/club/wpia/gigi/Gigi.java @@ -395,7 +395,12 @@ public final class Gigi extends HttpServlet { resp.sendError(403); return; } - if (p.beforeTemplate(req, resp)) { + try { + if (p.beforeTemplate(req, resp)) { + return; + } + } catch (CSRFException e) { + resp.sendError(500, "CSRF invalid"); return; } HashMap vars = new HashMap(); diff --git a/tests/club/wpia/gigi/pages/wot/TestVerification.java b/tests/club/wpia/gigi/pages/wot/TestVerification.java index 7a6aed4e..eaff941c 100644 --- a/tests/club/wpia/gigi/pages/wot/TestVerification.java +++ b/tests/club/wpia/gigi/pages/wot/TestVerification.java @@ -129,6 +129,7 @@ public class TestVerification extends ManagedTest { uc.getOutputStream().write(("date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10").getBytes("UTF-8")); uc.getOutputStream().flush(); assertEquals(500, uc.getResponseCode()); + uc.getErrorStream().close(); } @Test @@ -138,6 +139,7 @@ public class TestVerification extends ManagedTest { uc.getOutputStream().write(("date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10&csrf=aragc").getBytes("UTF-8")); uc.getOutputStream().flush(); assertEquals(500, uc.getResponseCode()); + uc.getErrorStream().close(); } @Test -- 2.39.2