Skip to content

Commit

Permalink
Fix Sonar issue
Browse files Browse the repository at this point in the history
  • Loading branch information
amanteaux committed Sep 17, 2024
1 parent 69d7c96 commit 46d3f4a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
6 changes: 5 additions & 1 deletion plume-web-jersey/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

<dependency>
<groupId>com.google.inject</groupId>
Expand Down Expand Up @@ -109,4 +113,4 @@
</dependencies>
</dependencyManagement>

</project>
</project>
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
package com.coreoz.plume.jersey.jee;

import java.io.IOException;
import java.io.PrintWriter;
import lombok.extern.slf4j.Slf4j;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;

@Slf4j
public class ErrorServlet extends HttpServlet {

private static final long serialVersionUID = 6186826368888103404L;

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
try(PrintWriter printWriter = resp.getWriter()) {
int errorCode = resp.getStatus();
String errorMessage = HttpStatus.getStatusText(errorCode);
printWriter.println("Error " + errorCode + " : " + errorMessage);
}
} catch (Exception e) {
logger.error("Error displaying error message for error code {}", resp.getStatus());
}
}

}

0 comments on commit 46d3f4a

Please sign in to comment.