|
@@ -1099,6 +1099,20 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Provides a public wrapper over substituteVars in order to avoid compatibility issues.
|
|
|
+ * See HADOOP-18021 for further details.
|
|
|
+ *
|
|
|
+ * @param expr the literal value of a config key
|
|
|
+ * @return null if expr is null, otherwise the value resulting from expanding
|
|
|
+ * expr using the algorithm above.
|
|
|
+ * @throws IllegalArgumentException when more than
|
|
|
+ * {@link Configuration#MAX_SUBST} replacements are required
|
|
|
+ */
|
|
|
+ public String substituteCommonVariables(String expr) {
|
|
|
+ return substituteVars(expr);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Attempts to repeatedly expand the value {@code expr} by replacing the
|
|
|
* left-most substring of the form "${var}" in the following precedence order
|
|
@@ -1120,13 +1134,17 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|
|
* If a cycle is detected then the original expr is returned. Loops
|
|
|
* involving multiple substitutions are not detected.
|
|
|
*
|
|
|
+ * In order not to introduce breaking changes (as Oozie for example contains a method with the
|
|
|
+ * same name and same signature) do not make this method public, use substituteCommonVariables
|
|
|
+ * in this case.
|
|
|
+ *
|
|
|
* @param expr the literal value of a config key
|
|
|
* @return null if expr is null, otherwise the value resulting from expanding
|
|
|
* expr using the algorithm above.
|
|
|
* @throws IllegalArgumentException when more than
|
|
|
* {@link Configuration#MAX_SUBST} replacements are required
|
|
|
*/
|
|
|
- public String substituteVars(String expr) {
|
|
|
+ private String substituteVars(String expr) {
|
|
|
if (expr == null) {
|
|
|
return null;
|
|
|
}
|