Handler.java (10444:f08705540498) Handler.java (12588:108912ec77eb)
1/*
2 * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided

--- 120 unchanged lines hidden (view full) ---

129 protected URLConnection createFileURLConnection(URL url, File file) {
130 return new FileURLConnection(url, file);
131 }
132
133 /**
134 * Compares the host components of two URLs.
135 * @param u1 the URL of the first host to compare
136 * @param u2 the URL of the second host to compare
1/*
2 * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided

--- 120 unchanged lines hidden (view full) ---

129 protected URLConnection createFileURLConnection(URL url, File file) {
130 return new FileURLConnection(url, file);
131 }
132
133 /**
134 * Compares the host components of two URLs.
135 * @param u1 the URL of the first host to compare
136 * @param u2 the URL of the second host to compare
137 * @return <tt>true</tt> if and only if they
138 * are equal, <tt>false</tt> otherwise.
137 * @return {@code true} if and only if they
138 * are equal, {@code false} otherwise.
139 */
140 protected boolean hostsEqual(URL u1, URL u2) {
141 /*
142 * Special case for file: URLs
143 * per RFC 1738 no hostname is equivalent to 'localhost'
144 * i.e. file:///path is equal to file://localhost/path
145 */
146 String s1 = u1.getHost();
147 String s2 = u2.getHost();
148 if ("localhost".equalsIgnoreCase(s1) && ( s2 == null || "".equals(s2)))
149 return true;
150 if ("localhost".equalsIgnoreCase(s2) && ( s1 == null || "".equals(s1)))
151 return true;
152 return super.hostsEqual(u1, u2);
153 }
154}
139 */
140 protected boolean hostsEqual(URL u1, URL u2) {
141 /*
142 * Special case for file: URLs
143 * per RFC 1738 no hostname is equivalent to 'localhost'
144 * i.e. file:///path is equal to file://localhost/path
145 */
146 String s1 = u1.getHost();
147 String s2 = u2.getHost();
148 if ("localhost".equalsIgnoreCase(s1) && ( s2 == null || "".equals(s2)))
149 return true;
150 if ("localhost".equalsIgnoreCase(s2) && ( s1 == null || "".equals(s1)))
151 return true;
152 return super.hostsEqual(u1, u2);
153 }
154}