diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-05-21 14:34:28 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-05-21 14:34:28 +0200 |
commit | 2801f02b86920a00d51e8d94e8c196f637e5ac14 (patch) | |
tree | fb970099960c2c04d3ebcefd426ffb90dcc07d34 /sonar-core | |
parent | 2c2728075a1c142965bf6c018ba94919955f80d8 (diff) | |
download | sonarqube-2801f02b86920a00d51e8d94e8c196f637e5ac14.tar.gz sonarqube-2801f02b86920a00d51e8d94e8c196f637e5ac14.zip |
SONAR-4301 Fix issue when sort and asc are null
Diffstat (limited to 'sonar-core')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/issue/db/IssueDao.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDao.java b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDao.java index 2fa1dba1ed1..fe8ba6b950e 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDao.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDao.java @@ -21,7 +21,6 @@ package org.sonar.core.issue.db; import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import org.apache.ibatis.session.SqlSession; import org.sonar.api.BatchComponent; @@ -37,6 +36,7 @@ import java.util.List; import java.util.Map; import static com.google.common.collect.Lists.newArrayList; +import static com.google.common.collect.Maps.newHashMap; /** * @since 3.6 @@ -99,7 +99,7 @@ public class IssueDao implements BatchComponent, ServerComponent { } @VisibleForTesting - Collection<IssueDto> selectByIds(Collection<Long> ids, IssueQuery.Sort sort, boolean asc) { + Collection<IssueDto> selectByIds(Collection<Long> ids, IssueQuery.Sort sort, Boolean asc) { SqlSession session = mybatis.openSession(); try { return selectByIds(ids, sort, asc, session); @@ -108,12 +108,15 @@ public class IssueDao implements BatchComponent, ServerComponent { } } - public Collection<IssueDto> selectByIds(Collection<Long> ids, IssueQuery.Sort sort, boolean asc, SqlSession session) { + public Collection<IssueDto> selectByIds(Collection<Long> ids, IssueQuery.Sort sort, Boolean asc, SqlSession session) { if (ids.isEmpty()) { return Collections.emptyList(); } Object idsPartition = Lists.partition(newArrayList(ids), 1000); - Map<String, Object> params = ImmutableMap.of("ids", idsPartition, "sort", sort, "asc", asc); + Map<String, Object> params = newHashMap(); + params.put("ids", idsPartition); + params.put("sort", sort); + params.put("asc", asc); return session.selectList("org.sonar.core.issue.db.IssueMapper.selectByIds", params); } } |