# NetBeans IDE HG Patch # This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /home/matthias/nb-sources/core-main # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: core.startup.base/src/org/netbeans/core/startup/layers/NbinstURLStreamHandler.java --- core.startup.base/src/org/netbeans/core/startup/layers/NbinstURLStreamHandler.java +++ core.startup.base/src/org/netbeans/core/startup/layers/NbinstURLStreamHandler.java @@ -49,6 +49,8 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; +import java.net.InetAddress; +import java.net.Proxy; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; @@ -64,10 +66,39 @@ @URLStreamHandlerRegistration(protocol=NbinstURLMapper.PROTOCOL) public class NbinstURLStreamHandler extends URLStreamHandler { + @Override protected URLConnection openConnection(URL u) throws IOException { return new NbinstURLConnection(u); } + @Override + protected URLConnection openConnection(URL u, Proxy p) throws IOException { + // Ignore the proxy -- passing a proxy is not a sensible operation here + // implemented for completeness. + return openConnection(u); + } + + @Override + protected synchronized InetAddress getHostAddress(URL u) { + // URLStreamHandler utilizes getHostAddress to extract an InetAddress + // from the supplied URL. For example in the URLStreamHandler#hashCode(URL) + // and URLStreamHandler#equals(URL, URL) methods this is used and host + // related functions are delegated to InetAddress. + // + // In case of the nbinst URLs this breaks, as the host portion of the + // url is not a hostname, but a modulename. + // + // Returning NULL in getHostAddress causes a fallback to name based + // comparison, which is the correct approach for this usecase. + // + // The default implementation causes potential user visible timeouts if + // the network is not configured correctly: + // + // https://netbeans.org/bugzilla/show_bug.cgi?id=267962 + // + return null; + } + /** URLConnection for URL with nbinst protocol. * */