Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support jrt protocol #50

Closed
oliverlietz opened this issue Jul 28, 2023 · 2 comments
Closed

Support jrt protocol #50

oliverlietz opened this issue Jul 28, 2023 · 2 comments
Assignees
Labels
Milestone

Comments

@oliverlietz
Copy link
Member

https://openjdk.org/jeps/220

#47

@oliverlietz oliverlietz added the type: new feature New Feature label Jul 28, 2023
@oliverlietz oliverlietz added this to the 4.0.0 milestone Jul 28, 2023
@oliverlietz oliverlietz self-assigned this Jul 28, 2023
@oliverlietz
Copy link
Member Author

When support for bundleresource protocol was added in PAXTB-26 (#35), the case for unsupported protocols was removed (commented):

//        throw new IllegalStateException( "unsupported protocol " + classUrl.getProtocol() );

Which would have caught jrt protocol. Instead a misleading exception is thrown: Unsupported woven or system package classes.

@oliverlietz
Copy link
Member Author

An additional fix for JDK 9, 10, 11 and 12 is required to remove the /modules part from the URI of a class.

See https://bugs.openjdk.org/browse/JDK-8227076

Problem

Consider the file "/modules/java.base/java/lang/Object.class" in the jrt file system. If a tool has a Path to this file then invoking its toUri method should create the URI "jrt:/java.base/java/lang/Object.class". Unfortunately, due to a bug (the bug exists in JDK 9, 10, 11, 12), it yields the URI "jrt:/modules/java.base/java/lang/Object.class". This URI cannot be used with the jrt protocol handler (URL::openStream will fail with an IOException because module "modules" is not found).

Now consider the URI "jrt:/java.base/java/lang/Object.class". If Path.of(URI) is used to create a java.nio.file.Path from this URI then the resulting jrt file path will be "/java.base/java/lang/Object.class" and so will not locate a file in the jrt file system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

1 participant