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

QuarkusEntryPoint assumes URL contains a file path #20201

Closed
moritz-bruder opened this issue Sep 16, 2021 · 4 comments
Closed

QuarkusEntryPoint assumes URL contains a file path #20201

moritz-bruder opened this issue Sep 16, 2021 · 4 comments
Labels
area/core triage/out-of-date This issue/PR is no longer valid or relevant

Comments

@moritz-bruder
Copy link

In

String path = QuarkusEntryPoint.class.getProtectionDomain().getCodeSource().getLocation().getPath();
String decodedPath = URLDecoder.decode(path, "UTF-8");
Path appRoot = new File(decodedPath).toPath().getParent().getParent().getParent();
it is assumed that the returned URL contains a file path. However, the class may have been loaded from another source. Unfortunately, there is no getParent in URL but perhaps you could use toURI().resolve("../../..") instead.

@jaikiran
Copy link
Member

Hello @moritz-bruder, could you add some background context on what issue this piece of code is causing. Perhaps with a reproducible example? This code may or may not have issues and I haven't paid detailed attention to it, but knowing the context will help us understand if there are better ways to deal with it.

@moritz-bruder
Copy link
Author

Hello @jaikiran,

We are trying to make Quarkus work on JamaicaVM. However, the code source for builtin classes is not a URL with the file protocol in our case. The code in QuarkusEntryPoint seems to get the working directory through the code source (the path of the jar in this case). Am I right in that assumption? I am afraid it may not be easy to provide an example to you.

Would it be possible to check if the protocol is file and if not use a fallback path? For example, the current working directory or a property.

@geoand
Copy link
Contributor

geoand commented Sep 22, 2021

@moritz-bruder if you have something in mind, feel free to open a PR

@geoand
Copy link
Contributor

geoand commented Jan 24, 2022

Closing as we did not get feedback

@geoand geoand closed this as completed Jan 24, 2022
@geoand geoand added the triage/out-of-date This issue/PR is no longer valid or relevant label Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core triage/out-of-date This issue/PR is no longer valid or relevant
Projects
None yet
Development

No branches or pull requests

3 participants