From 920e15d20d9d25a5f6042871a3639ddbf8b90194 Mon Sep 17 00:00:00 2001 From: Myriam Leggieri Date: Mon, 15 Jun 2015 11:11:58 +0100 Subject: [PATCH] Update BenchmarkTest00001.java There is no need for the flag variable "foundit". since the variable param can be initialised to the defalut value for "cookies not found" at declaration time, whenever the if condition is not met, it will not be changed. --- .../benchmark/testcode/BenchmarkTest00001.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/owasp/webgoat/benchmark/testcode/BenchmarkTest00001.java b/src/main/java/org/owasp/webgoat/benchmark/testcode/BenchmarkTest00001.java index 59f556f48e..5ece840bbf 100644 --- a/src/main/java/org/owasp/webgoat/benchmark/testcode/BenchmarkTest00001.java +++ b/src/main/java/org/owasp/webgoat/benchmark/testcode/BenchmarkTest00001.java @@ -42,19 +42,14 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr javax.servlet.http.Cookie[] cookies = request.getCookies(); - String param = null; - boolean foundit = false; + // no cookies found. + String param = ""; if (cookies != null) { for (javax.servlet.http.Cookie cookie : cookies) { if (cookie.getName().equals("foo")) { - param = cookie.getValue(); - foundit = true; + param = cookie.getValue(); // cookie found. } } - if (!foundit) { - // no cookie found in collection - param = ""; - } } else { // no cookies param = "";