fix: devWeb - remove some warnings

This commit is contained in:
kmitresse
2024-04-27 14:21:42 +02:00
parent bed252ed80
commit 7003f85d5f
7 changed files with 8 additions and 23 deletions
@@ -1,6 +1,5 @@
package uppa.project.bean; package uppa.project.bean;
import jakarta.servlet.http.HttpServletRequest;
import java.io.Serializable; import java.io.Serializable;
import java.util.Properties; import java.util.Properties;
import java.util.UUID; import java.util.UUID;
@@ -30,8 +29,8 @@ public class ForgottenPasswordBean implements Serializable {
public ForgottenPasswordBean() { public ForgottenPasswordBean() {
} }
public ForgottenPasswordBean(String username, String password) { public ForgottenPasswordBean(String email) {
this.email = username; this.email = email;
} }
public boolean validate(String requestPath) { public boolean validate(String requestPath) {
@@ -71,8 +70,8 @@ public class ForgottenPasswordBean implements Serializable {
/** /**
* Envoi d'un e-mail de réinitialisation de mot de passe * Envoi d'un e-mail de réinitialisation de mot de passe
* *
* @param email * @param email l'adresse e-mail du destinataire
* @param token * @param token le token de réinitialisation
*/ */
public void sendRecoveryEmail(String email, String token, String requestPath){ public void sendRecoveryEmail(String email, String token, String requestPath){
String host = Global.MAIL_HOST; String host = Global.MAIL_HOST;
@@ -51,7 +51,7 @@ public class ProfileBean {
return false; return false;
} }
//Check if the oldPassword is correct //Check if the oldPassword is correct
if(!oldPassword.equals("") && !user.verifyPassword(oldPassword)) { if(!oldPassword.isEmpty() && !user.verifyPassword(oldPassword)) {
error = new HttpResponse(HttpResponseCode.UNAUTHORIZED, "Ancien mot de passe incorrect"); error = new HttpResponse(HttpResponseCode.UNAUTHORIZED, "Ancien mot de passe incorrect");
entityManager.getTransaction().rollback(); entityManager.getTransaction().rollback();
return false; return false;
@@ -63,7 +63,7 @@ public class ProfileBean {
} }
//Update the user //Update the user
user.setEmail(email); user.setEmail(email);
if (!password.equals("")) { if (!password.isEmpty()) {
user.setPassword(password); user.setPassword(password);
} }
user.setGender(User.Gender.valueOf(gender)); user.setGender(User.Gender.valueOf(gender));
@@ -26,7 +26,7 @@ public class GameStatistics extends HttpServlet {
request.setAttribute("game", game); request.setAttribute("game", game);
request.getRequestDispatcher("/WEB-INF/pages/game-statistics.jsp").forward(request, response); request.getRequestDispatcher("/WEB-INF/pages/game-statistics.jsp").forward(request, response);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); request.getRequestDispatcher("/WEB-INF/pages/profile.jsp").forward(request, response);
} } ;
} }
} }
@@ -14,13 +14,7 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import uppa.project.bean.ProfileBean; import uppa.project.bean.ProfileBean;
import uppa.project.bean.RegisterBean;
import uppa.project.database.pojo.Game;
import uppa.project.database.pojo.Player;
import uppa.project.database.pojo.User;
import uppa.project.json.HttpResponse; import uppa.project.json.HttpResponse;
import uppa.project.json.HttpResponseCode; import uppa.project.json.HttpResponseCode;
@@ -1,4 +1,3 @@
<%@ page import="java.util.List" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="layout" tagdir="/WEB-INF/tags/layouts" %> <%@taglib prefix="layout" tagdir="/WEB-INF/tags/layouts" %>
@@ -1,10 +1,4 @@
<%@ page import="uppa.project.database.pojo.Player" %>
<%@ page import="uppa.project.database.pojo.Game" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%--<%@ taglib uri = "https://mvnrepository.com/artifact/jakarta.servlet.jsp.jstl/jakarta.servlet.jsp.jstl-api" prefix = "c" %>--%>
<%@taglib prefix="layout" tagdir="/WEB-INF/tags/layouts" %> <%@taglib prefix="layout" tagdir="/WEB-INF/tags/layouts" %>
<%@taglib prefix="component" tagdir="/WEB-INF/tags/components" %> <%@taglib prefix="component" tagdir="/WEB-INF/tags/components" %>
@@ -1,5 +1,4 @@
<%@ tag import="uppa.project.database.pojo.Player" %> <%@ tag import="uppa.project.database.pojo.Player" %>
<%@ tag import="java.util.Calendar" %>
<%@ tag import="uppa.project.database.pojo.Game" %> <%@ tag import="uppa.project.database.pojo.Game" %>
<%@tag description="component/statistics" pageEncoding="UTF-8" %> <%@tag description="component/statistics" pageEncoding="UTF-8" %>
<jsp:useBean id="game" class="uppa.project.database.pojo.Game" scope="request"/> <jsp:useBean id="game" class="uppa.project.database.pojo.Game" scope="request"/>