@@ -971,14 +971,27 @@ void handleClassPathAttribute(LinkedHashSet<Path> destination, Path jarFilePath,
971
971
String classPathValue = mainAttributes .getValue ("Class-Path" );
972
972
/* Missing Class-Path Attribute is tolerable */
973
973
if (classPathValue != null ) {
974
+ /* Cache expensive reverse lookup in bundle-case */
975
+ Path origJarFilePath = null ;
974
976
for (String cp : classPathValue .split (" +" )) {
975
977
Path manifestClassPath = Path .of (cp );
976
978
if (!manifestClassPath .isAbsolute ()) {
977
979
/* Resolve relative manifestClassPath against directory containing jar */
978
- manifestClassPath = jarFilePath .getParent ().resolve (manifestClassPath );
980
+ Path relativeManifestClassPath = manifestClassPath ;
981
+ manifestClassPath = jarFilePath .getParent ().resolve (relativeManifestClassPath );
982
+ if (useBundle () && !Files .exists (manifestClassPath )) {
983
+ if (origJarFilePath == null ) {
984
+ origJarFilePath = bundleSupport .originalPath (jarFilePath );
985
+ }
986
+ if (origJarFilePath == null ) {
987
+ assert false : "Manifest Class-Path handling failed. No original path for " + jarFilePath + " available." ;
988
+ break ;
989
+ }
990
+ manifestClassPath = origJarFilePath .getParent ().resolve (relativeManifestClassPath );
991
+ }
979
992
}
980
993
/* Invalid entries in Class-Path are allowed (i.e. use strict false) */
981
- addImageClasspathEntry (destination , manifestClassPath , false );
994
+ addImageClasspathEntry (destination , manifestClassPath . normalize () , false );
982
995
}
983
996
}
984
997
}
0 commit comments