This is an automated email from the ASF dual-hosted git repository.

stevel pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new b21cb91  HADOOP-17130. Configuration.getValByRegex() shouldn't be 
updating the results while fetching. (#2142)
b21cb91 is described below

commit b21cb91c7f766b4d2920b893f756a0431f925a18
Author: Mukund Thakur <[email protected]>
AuthorDate: Thu Jul 16 22:39:59 2020 +0530

    HADOOP-17130. Configuration.getValByRegex() shouldn't be updating the 
results while fetching. (#2142)
    
    
    Contributed by Mukund Thakur
---
 .../src/main/java/org/apache/hadoop/conf/Configuration.java         | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java
index 9751a9b..b93581e 100755
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java
@@ -3869,6 +3869,7 @@ public class Configuration implements 
Iterable<Map.Entry<String,String>>,
     Pattern p = Pattern.compile(regex);
 
     Map<String,String> result = new HashMap<String,String>();
+    List<String> resultKeys = new ArrayList<>();
     Matcher m;
 
     for(Map.Entry<Object,Object> item: getProps().entrySet()) {
@@ -3876,11 +3877,12 @@ public class Configuration implements 
Iterable<Map.Entry<String,String>>,
           item.getValue() instanceof String) {
         m = p.matcher((String)item.getKey());
         if(m.find()) { // match
-          result.put((String) item.getKey(),
-              substituteVars(getProps().getProperty((String) item.getKey())));
+          resultKeys.add((String) item.getKey());
         }
       }
     }
+    resultKeys.forEach(item ->
+            result.put(item, substituteVars(getProps().getProperty(item))));
     return result;
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to