On 1/11/2022 5:52 pm, Alan Bateman wrote:
On Mon, 31 Oct 2022 22:00:01 GMT, Phil Race <p...@openjdk.org> wrote:
You have jumped through some refactoring hoops to be able to apply the
deprecation suppression to as little code as possible .. having made such
changes, then why didn't you just make the recommended change instead ?
Should I presume that the recommended route will have some nasty little
incompatibilities we will need to be careful of first ?
Converting these use-sites to URI will require care and working through issues
on a case by case basis. This is because URI is strict and will reject bad
input that URL may have handled differently. It may, for example, require
changing the exception handling so that exceptions such as URISyntaxException
(or IAE if code is changed to URI.create) maps to what is appropriate for code
using URL. So slow and careful work for future PRs I think.
We found there were some common cases, we made static convenience
methods to address them:
Fix MS Windows file URI strings, by converting back slashes to forward
slashes and inserting a forward slash before the drive letter if missing.
https://github.com/pfirmstone/JGDMS/blob/d8a85ff8cebac7a0e3c9a7f84c7fbfd6e9299fd7/JGDMS/jgdms-platform/src/main/java/org/apache/river/api/net/Uri.java#L289
Convert java.io.File to Uri, ensure compatibility with URLClassLoader,
when trailing directory character is dropped by java.io.File.
https://github.com/pfirmstone/JGDMS/blob/d8a85ff8cebac7a0e3c9a7f84c7fbfd6e9299fd7/JGDMS/jgdms-platform/src/main/java/org/apache/river/api/net/Uri.java#L341
Escape illegal characters when string doesn't contain any existing
escape sequences.
https://github.com/pfirmstone/JGDMS/blob/d8a85ff8cebac7a0e3c9a7f84c7fbfd6e9299fd7/JGDMS/jgdms-platform/src/main/java/org/apache/river/api/net/Uri.java#L926
Parse and fix a string that contains escaped sequences, any illegal
characters are escaped and any that should't be escaped are un-escaped.
https://github.com/pfirmstone/JGDMS/blob/d8a85ff8cebac7a0e3c9a7f84c7fbfd6e9299fd7/JGDMS/jgdms-platform/src/main/java/org/apache/river/api/net/Uri.java#L939
Convert java.net.URL to Uri, automatically fixing MS Windows URI syntax.
https://github.com/pfirmstone/JGDMS/blob/d8a85ff8cebac7a0e3c9a7f84c7fbfd6e9299fd7/JGDMS/jgdms-platform/src/main/java/org/apache/river/api/net/Uri.java#L324
Cheers,
Peter.
-------------
PR: https://git.openjdk.org/jdk/pull/10874