Martin Mucha has uploaded a new change for review.

Change subject: core: fix in support for deprecating config values.
......................................................................

core: fix in support for deprecating config values.

value of deprecated ConfigKey cant be queried.

Change-Id: I83c66e24552ab498e1a21b8d957ee3ee4534972d
Signed-off-by: Martin Mucha <[email protected]>
---
M 
backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigLogic.java
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/92/34692/1

diff --git 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigLogic.java
 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigLogic.java
index cef3557..61d5d47 100644
--- 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigLogic.java
+++ 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/config/EngineConfigLogic.java
@@ -327,6 +327,7 @@
         String version = parser.getVersion();
         if (StringUtils.isBlank(version)) {
             ConfigKey configKey = getConfigKey(key);
+            testIfConfigKeyCanBeFetchedOrPrinted(configKey);
             if (configKey == null) {
                 throw new RuntimeException("Error fetching " + key
                         + " value: no such entry. Please verify key name and 
property file support.");
@@ -550,6 +551,8 @@
 
     public ConfigKey fetchConfigKey(String key, String version) {
         ConfigKey configKey = getConfigKey(key);
+        testIfConfigKeyCanBeFetchedOrPrinted(configKey);
+
         if (configKey == null || configKey.getKey() == null) {
             log.debug("Unable to fetch the value of {} in version {}", key, 
version);
             return null;
@@ -563,6 +566,12 @@
         }
     }
 
+    private void testIfConfigKeyCanBeFetchedOrPrinted(ConfigKey configKey) {
+        if (configKey.isDeprecated()) {
+            throw new IllegalAccessError("Configuration key " + 
configKey.getKey() + " is deprecated, thus cannot get its value.");
+        }
+    }
+
     public ConfigDAO getConfigDAO() {
         return configDAO;
     }


-- 
To view, visit http://gerrit.ovirt.org/34692
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I83c66e24552ab498e1a21b8d957ee3ee4534972d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Mucha <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to