Skip to content

Commit

Permalink
sonar feedback: don't throw generic exceptions in servlets
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Jul 14, 2023
1 parent 34f4a90 commit c8a180c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
}

if (proxy == null) {
throw new IllegalStateException("unable to get event proxy");
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "unable to get event proxy");

Check notice

Code scanning / SonarCloud

Exceptions should not be thrown from servlet methods Low

Handle the following exception that could be thrown by "sendError": IOException. See more on SonarCloud
return;
}

EventBuilder bldr = new EventBuilder(EventConstants.DISCOVERYCONFIG_CHANGED_EVENT_UEI, "ActionDiscoveryServlet");
Expand Down

0 comments on commit c8a180c

Please sign in to comment.