-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Labels
status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by anothertype: bugA general bugA general bug
Description
JarTypeFilter is not handling dependency jars with missing manifest files. This results in all starter jars being included in the repackaged jar.
A NullPointerException is thrown from JarTypeFilter.filter on this line:
String jarType = jarFile.getManifest().getMainAttributes().getValue("Spring-Boot-Jar-Type");When this occurs, the NPE is caught in FilterArtifacts.filter which skips the results of the executing filter, resulting in the starter jars being retained in the repackaged jar file.
If the manifest file is missing, the jar should still be included by this filter (returning false). Either of these fix the issue...
return Optional.ofNullable(jarFile.getManifest())
.map(Manifest::getMainAttributes)
.map(attributes -> attributes.getValue("Spring-Boot-Jar-Type"))
.map(EXCLUDED_JAR_TYPES::contains)
.orElse(Boolean.FALSE);or
final Manifest manifest = jarFile.getManifest();
if (manifest != null) {
String jarType = manifest.getMainAttributes().getValue("Spring-Boot-Jar-Type");
return jarType != null && EXCLUDED_JAR_TYPES.contains(jarType);
}
return false;This jar was the culprit in our project. net.sourceforge.streamsupport:streamsupport:1.2.1.
snicoll
Metadata
Metadata
Assignees
Labels
status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by anothertype: bugA general bugA general bug