diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-03-16 15:00:55 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-03-16 15:00:55 +0100 |
commit | fdc46b92d29e2da8dcea5e8c2dd25dcf4dd92e5a (patch) | |
tree | 21b7677beff62adaf0e7be8185eacafb8bbd33b6 /sonar-plugin-api/src/main | |
parent | 1f14e3bcda82079f1ebd577aaca7869f732e4467 (diff) | |
download | sonarqube-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.java | 11 |
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; |