in spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ChangeableUrls.java [142:180]
private static List<URL> getUrlsFromManifestClassPathAttribute(URL jarUrl, JarFile jarFile) throws IOException {
Manifest manifest = jarFile.getManifest();
if (manifest == null) {
return Collections.emptyList();
}
String classPath = manifest.getMainAttributes().getValue(Attributes.Name.CLASS_PATH);
if (!StringUtils.hasText(classPath)) {
return Collections.emptyList();
}
String[] entries = StringUtils.delimitedListToStringArray(classPath, " ");
List<URL> urls = new ArrayList<>(entries.length);
List<URL> nonExistentEntries = new ArrayList<>();
for (String entry : entries) {
try {
URL referenced = new URL(jarUrl, entry);
if (new File(referenced.getFile()).exists()) {
urls.add(referenced);
}
else {
referenced = new URL(jarUrl, URLDecoder.decode(entry, "UTF-8"));
if (new File(referenced.getFile()).exists()) {
urls.add(referenced);
}
else {
nonExistentEntries.add(referenced);
}
}
}
catch (MalformedURLException ex) {
throw new IllegalStateException("Class-Path attribute contains malformed URL", ex);
}
}
if (!nonExistentEntries.isEmpty()) {
logger.info(LogMessage.of(() -> "The Class-Path manifest attribute in " + jarFile.getName()
+ " referenced one or more files that do not exist: "
+ StringUtils.collectionToCommaDelimitedString(nonExistentEntries)));
}
return urls;
}