]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-1709: Set HTTP status code in StaticResourcesServlet in case of error
authorGodin <mandrikov@gmail.com>
Mon, 27 Sep 2010 13:37:01 +0000 (13:37 +0000)
committerGodin <mandrikov@gmail.com>
Mon, 27 Sep 2010 13:37:01 +0000 (13:37 +0000)
sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java

index 5b5366a51c2d1711677915f740976f69845324ac..c86cc6b64f944f7997cac63e8b42bd7f1742499a 100644 (file)
@@ -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);