File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
main/java/org/springframework/util
test/java/org/springframework/util Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2010 the original author or authors.
2
+ * Copyright 2002-2012 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -135,9 +135,10 @@ protected String parseStringValue(
135
135
int endIndex = findPlaceholderEndIndex (buf , startIndex );
136
136
if (endIndex != -1 ) {
137
137
String placeholder = buf .substring (startIndex + this .placeholderPrefix .length (), endIndex );
138
- if (!visitedPlaceholders .add (placeholder )) {
138
+ String originalPlaceholder = placeholder ;
139
+ if (!visitedPlaceholders .add (originalPlaceholder )) {
139
140
throw new IllegalArgumentException (
140
- "Circular placeholder reference '" + placeholder + "' in property definitions" );
141
+ "Circular placeholder reference '" + originalPlaceholder + "' in property definitions" );
141
142
}
142
143
// Recursive invocation, parsing placeholders contained in the placeholder key.
143
144
placeholder = parseStringValue (placeholder , placeholderResolver , visitedPlaceholders );
@@ -173,7 +174,7 @@ else if (this.ignoreUnresolvablePlaceholders) {
173
174
throw new IllegalArgumentException ("Could not resolve placeholder '" + placeholder + "'" );
174
175
}
175
176
176
- visitedPlaceholders .remove (placeholder );
177
+ visitedPlaceholders .remove (originalPlaceholder );
177
178
}
178
179
else {
179
180
startIndex = -1 ;
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2009 the original author or authors.
2
+ * Copyright 2002-2012 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -65,6 +65,15 @@ public void testRecurseInPlaceholder() {
65
65
props .setProperty ("inner" , "ar" );
66
66
67
67
assertEquals ("foo=bar" , this .helper .replacePlaceholders (text , props ));
68
+
69
+ text = "${top}" ;
70
+ props = new Properties ();
71
+ props .setProperty ("top" , "${child}+${child}" );
72
+ props .setProperty ("child" , "${${differentiator}.grandchild}" );
73
+ props .setProperty ("differentiator" , "first" );
74
+ props .setProperty ("first.grandchild" , "actualValue" );
75
+
76
+ assertEquals ("actualValue+actualValue" , this .helper .replacePlaceholders (text , props ));
68
77
}
69
78
70
79
@ Test
You can’t perform that action at this time.
0 commit comments