From: Stephane Gamard Date: Fri, 12 Sep 2014 09:57:21 +0000 (+0200) Subject: SONAR-5560 - fixed getByKeys for nullables X-Git-Tag: 5.0-RC1~1015 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=679595505410fae0929a9fa5dd98e18e56190497;p=sonarqube.git SONAR-5560 - fixed getByKeys for nullables --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java b/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java index 415c43c7acf..319fa934581 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/db/BaseDao.java @@ -159,7 +159,10 @@ public abstract class BaseDao, KEY extends Serializ public List getByKeys(DbSession session, Collection keys) { List results = new ArrayList(); for (KEY key : keys) { - results.add(this.getByKey(session, key)); + DTO result = this.getNullableByKey(session, key); + if (result != null) { + results.add(result); + } } return results; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueNormalizer.java b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueNormalizer.java index 76284ca648c..4fc6977e070 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueNormalizer.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueNormalizer.java @@ -43,19 +43,20 @@ public class IssueNormalizer extends BaseNormalizer { public static final IndexField CREATED_AT = add(IndexField.Type.DATE, "createdAt"); public static final IndexField UPDATED_AT = add(IndexField.Type.DATE, "updatedAt"); - public static final IndexField DEBT = add(IndexField.Type.NUMERIC, "debt"); public static final IndexField ACTION_PLAN = add(IndexField.Type.STRING, "actionPlan"); public static final IndexField ASSIGNEE = add(IndexField.Type.STRING, "assignee"); + public static final IndexField ATTRIBUTE = add(IndexField.Type.OBJECT, "attributes"); public static final IndexField AUTHOR_LOGIN = add(IndexField.Type.STRING, "authorLogin"); + public static final IndexField COMPONENT = add(IndexField.Type.STRING, "component"); + public static final IndexField DEBT = add(IndexField.Type.NUMERIC, "debt"); + public static final IndexField EFFORT = add(IndexField.Type.NUMERIC, "effort"); public static final IndexField ISSUE_CREATED_AT = add(IndexField.Type.DATE, "issueCreatedAt"); public static final IndexField ISSUE_UPDATED_AT = add(IndexField.Type.DATE, "issueUpdatedAt"); public static final IndexField ISSUE_CLOSE_DATE = add(IndexField.Type.DATE, "issueClosedAt"); - public static final IndexField PROJECT = add(IndexField.Type.STRING, "project"); - public static final IndexField COMPONENT = add(IndexField.Type.STRING, "component"); - public static final IndexField EFFORT = add(IndexField.Type.NUMERIC, "effort"); - public static final IndexField RESOLUTION = add(IndexField.Type.STRING, "resolution"); public static final IndexField LINE = add(IndexField.Type.NUMERIC, "line"); public static final IndexField MESSAGE = add(IndexField.Type.STRING, "message"); + public static final IndexField PROJECT = add(IndexField.Type.STRING, "project"); + public static final IndexField RESOLUTION = add(IndexField.Type.STRING, "resolution"); public static final IndexField REPORTER = add(IndexField.Type.STRING, "reporter"); public static final IndexField STATUS = add(IndexField.Type.STRING, "status"); public static final IndexField SEVERITY = add(IndexField.Type.STRING, "severity"); @@ -136,5 +137,5 @@ public class IssueNormalizer extends BaseNormalizer { .parent(dto.getRootComponentKey()) .doc(update) .upsert(upsert)); - } + } }