Commit cb5599c7 by Michael Koch Committed by Michael Koch

2003-11-26 Michael Koch <konqueror@gmx.de>

	* java/net/URLStreamHandler.java
	(parseURL): Added comment in catch statement.
	(canonicalizeFilename): Add documentation.
	(sameURL): Completed documentation.
	(equals): Likewise.
	(hostsEqual): Likewise.
	(getDefaulPort): Likewise.
	(hashCode): Likewise.
	(toExternalForm): Likewise.
	(getHostName): Fix empty hostname check, completed documentation.

From-SVN: r73962
parent e0520fa7
2003-11-26 Michael Koch <konqueror@gmx.de>
* java/net/URLStreamHandler.java
(parseURL): Added comment in catch statement.
(canonicalizeFilename): Add documentation.
(sameURL): Completed documentation.
(equals): Likewise.
(hostsEqual): Likewise.
(getDefaulPort): Likewise.
(hashCode): Likewise.
(toExternalForm): Likewise.
(getHostName): Fix empty hostname check, completed documentation.
2003-11-26 Tom Tromey <tromey@redhat.com> 2003-11-26 Tom Tromey <tromey@redhat.com>
* java/lang/natDouble.cc (parseDouble): Reverted patch of * java/lang/natDouble.cc (parseDouble): Reverted patch of
......
...@@ -218,6 +218,7 @@ public abstract class URLStreamHandler ...@@ -218,6 +218,7 @@ public abstract class URLStreamHandler
} }
catch (IOException e) catch (IOException e)
{ {
// Do nothing.
} }
} }
...@@ -243,6 +244,9 @@ public abstract class URLStreamHandler ...@@ -243,6 +244,9 @@ public abstract class URLStreamHandler
setURL(url, url.getProtocol(), host, port, file, ref); setURL(url, url.getProtocol(), host, port, file, ref);
} }
/*
* Canonicalize a filename.
*/
private static String canonicalizeFilename(String file) private static String canonicalizeFilename(String file)
{ {
// XXX - GNU Classpath has an implementation that might be more appropriate // XXX - GNU Classpath has an implementation that might be more appropriate
...@@ -275,6 +279,8 @@ public abstract class URLStreamHandler ...@@ -275,6 +279,8 @@ public abstract class URLStreamHandler
* @param url1 The first url * @param url1 The first url
* @param url2 The second url to compare with the first * @param url2 The second url to compare with the first
* *
* @return True if both URLs point to the same file, false otherwise.
*
* @specnote Now protected * @specnote Now protected
*/ */
protected boolean sameFile(URL url1, URL url2) protected boolean sameFile(URL url1, URL url2)
...@@ -363,6 +369,8 @@ public abstract class URLStreamHandler ...@@ -363,6 +369,8 @@ public abstract class URLStreamHandler
* *
* @param url1 An URL object * @param url1 An URL object
* @param url2 An URL object * @param url2 An URL object
*
* @return True if both given URLs are equal, false otherwise.
*/ */
protected boolean equals (URL url1, URL url2) protected boolean equals (URL url1, URL url2)
{ {
...@@ -395,6 +403,11 @@ public abstract class URLStreamHandler ...@@ -395,6 +403,11 @@ public abstract class URLStreamHandler
/** /**
* Compares the host components of two URLs. * Compares the host components of two URLs.
* *
* @param url1 The first URL.
* @param url2 The second URL.
*
* @return True if both URLs contain the same host.
*
* @exception UnknownHostException If an unknown host is found * @exception UnknownHostException If an unknown host is found
*/ */
protected boolean hostsEqual (URL url1, URL url2) protected boolean hostsEqual (URL url1, URL url2)
...@@ -417,12 +430,16 @@ public abstract class URLStreamHandler ...@@ -417,12 +430,16 @@ public abstract class URLStreamHandler
/** /**
* Get the IP address of our host. An empty host field or a DNS failure will * Get the IP address of our host. An empty host field or a DNS failure will
* result in a null return. * result in a null return.
*
* @param url The URL to return the host address for.
*
* @return The address of the hostname in url.
*/ */
protected InetAddress getHostAddress (URL url) protected InetAddress getHostAddress (URL url)
{ {
String hostname = url.getHost (); String hostname = url.getHost ();
if (hostname == "") if (hostname.equals(""))
return null; return null;
try try
...@@ -438,6 +455,8 @@ public abstract class URLStreamHandler ...@@ -438,6 +455,8 @@ public abstract class URLStreamHandler
/** /**
* Returns the default port for a URL parsed by this handler. This method is * Returns the default port for a URL parsed by this handler. This method is
* meant to be overidden by handlers with default port numbers. * meant to be overidden by handlers with default port numbers.
*
* @return The default port number.
*/ */
protected int getDefaultPort () protected int getDefaultPort ()
{ {
...@@ -447,6 +466,10 @@ public abstract class URLStreamHandler ...@@ -447,6 +466,10 @@ public abstract class URLStreamHandler
/** /**
* Provides the default hash calculation. May be overidden by handlers for * Provides the default hash calculation. May be overidden by handlers for
* other protocols that have different requirements for hashCode calculation. * other protocols that have different requirements for hashCode calculation.
*
* @param url The URL to calc the hashcode for.
*
* @return The hashcode for the given URL.
*/ */
protected int hashCode (URL url) protected int hashCode (URL url)
{ {
...@@ -462,6 +485,8 @@ public abstract class URLStreamHandler ...@@ -462,6 +485,8 @@ public abstract class URLStreamHandler
* that have a different syntax should override this method * that have a different syntax should override this method
* *
* @param url The URL object to convert * @param url The URL object to convert
*
* @return A string representation of the url
*/ */
protected String toExternalForm(URL u) protected String toExternalForm(URL u)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment