From: Simon Brandhof Date: Mon, 30 Jun 2014 14:04:54 +0000 (+0200) Subject: Fix some quality flaws X-Git-Tag: 4.4-RC1~87 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ef9b3e8704be8de9f30c42f9e8034588309f6e16;p=sonarqube.git Fix some quality flaws --- diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/ResourceModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/ResourceModel.java index e40bd0254d8..05a03c5a48b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/ResourceModel.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/ResourceModel.java @@ -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()); diff --git a/sonar-server/src/main/java/org/sonar/server/search/ESNode.java b/sonar-server/src/main/java/org/sonar/server/search/ESNode.java index 2abf70e2b95..0bf101085f8 100644 --- a/sonar-server/src/main/java/org/sonar/server/search/ESNode.java +++ b/sonar-server/src/main/java/org/sonar/server/search/ESNode.java @@ -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\"}")