Repository: accumulo Updated Branches: refs/heads/1.6 4a5bd7ef6 -> 9b3bc30fe refs/heads/master f6b83ee50 -> e30594a65
ACCUMULO-3212 Do not load defaults into new Configuration objects for CredentialProvider Formatter fixed up some non-complaint whitespace too. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/9b3bc30f Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/9b3bc30f Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/9b3bc30f Branch: refs/heads/1.6 Commit: 9b3bc30fe7a0f5f28306d4a3703811524c0cf5e7 Parents: 4a5bd7e Author: Josh Elser <els...@apache.org> Authored: Wed Oct 8 13:17:23 2014 -0400 Committer: Josh Elser <els...@apache.org> Committed: Wed Oct 8 13:17:23 2014 -0400 ---------------------------------------------------------------------- .../tokens/CredentialProviderToken.java | 4 +-- .../conf/CredentialProviderFactoryShim.java | 2 +- .../accumulo/core/conf/SiteConfiguration.java | 28 ++++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/9b3bc30f/core/src/main/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderToken.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderToken.java b/core/src/main/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderToken.java index fa5bb33..99a3dbb 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderToken.java +++ b/core/src/main/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderToken.java @@ -44,7 +44,7 @@ public class CredentialProviderToken extends PasswordToken { } protected void setWithCredentialProviders(String name, String credentialProviders) throws IOException { - final Configuration conf = new Configuration(); + final Configuration conf = new Configuration(false); conf.set(CredentialProviderFactoryShim.CREDENTIAL_PROVIDER_PATH, credentialProviders); char[] password = CredentialProviderFactoryShim.getValueFromCredentialProvider(conf, name); @@ -53,7 +53,7 @@ public class CredentialProviderToken extends PasswordToken { throw new IOException("No password could be extracted from CredentialProvider(s) with " + name); } - setPassword(CharBuffer.wrap(password)); + setPassword(CharBuffer.wrap(password)); } @Override http://git-wip-us.apache.org/repos/asf/accumulo/blob/9b3bc30f/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java b/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java index aa3d195..28805fd 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/CredentialProviderFactoryShim.java @@ -311,7 +311,7 @@ public class CredentialProviderFactoryShim { */ public static Configuration getConfiguration(String credentialProviders) { Preconditions.checkNotNull(credentialProviders); - final Configuration conf = new Configuration(); + final Configuration conf = new Configuration(false); conf.set(CredentialProviderFactoryShim.CREDENTIAL_PROVIDER_PATH, credentialProviders); return conf; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/9b3bc30f/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java index 12f3ad2..9b65e7d 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java @@ -31,10 +31,10 @@ import org.apache.log4j.Logger; */ public class SiteConfiguration extends AccumuloConfiguration { private static final Logger log = Logger.getLogger(SiteConfiguration.class); - + private static AccumuloConfiguration parent = null; private static SiteConfiguration instance = null; - + private static Configuration xmlConfig; /** @@ -43,7 +43,7 @@ public class SiteConfiguration extends AccumuloConfiguration { SiteConfiguration(AccumuloConfiguration parent) { SiteConfiguration.parent = parent; } - + synchronized public static SiteConfiguration getInstance(AccumuloConfiguration parent) { if (instance == null) { instance = new SiteConfiguration(parent); @@ -51,12 +51,12 @@ public class SiteConfiguration extends AccumuloConfiguration { } return instance; } - + synchronized private static Configuration getXmlConfig() { String configFile = System.getProperty("org.apache.accumulo.config.file", "accumulo-site.xml"); if (xmlConfig == null) { xmlConfig = new Configuration(false); - + if (SiteConfiguration.class.getClassLoader().getResource(configFile) == null) log.warn(configFile + " not found on classpath", new Throwable()); else @@ -64,7 +64,7 @@ public class SiteConfiguration extends AccumuloConfiguration { } return xmlConfig; } - + @Override public String get(Property property) { String key = property.getKey(); @@ -86,7 +86,7 @@ public class SiteConfiguration extends AccumuloConfiguration { } String value = getXmlConfig().get(key); - + if (value == null || !property.getType().isValidFormat(value)) { if (value != null) log.error("Using default value for " + key + " due to improperly formatted " + property.getType() + ": " + value); @@ -94,7 +94,7 @@ public class SiteConfiguration extends AccumuloConfiguration { } return value; } - + @Override public void getProperties(Map<String,String> props, PropertyFilter filter) { parent.getProperties(props, filter); @@ -108,7 +108,7 @@ public class SiteConfiguration extends AccumuloConfiguration { if (null != hadoopConf) { try { for (String key : CredentialProviderFactoryShim.getKeys(hadoopConf)) { - if (!Property.isValidPropertyKey(key) || !Property.isSensitive(key)) { + if (!Property.isValidPropertyKey(key) || !Property.isSensitive(key)) { continue; } @@ -132,7 +132,7 @@ public class SiteConfiguration extends AccumuloConfiguration { if (null != credProviderPathsValue) { // We have configuration for a CredentialProvider // Try to pull the sensitive password from there - Configuration conf = new Configuration(); + Configuration conf = new Configuration(false); conf.set(CredentialProviderFactoryShim.CREDENTIAL_PROVIDER_PATH, credProviderPathsValue); return conf; } @@ -153,8 +153,8 @@ public class SiteConfiguration extends AccumuloConfiguration { public void clear() { getXmlConfig().clear(); } - - + + /** * method here to support testing, do not call */ @@ -164,14 +164,14 @@ public class SiteConfiguration extends AccumuloConfiguration { xmlConfig = null; } } - + /** * method here to support testing, do not call */ public void set(Property property, String value) { set(property.getKey(), value); } - + /** * method here to support testing, do not call */