< prev index next >

src/java.base/share/classes/java/net/URLStreamHandler.java

Print this page

        

*** 248,266 **** if (spec.charAt(start) == '/') { path = spec.substring(start, limit); } else if (path != null && path.length() > 0) { isRelPath = true; int ind = path.lastIndexOf('/'); ! String seperator = ""; if (ind == -1 && authority != null) ! seperator = "/"; ! path = path.substring(0, ind + 1) + seperator + spec.substring(start, limit); } else { ! String seperator = (authority != null) ? "/" : ""; ! path = seperator + spec.substring(start, limit); } } else if (queryOnly && path != null) { int ind = path.lastIndexOf('/'); if (ind < 0) ind = 0; --- 248,266 ---- if (spec.charAt(start) == '/') { path = spec.substring(start, limit); } else if (path != null && path.length() > 0) { isRelPath = true; int ind = path.lastIndexOf('/'); ! String separator = ""; if (ind == -1 && authority != null) ! separator = "/"; ! path = path.substring(0, ind + 1) + separator + spec.substring(start, limit); } else { ! String separator = (authority != null) ? "/" : ""; ! path = separator + spec.substring(start, limit); } } else if (queryOnly && path != null) { int ind = path.lastIndexOf('/'); if (ind < 0) ind = 0;
*** 312,331 **** setURL(u, protocol, host, port, authority, userInfo, path, query, ref); } /** * Returns the default port for a URL parsed by this handler. This method ! * is meant to be overidden by handlers with default port numbers. * @return the default port for a {@code URL} parsed by this handler. * @since 1.3 */ protected int getDefaultPort() { return -1; } /** ! * Provides the default equals calculation. May be overidden by handlers * for other protocols that have different requirements for equals(). * This method requires that none of its arguments is null. This is * guaranteed by the fact that it is only called by java.net.URL class. * @param u1 a URL object * @param u2 a URL object --- 312,331 ---- setURL(u, protocol, host, port, authority, userInfo, path, query, ref); } /** * Returns the default port for a URL parsed by this handler. This method ! * is meant to be overridden by handlers with default port numbers. * @return the default port for a {@code URL} parsed by this handler. * @since 1.3 */ protected int getDefaultPort() { return -1; } /** ! * Provides the default equals calculation. May be overridden by handlers * for other protocols that have different requirements for equals(). * This method requires that none of its arguments is null. This is * guaranteed by the fact that it is only called by java.net.URL class. * @param u1 a URL object * @param u2 a URL object
*** 340,350 **** return (ref1 == ref2 || (ref1 != null && ref1.equals(ref2))) && sameFile(u1, u2); } /** ! * Provides the default hash calculation. May be overidden by handlers for * other protocols that have different requirements for hashCode * calculation. * @param u a URL object * @return an {@code int} suitable for hash table indexing * @since 1.3 --- 340,350 ---- return (ref1 == ref2 || (ref1 != null && ref1.equals(ref2))) && sameFile(u1, u2); } /** ! * Provides the default hash calculation. May be overridden by handlers for * other protocols that have different requirements for hashCode * calculation. * @param u a URL object * @return an {@code int} suitable for hash table indexing * @since 1.3
< prev index next >