mirror of
https://github.com/SonarSource/sonarqube.git
synced 2024-09-08 13:46:05 +02:00
SONAR-1709: Set HTTP status code in StaticResourcesServlet in case of error
This commit is contained in:
parent
f854c3c8f0
commit
a6071ca39f
@ -29,6 +29,7 @@ public class StaticResourcesServlet extends HttpServlet {
|
||||
ClassLoader classLoader = pluginClassLoaders.getClassLoader(pluginKey);
|
||||
if (classLoader == null) {
|
||||
LOG.error("Plugin not found: " + pluginKey);
|
||||
response.sendError(HttpServletResponse.SC_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
InputStream in = null;
|
||||
@ -40,9 +41,11 @@ public class StaticResourcesServlet extends HttpServlet {
|
||||
IOUtils.copy(in, out);
|
||||
} else {
|
||||
LOG.error("Unable to find resource '" + resource + "' in plugin '" + pluginKey + "'");
|
||||
response.sendError(HttpServletResponse.SC_NOT_FOUND);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("Unable to load static resource '" + resource + "' from plugin '" + pluginKey + "'", e);
|
||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(in);
|
||||
IOUtils.closeQuietly(out);
|
||||
|
Loading…
Reference in New Issue
Block a user