java fails under a path with 4-byte UTF-8 character & JDK-8258246
Fabian Meumertzheim
fabian at buildbuddy.io
Fri Nov 22 18:27:40 UTC 2024
I just observed that the java launcher fails to run (any) Java program
on macOS if executed from a working directory that contains a
character with a 4-byte UTF-8 encoding (say an emoji).
While it does seem related to JDK-8258246, which was considered to be
caused by more general issues with legacy URL/URI conversion, I
believe that my current issue comes down to just
sun.net.www.ParseUtil.decode(sun.net.www.ParseUtil.fileToEncodedURL(f))
failing for any File f with such a character in its path.
Since sun.net.www.ParseUtil.fileToEncodedURL seems to have its single
call site in URLClassPath, which is the source of the issue, I wonder
whether this could be fixed in a more targeted manner without
incurring the high risks alluded to in JDK-8258246. For example,
replacing the URL encoding logic with f.toPath().toUri().toURL() does
seem to resolve the issue.
Is the latest comment on JDK-8258246 still the plan or would a
separate bug report for this more targeted issue be welcome?
Fabian
More information about the core-libs-dev
mailing list