|
64 | 64 | import java.util.NoSuchElementException;
|
65 | 65 | import java.util.Set;
|
66 | 66 | import java.util.TreeMap;
|
| 67 | +import java.util.ListIterator; |
67 | 68 | import java.util.concurrent.TimeUnit;
|
68 | 69 | import java.util.function.Function;
|
69 | 70 | import java.util.function.Predicate;
|
@@ -414,7 +415,7 @@ public List<String> getAsList(String key, List<String> defaultValue, Boolean com
|
414 | 415 | final Object valueFromPrefix = settings.get(key);
|
415 | 416 | if (valueFromPrefix != null) {
|
416 | 417 | if (valueFromPrefix instanceof List) {
|
417 |
| - return ((List<String>) valueFromPrefix); // it's already unmodifiable since the builder puts it as a such |
| 418 | + return Collections.unmodifiableList((List<String>) valueFromPrefix); |
418 | 419 | } else if (commaDelimited) {
|
419 | 420 | String[] strings = Strings.splitStringByCommaToArray(get(key));
|
420 | 421 | if (strings.length > 0) {
|
@@ -1042,7 +1043,7 @@ public Builder putList(String setting, String... values) {
|
1042 | 1043 | */
|
1043 | 1044 | public Builder putList(String setting, List<String> values) {
|
1044 | 1045 | remove(setting);
|
1045 |
| - map.put(setting, Collections.unmodifiableList(new ArrayList<>(values))); |
| 1046 | + map.put(setting, new ArrayList<>(values)); |
1046 | 1047 | return this;
|
1047 | 1048 | }
|
1048 | 1049 |
|
@@ -1210,10 +1211,20 @@ public boolean shouldRemoveMissingPlaceholder(String placeholderName) {
|
1210 | 1211 | Iterator<Map.Entry<String, Object>> entryItr = map.entrySet().iterator();
|
1211 | 1212 | while (entryItr.hasNext()) {
|
1212 | 1213 | Map.Entry<String, Object> entry = entryItr.next();
|
1213 |
| - if (entry.getValue() == null || entry.getValue() instanceof List) { |
| 1214 | + if (entry.getValue() == null) { |
1214 | 1215 | // a null value obviously can't be replaced
|
1215 | 1216 | continue;
|
1216 | 1217 | }
|
| 1218 | + if (entry.getValue() instanceof List) { |
| 1219 | + final ListIterator<String> li = ((List<String>) entry.getValue()).listIterator(); |
| 1220 | + while (li.hasNext()) { |
| 1221 | + final String settingValueRaw = li.next(); |
| 1222 | + final String settingValueResolved = propertyPlaceholder.replacePlaceholders(settingValueRaw, placeholderResolver); |
| 1223 | + li.set(settingValueResolved); |
| 1224 | + } |
| 1225 | + continue; |
| 1226 | + } |
| 1227 | + |
1217 | 1228 | String value = propertyPlaceholder.replacePlaceholders(Settings.toString(entry.getValue()), placeholderResolver);
|
1218 | 1229 | // if the values exists and has length, we should maintain it in the map
|
1219 | 1230 | // otherwise, the replace process resolved into removing it
|
|
0 commit comments