From ef9b3e8704be8de9f30c42f9e8034588309f6e16 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 30 Jun 2014 16:04:54 +0200 Subject: [PATCH] Fix some quality flaws --- .../java/org/sonar/api/database/model/ResourceModel.java | 6 ++++-- .../src/main/java/org/sonar/server/search/ESNode.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) 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\"}") -- 2.39.5