]> source.dussan.org Git - sonarqube.git/commitdiff
Fix some quality flaws
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 30 Jun 2014 14:04:54 +0000 (16:04 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 30 Jun 2014 14:04:54 +0000 (16:04 +0200)
sonar-plugin-api/src/main/java/org/sonar/api/database/model/ResourceModel.java
sonar-server/src/main/java/org/sonar/server/search/ESNode.java

index e40bd0254d855c28c091a10683bd7ef621da7ef1..05a03c5a48b909bef2287a81b879390abe4b3b78 100644 (file)
@@ -25,6 +25,7 @@ import org.apache.commons.lang.builder.HashCodeBuilder;
 import org.apache.commons.lang.builder.ToStringBuilder;
 import org.hibernate.annotations.BatchSize;
 import org.sonar.api.database.BaseIdentifiable;
+import org.sonar.api.resources.Language;
 import org.sonar.api.resources.ProjectLink;
 import org.sonar.api.resources.Resource;
 
@@ -384,8 +385,9 @@ public class ResourceModel extends BaseIdentifiable implements Cloneable {
     model.setDescription(resource.getDescription());
     model.setKey(resource.getEffectiveKey());
     model.setPath(resource.getPath());
-    if (resource.getLanguage() != null) {
-      model.setLanguageKey(resource.getLanguage().getKey());
+    Language lang = resource.getLanguage();
+    if (lang != null) {
+      model.setLanguageKey(lang.getKey());
     }
     if (StringUtils.isNotBlank(resource.getName())) {
       model.setName(resource.getName());
index 2abf70e2b956a496ab12b2c054f0c8877bcc26b6..0bf101085f8cfad59934c17e7eabdbe79f7898a3 100644 (file)
@@ -159,7 +159,7 @@ public class ESNode implements Startable {
   }
 
   private void addIndexTemplates() {
-    PutIndexTemplateResponse response = node.client().admin().indices()
+    node.client().admin().indices()
       .preparePutTemplate("default")
       .setTemplate("*")
       .addMapping("_default_", "{\"dynamic\": \"strict\"}")