You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2020/12/21 18:37:42 UTC
[accumulo] 02/06: Fix a bug in the AccumuloClient builder
This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch 2.0.1-rc1
in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit 6ceb00655800dbc5b3d1cf16c1d18570c347a610
Author: Christopher Tubbs <ct...@apache.org>
AuthorDate: Wed Dec 16 01:12:08 2020 -0500
Fix a bug in the AccumuloClient builder
(cherry-picked for 2.0.1)
This fixes #1839
Fix a bug in the ClientContext's from(Properties) method, which is used
to build a new AccumuloClient from an existing set of properties. This
is often used to initialize a builder, and then to subsequently modify
the client via the builder to use different credentials, or other
settings, that were stored in the provided Properties.
This fix modifies the from(Properties) method to make a copy of the
provided Properties, so that subsequent builder activity does not modify
the Properties object that the caller provided.
---
.../main/java/org/apache/accumulo/core/clientImpl/ClientContext.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java
index 01474b2..ab7696b 100644
--- a/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java
+++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java
@@ -780,7 +780,10 @@ public class ClientContext implements AccumuloClient {
@Override
public FromOptions<T> from(Properties properties) {
- this.properties = properties;
+ // make a copy, so that this builder's subsequent methods don't mutate the
+ // properties object provided by the caller
+ this.properties = new Properties();
+ this.properties.putAll(properties);
return this;
}