Log single message per jar with faulty Class-Path manifest attribute
Previously, when DevTools encountered a jar with a Class-Path manifest attribute that referenced non-existent files, it would log one message per entry in the attribute that did not exist. While useful information, this has proven to be too verbose. This commit aims to strike a better balances by logging a single message for an entire jar. The message is a single line that includes the path to the jar with the faulty Class-Path manifest attribute and the paths of all of the files that do not exist that are referenced by the attribute. Closes gh-10111
This commit is contained in:
parent
9f1d435b8d
commit
8761ef547c
|
|
@ -140,6 +140,7 @@ final class ChangeableUrls implements Iterable<URL> {
|
||||||
String[] entries = StringUtils.delimitedListToStringArray(classPath, " ");
|
String[] entries = StringUtils.delimitedListToStringArray(classPath, " ");
|
||||||
List<URL> urls = new ArrayList<URL>(entries.length);
|
List<URL> urls = new ArrayList<URL>(entries.length);
|
||||||
File parent = new File(jarFile.getName()).getParentFile();
|
File parent = new File(jarFile.getName()).getParentFile();
|
||||||
|
List<File> nonExistentEntries = new ArrayList<File>();
|
||||||
for (String entry : entries) {
|
for (String entry : entries) {
|
||||||
try {
|
try {
|
||||||
File referenced = new File(parent, entry);
|
File referenced = new File(parent, entry);
|
||||||
|
|
@ -147,9 +148,7 @@ final class ChangeableUrls implements Iterable<URL> {
|
||||||
urls.add(referenced.toURI().toURL());
|
urls.add(referenced.toURI().toURL());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Ignoring Class-Path entry " + entry + " found in "
|
nonExistentEntries.add(referenced);
|
||||||
+ jarFile.getName() + " as " + referenced
|
|
||||||
+ " does not exist");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MalformedURLException ex) {
|
catch (MalformedURLException ex) {
|
||||||
|
|
@ -157,6 +156,11 @@ final class ChangeableUrls implements Iterable<URL> {
|
||||||
"Class-Path attribute contains malformed URL", ex);
|
"Class-Path attribute contains malformed URL", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!nonExistentEntries.isEmpty()) {
|
||||||
|
System.out.println("The Class-Path manifest attribute in " + jarFile.getName()
|
||||||
|
+ " referenced one or more files that do not exist: "
|
||||||
|
+ StringUtils.collectionToCommaDelimitedString(nonExistentEntries));
|
||||||
|
}
|
||||||
return urls;
|
return urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue