From 533766d1cf443450a708c8cd1418921c9246f354 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Thu, 3 Apr 2014 17:58:09 +0200 Subject: [PATCH] SONAR-5196 Quality profile names should be case sensitive --- .../core/qualityprofile/db/QualityProfileDao.java | 15 ++++++--------- .../qualityprofile/db/QualityProfileMapper.xml | 6 +++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java index 24f0bca7cc6..be550fdc706 100644 --- a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java +++ b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java @@ -20,7 +20,6 @@ package org.sonar.core.qualityprofile.db; -import org.apache.commons.lang.StringUtils; import org.apache.ibatis.session.SqlSession; import org.sonar.api.ServerComponent; import org.sonar.core.component.ComponentDto; @@ -102,7 +101,6 @@ public class QualityProfileDao implements ServerComponent { } } - public QualityProfileDto selectByProjectAndLanguage(long projectId, String language, String key) { SqlSession session = mybatis.openSession(); try { @@ -152,40 +150,39 @@ public class QualityProfileDao implements ServerComponent { } public List selectChildren(String name, String language, SqlSession session) { - return session.getMapper(QualityProfileMapper.class).selectChildren(StringUtils.upperCase(name), language); + return session.getMapper(QualityProfileMapper.class).selectChildren(name, language); } public List selectChildren(String name, String language) { SqlSession session = mybatis.openSession(); try { - return selectChildren(StringUtils.upperCase(name), language, session); + return selectChildren(name, language, session); } finally { MyBatis.closeQuietly(session); } } public int countChildren(String name, String language, SqlSession session) { - return session.getMapper(QualityProfileMapper.class).countChildren(StringUtils.upperCase(name), language); + return session.getMapper(QualityProfileMapper.class).countChildren(name, language); } public int countChildren(String name, String language) { SqlSession session = mybatis.openSession(); try { - return countChildren(StringUtils.upperCase(name), language, session); + return countChildren(name, language, session); } finally { MyBatis.closeQuietly(session); } } public QualityProfileDto selectByNameAndLanguage(String name, String language, SqlSession session) { - return session.getMapper(QualityProfileMapper.class).selectByNameAndLanguage(StringUtils.upperCase(name), language); + return session.getMapper(QualityProfileMapper.class).selectByNameAndLanguage(name, language); } - public QualityProfileDto selectByNameAndLanguage(String name, String language) { SqlSession session = mybatis.openSession(); try { - return selectByNameAndLanguage(StringUtils.upperCase(name), language, session); + return selectByNameAndLanguage(name, language, session); } finally { MyBatis.closeQuietly(session); } diff --git a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml index 78eff7dd4e2..a764f207187 100644 --- a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml @@ -41,7 +41,7 @@ SELECT FROM rules_profiles p - AND UPPER(p.name)=#{name} + AND p.name=#{name} AND p.language=#{language} @@ -73,7 +73,7 @@ SELECT FROM rules_profiles p - AND UPPER(p.parent_name)=#{name} + AND p.parent_name=#{name} AND p.language=#{language} ORDER BY p.name @@ -83,7 +83,7 @@ SELECT count(p.id) FROM rules_profiles p - AND UPPER(p.parent_name)=#{name} + AND p.parent_name=#{name} AND p.language=#{language} -- 2.39.5