Skip to content

Commit d7090b5

Browse files
biergitwilkinsona
authored andcommitted
Polish ImportCandidates
See gh-33013
1 parent b4283d4 commit d7090b5

File tree

1 file changed

+9
-9
lines changed
  • spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation

1 file changed

+9
-9
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/ImportCandidates.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ public static ImportCandidates load(Class<?> annotation, ClassLoader classLoader
7373
ClassLoader classLoaderToUse = decideClassloader(classLoader);
7474
String location = String.format(LOCATION, annotation.getName());
7575
Enumeration<URL> urls = findUrlsInClasspath(classLoaderToUse, location);
76-
List<String> autoConfigurations = new ArrayList<>();
76+
List<String> importCandidates = new ArrayList<>();
7777
while (urls.hasMoreElements()) {
7878
URL url = urls.nextElement();
79-
autoConfigurations.addAll(readAutoConfigurations(url));
79+
importCandidates.addAll(readCandidateConfigurations(url));
8080
}
81-
return new ImportCandidates(autoConfigurations);
81+
return new ImportCandidates(importCandidates);
8282
}
8383

8484
private static ClassLoader decideClassloader(ClassLoader classLoader) {
@@ -93,28 +93,28 @@ private static Enumeration<URL> findUrlsInClasspath(ClassLoader classLoader, Str
9393
return classLoader.getResources(location);
9494
}
9595
catch (IOException ex) {
96-
throw new IllegalArgumentException("Failed to load autoconfigurations from location [" + location + "]",
96+
throw new IllegalArgumentException("Failed to load configurations from location [" + location + "]",
9797
ex);
9898
}
9999
}
100100

101-
private static List<String> readAutoConfigurations(URL url) {
101+
private static List<String> readCandidateConfigurations(URL url) {
102102
try (BufferedReader reader = new BufferedReader(
103103
new InputStreamReader(new UrlResource(url).getInputStream(), StandardCharsets.UTF_8))) {
104-
List<String> autoConfigurations = new ArrayList<>();
104+
List<String> candidates = new ArrayList<>();
105105
String line;
106106
while ((line = reader.readLine()) != null) {
107107
line = stripComment(line);
108108
line = line.trim();
109109
if (line.isEmpty()) {
110110
continue;
111111
}
112-
autoConfigurations.add(line);
112+
candidates.add(line);
113113
}
114-
return autoConfigurations;
114+
return candidates;
115115
}
116116
catch (IOException ex) {
117-
throw new IllegalArgumentException("Unable to load autoconfigurations from location [" + url + "]", ex);
117+
throw new IllegalArgumentException("Unable to load configurations from location [" + url + "]", ex);
118118
}
119119
}
120120

0 commit comments

Comments
 (0)