You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by eo...@apache.org on 2017/08/23 13:07:40 UTC
[bookkeeper] branch master updated: ISSUE #459: fix loadConf in
AbstractConfiguration
This is an automated email from the ASF dual-hosted git repository.
eolivelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new f4a9a53 ISSUE #459: fix loadConf in AbstractConfiguration
f4a9a53 is described below
commit f4a9a53ce725f8c495e100430a05dc13942d0837
Author: Jia Zhai <zh...@apache.org>
AuthorDate: Wed Aug 23 15:07:26 2017 +0200
ISSUE #459: fix loadConf in AbstractConfiguration
Descriptions of the changes in this PR:
In loadConf, call setProperty for all k-v in baseConf.
Please reference #459 for more anlysis and details.
Author: Jia Zhai <zh...@apache.org>
Reviewers: Enrico Olivelli <eo...@gmail.com>, Sijie Guo <si...@apache.org>
This closes #460 from zhaijack/issue_459, closes #459
---
.../bookkeeper/conf/AbstractConfiguration.java | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java
index 7b89bb0..1858c67 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java
@@ -17,20 +17,18 @@
*/
package org.apache.bookkeeper.conf;
+import static org.apache.bookkeeper.conf.ClientConfiguration.CLIENT_AUTH_PROVIDER_FACTORY_CLASS;
+
import java.net.URL;
+import java.util.Iterator;
import javax.net.ssl.SSLEngine;
-
import org.apache.bookkeeper.feature.Feature;
import org.apache.bookkeeper.meta.LedgerManagerFactory;
import org.apache.bookkeeper.util.ReflectionUtils;
-import static org.apache.bookkeeper.conf.ClientConfiguration.CLIENT_AUTH_PROVIDER_FACTORY_CLASS;
-
import org.apache.commons.configuration.CompositeConfiguration;
-import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration.SystemConfiguration;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -116,9 +114,13 @@ public abstract class AbstractConfiguration extends CompositeConfiguration {
* @param confURL
* Configuration URL
*/
+ @SuppressWarnings("unchecked")
public void loadConf(URL confURL) throws ConfigurationException {
PropertiesConfiguration loadedConf = new PropertiesConfiguration(confURL);
- addConfiguration((Configuration)loadedConf.clone());
+ for (Iterator<String> iter = loadedConf.getKeys(); iter.hasNext(); ) {
+ String key = iter.next();
+ setProperty(key, loadedConf.getProperty(key));
+ }
}
/**
@@ -127,8 +129,12 @@ public abstract class AbstractConfiguration extends CompositeConfiguration {
* @param baseConf
* Other Configuration
*/
+ @SuppressWarnings("unchecked")
public void loadConf(CompositeConfiguration baseConf) {
- addConfiguration((CompositeConfiguration)baseConf.clone());
+ for (Iterator<String> iter = baseConf.getKeys(); iter.hasNext(); ) {
+ String key = iter.next();
+ setProperty(key, baseConf.getProperty(key));
+ }
}
/**
--
To stop receiving notification emails like this one, please contact
['"commits@bookkeeper.apache.org" <co...@bookkeeper.apache.org>'].