aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/main
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-03-16 15:00:55 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-03-16 15:00:55 +0100
commitfdc46b92d29e2da8dcea5e8c2dd25dcf4dd92e5a (patch)
tree21b7677beff62adaf0e7be8185eacafb8bbd33b6 /sonar-plugin-api/src/main
parent1f14e3bcda82079f1ebd577aaca7869f732e4467 (diff)
downloadsonarqube-fdc46b92d29e2da8dcea5e8c2dd25dcf4dd92e5a.tar.gz
sonarqube-fdc46b92d29e2da8dcea5e8c2dd25dcf4dd92e5a.zip
SONAR-1378 auto-detect password properties that are suffixed by .password.secured
Diffstat (limited to 'sonar-plugin-api/src/main')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java
index ef98057d6b5..2adfb8232e7 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java
@@ -75,10 +75,19 @@ public final class PropertyDefinition {
this.onProject = annotation.project();
this.onModule = annotation.module();
this.category = annotation.category();
- this.type = annotation.type();
+ this.type = fixType(annotation.key(), annotation.type());
this.options = annotation.options();
}
+ private PropertyType fixType(String key, PropertyType type) {
+ // Auto-detect passwords for old versions of plugins that
+ // do not declare the type
+ if (type==PropertyType.STRING && StringUtils.endsWith(key, ".password.secured")) {
+ return PropertyType.PASSWORD;
+ }
+ return type;
+ }
+
@VisibleForTesting
PropertyDefinition(PropertyType type, String[] options) {
this.type = type;