| 1 | package control.ordine; | |
| 2 | ||
| 3 | import model.utente.UtenteBean; | |
| 4 | import model.utente.UtenteDAO; | |
| 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 | import java.time.LocalDate; | |
| 14 | import java.time.format.DateTimeFormatter; | |
| 15 | ||
| 16 | @WebServlet("/ModificaPagamento") | |
| 17 | public class ModificaPagamento extends HttpServlet { | |
| 18 | @Override | |
| 19 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { | |
| 20 | UtenteBean utenteBean = (UtenteBean) req.getSession().getAttribute("utente"); | |
| 21 | ||
| 22 | String nomeCarta = req.getParameter("nomeCartaNuova"); | |
| 23 | String cognomeCarta = req.getParameter("cognomeCartaNuova"); | |
| 24 | String numeroCarta = req.getParameter("numCartaNuova"); | |
| 25 | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | |
| 26 | LocalDate dataScadenza = LocalDate.parse(req.getParameter("dataScadNuova"), formatter); | |
| 27 | String cvv = req.getParameter("CVVNuovo"); | |
| 28 | ||
| 29 |
1
1. doPost : removed call to model/utente/UtenteBean::setNomeCarta → KILLED |
utenteBean.setNomeCarta(nomeCarta); |
| 30 |
1
1. doPost : removed call to model/utente/UtenteBean::setCognomeCarta → KILLED |
utenteBean.setCognomeCarta(cognomeCarta); |
| 31 |
1
1. doPost : removed call to model/utente/UtenteBean::setNumCarta → KILLED |
utenteBean.setNumCarta(numeroCarta); |
| 32 |
1
1. doPost : removed call to model/utente/UtenteBean::setDataScadenza → KILLED |
utenteBean.setDataScadenza(dataScadenza); |
| 33 |
1
1. doPost : removed call to model/utente/UtenteBean::setCVV → KILLED |
utenteBean.setCVV(cvv); |
| 34 | ||
| 35 | UtenteDAO utenteDAO = new UtenteDAO(); | |
| 36 | try { | |
| 37 |
1
1. doPost : removed call to model/utente/UtenteDAO::doUpdate → KILLED |
utenteDAO.doUpdate(utenteBean); |
| 38 | } catch (SQLException e) { | |
| 39 |
1
1. doPost : removed call to javax/servlet/RequestDispatcher::forward → KILLED |
req.getRequestDispatcher("/pages/errorpage.jsp").forward(req, resp); |
| 40 | return; | |
| 41 | } | |
| 42 | ||
| 43 |
1
1. doPost : negated conditional → KILLED |
if (req.getParameter("modificaPagamento").equals("profilo")) |
| 44 |
1
1. doPost : removed call to javax/servlet/http/HttpServletResponse::sendRedirect → KILLED |
resp.sendRedirect("StoricoOrdini"); |
| 45 |
1
1. doPost : negated conditional → KILLED |
else if (req.getParameter("modificaPagamento").equals("checkout")) |
| 46 |
1
1. doPost : removed call to javax/servlet/http/HttpServletResponse::sendRedirect → KILLED |
resp.sendRedirect("pages/checkout.jsp"); |
| 47 | } | |
| 48 | ||
| 49 | @Override | |
| 50 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { | |
| 51 |
1
1. doGet : removed call to control/ordine/ModificaPagamento::doPost → KILLED |
doPost(req,resp); |
| 52 | } | |
| 53 | } | |
Mutations | ||
| 29 |
1.1 |
|
| 30 |
1.1 |
|
| 31 |
1.1 |
|
| 32 |
1.1 |
|
| 33 |
1.1 |
|
| 37 |
1.1 |
|
| 39 |
1.1 |
|
| 43 |
1.1 |
|
| 44 |
1.1 |
|
| 45 |
1.1 |
|
| 46 |
1.1 |
|
| 51 |
1.1 |