Skip to content

Commit 275bf82

Browse files
authored
Remove extra variable (#2398)
* Reapply "remove extra variable"
1 parent bfb79c4 commit 275bf82

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultInterpolator.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,9 @@ private static String doSubstVars(
263263
// Using the start and stop delimiter indices, extract
264264
// the first, deepest nested variable placeholder.
265265
String variable = val.substring(startDelim + DELIM_START.length(), stopDelim);
266-
String org = variable;
267266

268-
String substValue = processSubstitution(
269-
variable, org, cycleMap, configProps, callback, postprocessor, defaultsToEmptyString);
267+
String substValue =
268+
processSubstitution(variable, cycleMap, configProps, callback, postprocessor, defaultsToEmptyString);
270269

271270
// Append the leading characters, the substituted value of
272271
// the variable, and the trailing characters to get the new
@@ -285,7 +284,6 @@ private static String doSubstVars(
285284

286285
private static String processSubstitution(
287286
String variable,
288-
String org,
289287
Set<String> cycleMap,
290288
Map<String, String> configProps,
291289
UnaryOperator<String> callback,
@@ -327,8 +325,8 @@ private static String processSubstitution(
327325
String opValue = variable.substring(idx + 2, nextIdx >= 0 ? nextIdx : variable.length());
328326

329327
// Process the operator value through substitution if it contains variables
330-
String processedOpValue =
331-
doSubstVars(opValue, org, cycleMap, configProps, callback, postprocessor, defaultsToEmptyString);
328+
String processedOpValue = doSubstVars(
329+
opValue, variable, cycleMap, configProps, callback, postprocessor, defaultsToEmptyString);
332330

333331
// Apply the operator
334332
if (":+".equals(op)) {
@@ -344,7 +342,7 @@ private static String processSubstitution(
344342
break;
345343
}
346344
} else {
347-
throw new InterpolatorException("Bad substitution operator in: ${" + org + "}");
345+
throw new InterpolatorException("Bad substitution operator in: ${" + variable + "}");
348346
}
349347

350348
startIdx = nextIdx >= 0 ? nextIdx : variable.length();

0 commit comments

Comments
 (0)