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
Unable to resolve UNC-based classpath entries #705
Comments
@lukehutch Any chance you could comment on this issue? Thanks! |
Hi @jdeppe-pivotal, I'm sorry it took so long for me to get to this, I have been swamped for the last few months. I checked in a change -- please test the git head version and let me know if it resolves this issue for you. |
Thanks for taking a look! Unfortunately, though, the problem still seems to be there. Here is a log from a run using your most recent changes:
|
I left a comment on your code changes: 047e465#r89914945 |
At that point I tried simply changing
... changed to:
|
I think I finally fixed it, released in version 4.8.150. (I'll reopen if it still doesn't work for you, but it works in my own testing.) The trick was to just do |
Unfortunately it's still not working. I think there may be a couple of problems still. I tried changing the assignment of |
Oh! If I do |
@jdeppe-pivotal OK, I think I may have solved this finally. The reason paths have to be converted to strings is because I'm trying to support nested jar syntax, e.g. For UNC paths, some Java APIs (out of Path, File, URI, URL) require syntax like I think the result may finally work, please test and let me know. |
Ultimately the whole path handling strategy should be overhauled for ClassGraph, but I'm worried I'll break something for some users, so let's try these minimal changes to start with. |
Looks like that has fixed it! Thanks very much. |
I fixed a few more issues and released as version 4.8.151, please let me know if it works for you. Thanks. |
Yes! Looks good. Thanks again, Luke. |
Great, thank you for your persistence! |
@lukehutch : In your last commit a218636 an ClassCastException was introduced if an URLClassLoader is used with direct URLs to class files. In this case the pathElement is a URL an not a Path so an ClassCastException is thrown. Could you add an instanceOf check to the new if clause? Thank you in advance! |
@devlauer Thanks, fixed. I'll release this soon. |
@lukehutch : Thank you for the quick fix!! |
@devlauer You're welcome, thanks for the report. There are probably more UNC path issues lurking, since UNC paths are weird, and the handling in the Java libraries is complex. Please report any other issues you find! |
Hello Luke!
I have come across a problem where UNC-based classpath entries are not resolved correctly. I think I've boiled it down to this test scenario:
When run with these args:
Produces this log:
As you're probably aware, Java can open UNC-based files. If one passes something like
file://192.168.216.1/workspace/somefile
to this snippet:The
path
ends up pointing to aWindowsPath
object (that looks like\\192.168.216.1\workspace\somefile
) and is able to be opened and read.Thanks for your time!
The text was updated successfully, but these errors were encountered: