]> source.dussan.org Git - sonarqube.git/commitdiff
Fix quality flaws and improve unit test
authorJulien HENRY <julien.henry@sonarsource.com>
Thu, 5 Sep 2013 07:36:23 +0000 (09:36 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Thu, 5 Sep 2013 07:36:23 +0000 (09:36 +0200)
sonar-core/src/main/java/org/sonar/core/dryrun/DryRunCache.java
sonar-plugin-api/src/test/java/org/sonar/api/utils/HttpDownloaderTest.java
sonar-server/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb

index 2916fcb3e49273509a0c5e7d20548bdfad3db5d5..b4b7ffedb8c8082f2a715ec0c915bf38f477f68d 100644 (file)
@@ -98,6 +98,9 @@ public class DryRunCache implements ServerExtension {
 
   public void reportResourceModification(String resourceKey) {
     ResourceDto rootProject = resourceDao.getRootProjectByComponentKey(resourceKey);
+    if (rootProject == null) {
+      throw new SonarException("Unable to find root project for component with [key=" + resourceKey + "]");
+    }
     propertiesDao.setProperty(new PropertyDto().setKey(SONAR_DRY_RUN_CACHE_LAST_UPDATE_KEY).setResourceId(rootProject.getId())
       .setValue(String.valueOf(System.nanoTime())));
   }
index 71c7712c1a47a2224305beda18a1e71265f2d61f..3c2bebffa8176ea41154f08dab446cb9a39d93b6 100644 (file)
@@ -83,6 +83,9 @@ public class HttpDownloaderTest {
               }
             }
             if (req.getPath().getPath().contains("/gzip/")) {
+              if (!"gzip".equals(req.getValue("Accept-Encoding"))) {
+                throw new IllegalStateException("Should accept gzip");
+              }
               resp.set("Content-Encoding", "gzip");
               GZIPOutputStream gzipOutputStream = new GZIPOutputStream(resp.getOutputStream());
               gzipOutputStream.write("GZIP response".getBytes());
@@ -93,6 +96,7 @@ public class HttpDownloaderTest {
             }
           }
         } catch (IOException e) {
+          throw new IllegalStateException(e);
         } finally {
           try {
             resp.close();
index 0acce90f0368dcceb2c8fae4eadd4f40eb85525b..bdc60dc42976ab1c6675813e4c983ed3cc72610c 100644 (file)
@@ -15,7 +15,7 @@
 </div>
 <table class="data width100" id="permission-templates">
   <thead>
-  <tr>
+  <tr valign="top">
     <th class="left" width="20%"><%= message('name') -%></th>
     <th class="left">
       <%= message('projects_role.admin') -%><br/>