mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-17 23:04:07 +01:00
Improved interpolateString.
This commit is contained in:
@@ -308,10 +308,7 @@ public class Model {
|
|||||||
*/
|
*/
|
||||||
public static String interpolateString(String text, Properties properties) {
|
public static String interpolateString(String text, Properties properties) {
|
||||||
final Properties props = properties;
|
final Properties props = properties;
|
||||||
if (text == null) {
|
if (text == null || props == null) {
|
||||||
return text;
|
|
||||||
}
|
|
||||||
if (props == null) {
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +316,7 @@ public class Model {
|
|||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
final int end = text.indexOf("}");
|
final int end = text.indexOf('}', pos + 2);
|
||||||
if (end < pos) {
|
if (end < pos) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
@@ -330,10 +327,9 @@ public class Model {
|
|||||||
propValue = "";
|
propValue = "";
|
||||||
}
|
}
|
||||||
final StringBuilder sb = new StringBuilder(propValue.length() + text.length());
|
final StringBuilder sb = new StringBuilder(propValue.length() + text.length());
|
||||||
sb.append(text.subSequence(0, pos));
|
sb.append(text.subSequence(0, pos))
|
||||||
sb.append(propValue);
|
.append(propValue)
|
||||||
sb.append(text.substring(end + 1));
|
.append(text.substring(end + 1));
|
||||||
return interpolateString(sb.toString(), props); //yes yes, this should be a loop...
|
return interpolateString(sb.toString(), props); //yes yes, this should be a loop...
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user