HADOOP-10549. Merging change r1592011 from trunk to branch-2.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1592012 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2014-05-02 19:15:39 +00:00
parent cb889486aa
commit dcf7c356ce
2 changed files with 8 additions and 3 deletions

View File

@ -33,6 +33,9 @@ Release 2.5.0 - UNRELEASED
HADOOP-10322. Add ability to read principal names from a keytab. HADOOP-10322. Add ability to read principal names from a keytab.
(Benoy Antony and Daryn Sharp via kihwal) (Benoy Antony and Daryn Sharp via kihwal)
HADOOP-10549. MAX_SUBST and varPat should be final in Configuration.java.
(Gera Shegalov via cnauroth)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -797,14 +797,16 @@ private synchronized void addResourceObject(Resource resource) {
reloadConfiguration(); reloadConfiguration();
} }
private static Pattern varPat = Pattern.compile("\\$\\{[^\\}\\$\u0020]+\\}"); private static final Pattern VAR_PATTERN =
private static int MAX_SUBST = 20; Pattern.compile("\\$\\{[^\\}\\$\u0020]+\\}");
private static final int MAX_SUBST = 20;
private String substituteVars(String expr) { private String substituteVars(String expr) {
if (expr == null) { if (expr == null) {
return null; return null;
} }
Matcher match = varPat.matcher(""); Matcher match = VAR_PATTERN.matcher("");
String eval = expr; String eval = expr;
for(int s=0; s<MAX_SUBST; s++) { for(int s=0; s<MAX_SUBST; s++) {
match.reset(eval); match.reset(eval);