| 1 | package control; | |
| 2 | ||
| 3 | import control.utente.Login; | |
| 4 | import model.maglietta.MagliettaDAO; | |
| 5 | ||
| 6 | import javax.servlet.ServletException; | |
| 7 | import javax.servlet.annotation.WebServlet; | |
| 8 | import javax.servlet.http.HttpServlet; | |
| 9 | import javax.servlet.http.HttpServletRequest; | |
| 10 | import javax.servlet.http.HttpServletResponse; | |
| 11 | import java.io.IOException; | |
| 12 | import java.sql.SQLException; | |
| 13 | ||
| 14 | @WebServlet("/Catalogo") | |
| 15 | public class Catalogo extends HttpServlet { | |
| 16 | @Override | |
| 17 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) | |
| 18 | throws ServletException, IOException { | |
| 19 | ||
| 20 | MagliettaDAO magliettaDAO = new MagliettaDAO(); | |
| 21 | String targetJsp; | |
| 22 | ||
| 23 | try { | |
| 24 |
1
1. doGet : removed call to javax/servlet/http/HttpServletRequest::setAttribute → KILLED |
req.setAttribute( |
| 25 | "magliette", | |
| 26 | magliettaDAO.doRetriveAll(req.getParameter("ordine")) | |
| 27 | ); | |
| 28 | ||
| 29 | Integer tipoUtente = | |
| 30 | (Integer) req.getSession().getAttribute("tipoUtente"); | |
| 31 | ||
| 32 |
2
1. doGet : negated conditional → KILLED 2. doGet : negated conditional → KILLED |
if (tipoUtente != null && tipoUtente.equals(Login.ADMIN)) { |
| 33 | targetJsp = "/catalogoAdmin.jsp"; | |
| 34 | } else { | |
| 35 | targetJsp = "/catalogo.jsp"; | |
| 36 | } | |
| 37 | ||
| 38 | } catch (SQLException e) { | |
| 39 | targetJsp = "/pages/errorpage.jsp"; | |
| 40 | } | |
| 41 | ||
| 42 | try { | |
| 43 |
1
1. doGet : removed call to javax/servlet/RequestDispatcher::forward → KILLED |
req.getRequestDispatcher(targetJsp).forward(req, resp); |
| 44 | } catch (ServletException | IOException e) { | |
| 45 |
1
1. doGet : removed call to javax/servlet/RequestDispatcher::forward → KILLED |
req.getRequestDispatcher("/pages/errorpage.jsp").forward(req, resp); |
| 46 | } | |
| 47 | } | |
| 48 | ||
| 49 | @Override | |
| 50 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) | |
| 51 | throws ServletException, IOException { | |
| 52 |
1
1. doPost : removed call to control/Catalogo::doGet → KILLED |
doGet(req, resp); |
| 53 | } | |
| 54 | } | |
Mutations | ||
| 24 |
1.1 |
|
| 32 |
1.1 2.2 |
|
| 43 |
1.1 |
|
| 45 |
1.1 |
|
| 52 |
1.1 |