|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2018 the original author or authors. |
| 2 | + * Copyright 2002-2020 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.
|
|
20 | 20 | import java.io.IOException;
|
21 | 21 | import java.util.Arrays;
|
22 | 22 | import java.util.Collection;
|
23 |
| -import java.util.HashSet; |
| 23 | +import java.util.Collections; |
| 24 | +import java.util.LinkedHashSet; |
24 | 25 | import java.util.Set;
|
25 | 26 |
|
26 | 27 | import org.apache.commons.logging.Log;
|
@@ -129,15 +130,15 @@ public void setAsText(String text) {
|
129 | 130 | public void setValue(Object value) throws IllegalArgumentException {
|
130 | 131 | if (value instanceof Collection || (value instanceof Object[] && !(value instanceof Resource[]))) {
|
131 | 132 | Collection<?> input = (value instanceof Collection ? (Collection<?>) value : Arrays.asList((Object[]) value));
|
132 |
| - Set<Resource> merged = new HashSet<>(input.size()); |
| 133 | + Set<Resource> merged = new LinkedHashSet<>(); |
133 | 134 | for (Object element : input) {
|
134 | 135 | if (element instanceof String) {
|
135 | 136 | // A location pattern: resolve it into a Resource array.
|
136 | 137 | // Might point to a single resource or to multiple resources.
|
137 | 138 | String pattern = resolvePath((String) element).trim();
|
138 | 139 | try {
|
139 | 140 | Resource[] resources = this.resourcePatternResolver.getResources(pattern);
|
140 |
| - merged.addAll(Arrays.asList(resources)); |
| 141 | + Collections.addAll(merged, resources); |
141 | 142 | }
|
142 | 143 | catch (IOException ex) {
|
143 | 144 | // ignore - might be an unresolved placeholder or non-existing base directory
|
|
0 commit comments