HADOOP-17130. Configuration.getValByRegex() shouldn't be updating the results while fetching. (#2142)
Contributed by Mukund Thakur Change-Id: Ic0c9c44a1b14b4bfa962cede3f782a98fdfd7513
This commit is contained in:
parent
0d88ed2794
commit
187b161c20
|
@ -3865,6 +3865,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
||||||
Pattern p = Pattern.compile(regex);
|
Pattern p = Pattern.compile(regex);
|
||||||
|
|
||||||
Map<String,String> result = new HashMap<String,String>();
|
Map<String,String> result = new HashMap<String,String>();
|
||||||
|
List<String> resultKeys = new ArrayList<>();
|
||||||
Matcher m;
|
Matcher m;
|
||||||
|
|
||||||
for(Map.Entry<Object,Object> item: getProps().entrySet()) {
|
for(Map.Entry<Object,Object> item: getProps().entrySet()) {
|
||||||
|
@ -3872,11 +3873,12 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
||||||
item.getValue() instanceof String) {
|
item.getValue() instanceof String) {
|
||||||
m = p.matcher((String)item.getKey());
|
m = p.matcher((String)item.getKey());
|
||||||
if(m.find()) { // match
|
if(m.find()) { // match
|
||||||
result.put((String) item.getKey(),
|
resultKeys.add((String) item.getKey());
|
||||||
substituteVars(getProps().getProperty((String) item.getKey())));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
resultKeys.forEach(item ->
|
||||||
|
result.put(item, substituteVars(getProps().getProperty(item))));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue