Integrated: 8338686: App classpath mismatch if a jar from the Class-Path attribute is on the classpath

Calvin Cheung ccheung at openjdk.org
Tue Sep 17 19:01:11 UTC 2024


On Fri, 23 Aug 2024 22:20:56 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

> When a CDS archive is created with `-cp A.jar:B.jar` where the manifest of A.jar contains a class-path attribute (e.g. `Class-Path: a.jar`). The following paths will be stored in the archive: A.jar:a.jar::B.jar.
> 
> Currently, if the user uses -cp A.jar:a.jar:B:jar during dump time and runtime, during runtime it will result in class path mismatch and the archive will not be used. It is due to during dump time when the ClassPathEntry's are being created, it checks if the name is in one of the existing entries and skip creating it. A simple fix is to add the check if the new entry and the existing entry are from the class path attribute.
> 
> With the fix, the following class path entries will be created during dump time:
> A.jar:a.jar:a.jar:B.jar
> The first a.jar is from the class path attribute, the second one is from the -cp. During runtime, the entries from the class path attribute obtained from the CDS archive will be skipped.
> 
> Testing: tiers 1 - 5.

This pull request has now been integrated.

Changeset: d5881825
Author:    Calvin Cheung <ccheung at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/d5881825ef442cac7076d551f0182f16b17b0b53
Stats:     60 lines in 2 files changed: 59 ins; 0 del; 1 mod

8338686: App classpath mismatch if a jar from the Class-Path attribute is on the classpath

Reviewed-by: dholmes, iklam

-------------

PR: https://git.openjdk.org/jdk/pull/20697


More information about the hotspot-runtime-dev mailing list