From cd81e15f62e23e02b7a1a35c9a3e26ce16fd3926 Mon Sep 17 00:00:00 2001 From: Stephane Gamard Date: Fri, 16 May 2014 10:42:29 +0200 Subject: [PATCH] SONAR-5061 - Updated pom and code update for ES v.1.1.1 --- pom.xml | 2 +- .../src/main/java/org/sonar/server/es/ESIndex.java | 8 ++------ .../src/main/java/org/sonar/server/rule/RuleRegistry.java | 6 +----- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 9e353f96413..b8b20937906 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ 1.0.13 1.7.5 7.0.42 - 0.90.9 + 1.1.1 UTF-8 3.0.5 2.2.0 diff --git a/sonar-server/src/main/java/org/sonar/server/es/ESIndex.java b/sonar-server/src/main/java/org/sonar/server/es/ESIndex.java index 41e510dbd24..da51fbe5393 100644 --- a/sonar-server/src/main/java/org/sonar/server/es/ESIndex.java +++ b/sonar-server/src/main/java/org/sonar/server/es/ESIndex.java @@ -21,7 +21,6 @@ package org.sonar.server.es; import com.google.common.collect.Lists; import org.apache.commons.io.IOUtils; -import org.elasticsearch.ElasticSearchParseException; import org.elasticsearch.action.bulk.BulkItemResponse; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; @@ -170,13 +169,10 @@ public class ESIndex implements Startable { } watch = createWatch(); - try { indices.putMapping(Requests.putMappingRequest(index).type(type).source(mapping)).actionGet(); - } catch (ElasticSearchParseException parseException) { - throw new IllegalArgumentException("Invalid mapping file", parseException); - } finally { + watch.stop("put mapping on index '%s' for type '%s'", index, type); - } + } public List findDocumentIds(SearchQuery searchQuery) { diff --git a/sonar-server/src/main/java/org/sonar/server/rule/RuleRegistry.java b/sonar-server/src/main/java/org/sonar/server/rule/RuleRegistry.java index b80114ca374..c5ee7c774b3 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule/RuleRegistry.java +++ b/sonar-server/src/main/java/org/sonar/server/rule/RuleRegistry.java @@ -26,7 +26,6 @@ import com.google.common.collect.ImmutableList.Builder; import com.google.common.collect.Multimap; import org.apache.commons.lang.StringUtils; import org.apache.ibatis.session.SqlSession; -import org.elasticsearch.ElasticSearchException; import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; @@ -311,15 +310,12 @@ public class RuleRegistry { searchQuery.field(param.getKey(), param.getValue().split("\\|")); } - try { List result = newArrayList(); for (String docId : searchIndex.findDocumentIds(searchQuery)) { result.add(Integer.parseInt(docId)); } return result; - } catch (ElasticSearchException searchException) { - throw new IllegalArgumentException("Unable to perform search, please check query", searchException); - } + } public PagedResult find(RuleQuery query) { -- 2.39.5