]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8798 fix storing rule key in RuleExtensionDoc
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>
Thu, 27 Jul 2017 14:38:49 +0000 (16:38 +0200)
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>
Wed, 9 Aug 2017 13:09:54 +0000 (15:09 +0200)
server/sonar-server/src/main/java/org/sonar/server/es/BaseDoc.java
server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java
server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleExtensionDoc.java

index 2ace22b946966eec0e101024ade2a95009c26441..54499ab8364559d9f9673b7f5311195e14f63292 100644 (file)
@@ -106,10 +106,6 @@ public abstract class BaseDoc {
     fields.put(key, value);
   }
 
-  public void setField(String key, @Nullable Date value) {
-    fields.put(key, value == null ? null : dateToEpochSeconds(value));
-  }
-
   public Map<String, Object> getFields() {
     return fields;
   }
index 28494d67c94f79f36f76fe6115fe1a8a9eb24f99..75a172984e1046c8fc960809a54b5f37e4985c70 100644 (file)
@@ -403,7 +403,8 @@ public class IssueIndex {
     filters.put(IssueIndexDefinition.FIELD_ISSUE_TYPE, createTermsFilter(IssueIndexDefinition.FIELD_ISSUE_TYPE, query.types()));
     filters.put(IssueIndexDefinition.FIELD_ISSUE_RESOLUTION, createTermsFilter(IssueIndexDefinition.FIELD_ISSUE_RESOLUTION, query.resolutions()));
     filters.put(IssueIndexDefinition.FIELD_ISSUE_AUTHOR_LOGIN, createTermsFilter(IssueIndexDefinition.FIELD_ISSUE_AUTHOR_LOGIN, query.authors()));
-    filters.put(IssueIndexDefinition.FIELD_ISSUE_RULE_KEY, createTermsFilter(IssueIndexDefinition.FIELD_ISSUE_RULE_KEY, query.rules()));
+    filters.put(IssueIndexDefinition.FIELD_ISSUE_RULE_KEY, createTermsFilter(IssueIndexDefinition.FIELD_ISSUE_RULE_KEY,
+      query.rules().stream().map(String::valueOf).collect(MoreCollectors.toList(query.rules().size()))));
     filters.put(IssueIndexDefinition.FIELD_ISSUE_SEVERITY, createTermsFilter(IssueIndexDefinition.FIELD_ISSUE_SEVERITY, query.severities()));
     filters.put(IssueIndexDefinition.FIELD_ISSUE_STATUS, createTermsFilter(IssueIndexDefinition.FIELD_ISSUE_STATUS, query.statuses()));
     filters.put(IssueIndexDefinition.FIELD_ISSUE_ORGANIZATION_UUID, createTermFilter(IssueIndexDefinition.FIELD_ISSUE_ORGANIZATION_UUID, query.organizationUuid()));
index e0317b989c83c4e83a876cab26fde91fb7e31596..50f64675c0b2cafe05bc2fa7809676c1fa23bc7f 100644 (file)
@@ -54,11 +54,11 @@ public class RuleExtensionDoc extends BaseDoc {
   }
 
   public RuleKey getRuleKey() {
-    return getField(RuleIndexDefinition.FIELD_RULE_EXTENSION_RULE_KEY);
+    return RuleKey.parse(getField(RuleIndexDefinition.FIELD_RULE_EXTENSION_RULE_KEY));
   }
 
   public RuleExtensionDoc setRuleKey(RuleKey ruleKey) {
-    setField(RuleIndexDefinition.FIELD_RULE_EXTENSION_RULE_KEY, ruleKey);
+    setField(RuleIndexDefinition.FIELD_RULE_EXTENSION_RULE_KEY, String.valueOf(ruleKey));
     return this;
   }