Hi, Various URL scheme code paths contain branches for local or non-local file URLs:
See URLJarFile::isFileURL for an example where the host is compared as follows: String host = url.getHost(); if (host == null || host.isEmpty() || host.equals("~") || host.equalsIgnoreCase("localhost")) return true; Equivalent checks are found in unix and windows Handler::openConnection. In JarFileFactory::urlFor however, the logic is slightly different in that the comparison with ~ (tilde) is missing: String host = url.getHost(); if (host != null && !host.isEmpty() && !host.equalsIgnoreCase("localhost")) { I have tried to find an RFC or any other mention of "~" in host names, but found nothing. Can anyone shine light on the meaning and interpretation of this character as a host name? In any case, I think if we could add the tilde logic to JarFileFactory::urlFor, then all these four checks would be equivalent and a prime candidate for a consolidating cleanup PR, perhaps also expanding a bit on the documentation for the consolidated method(s). My take is that the missing test was a simple oversight, that adding it should not be harmful and that this would enable a nice consolidation of this particular logic. . Thoughts? Eirik.