aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src/main
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2012-01-17 19:21:43 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2012-01-18 15:28:20 +0400
commitcf0426185f6b1048e83656e9a43caebfc783058f (patch)
tree6b78604eaf4912280c1a84ff053414b1a944e47d /sonar-core/src/main
parent5edf19806b6d57c794a44c3ccda07c160b69f939 (diff)
downloadsonarqube-cf0426185f6b1048e83656e9a43caebfc783058f.tar.gz
sonarqube-cf0426185f6b1048e83656e9a43caebfc783058f.zip
SONAR-2907 Fix loading of settings from database, when used property 'sonar.branch'
Diffstat (limited to 'sonar-core/src/main')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/config/ConfigurationUtils.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/config/ConfigurationUtils.java b/sonar-core/src/main/java/org/sonar/core/config/ConfigurationUtils.java
index 71b59356fd6..91c03732bb2 100644
--- a/sonar-core/src/main/java/org/sonar/core/config/ConfigurationUtils.java
+++ b/sonar-core/src/main/java/org/sonar/core/config/ConfigurationUtils.java
@@ -22,6 +22,7 @@ package org.sonar.core.config;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.text.StrSubstitutor;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.database.configuration.Property;
@@ -84,9 +85,15 @@ public final class ConfigurationUtils {
return result;
}
- public static List<Property> getProjectProperties(DatabaseSessionFactory dbFactory, String moduleKey) {
+ public static List<Property> getProjectProperties(DatabaseSessionFactory dbFactory, String moduleKey, String branch) {
+ final String completeKey;
+ if (StringUtils.isNotBlank(branch)) {
+ completeKey = String.format("%s:%s", moduleKey, branch);
+ } else {
+ completeKey = moduleKey;
+ }
DatabaseSession session = prepareDbSession(dbFactory);
- ResourceModel resource = session.getSingleResult(ResourceModel.class, "key", moduleKey);
+ ResourceModel resource = session.getSingleResult(ResourceModel.class, "key", completeKey);
if (resource != null) {
return session
.createQuery("from " + Property.class.getSimpleName() + " p where p.resourceId=:resourceId and p.userId is null")