HADOOP-10402. Configuration.getValByRegex does not substitute for variables. (Robert Kanter via kasha)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1617174 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4003d96860
commit
ec3a567117
|
@ -115,6 +115,9 @@ Release 2.6.0 - UNRELEASED
|
|||
HADOOP-10929. Typo in Configuration.getPasswordFromCredentialProviders
|
||||
(lmccay via brandonli)
|
||||
|
||||
HADOOP-10402. Configuration.getValByRegex does not substitute for
|
||||
variables. (Robert Kanter via kasha)
|
||||
|
||||
Release 2.5.0 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -2747,7 +2747,8 @@ 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(), (String) item.getValue());
|
||||
result.put((String) item.getKey(),
|
||||
substituteVars(getProps().getProperty((String) item.getKey())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,6 +178,14 @@ public class TestConfiguration extends TestCase {
|
|||
// check that expansion also occurs for getInt()
|
||||
assertTrue(conf.getInt("intvar", -1) == 42);
|
||||
assertTrue(conf.getInt("my.int", -1) == 42);
|
||||
|
||||
Map<String, String> results = conf.getValByRegex("^my.*file$");
|
||||
assertTrue(results.keySet().contains("my.relfile"));
|
||||
assertTrue(results.keySet().contains("my.fullfile"));
|
||||
assertTrue(results.keySet().contains("my.file"));
|
||||
assertEquals(-1, results.get("my.relfile").indexOf("${"));
|
||||
assertEquals(-1, results.get("my.fullfile").indexOf("${"));
|
||||
assertEquals(-1, results.get("my.file").indexOf("${"));
|
||||
}
|
||||
|
||||
public void testFinalParam() throws IOException {
|
||||
|
|
Loading…
Reference in New Issue