* java/net/URLStreamHandler.java (sameFile): Fix port value
comparison.
* java/net/URL.java (handler): Make package private.
* gnu/gcj/protocol/http/Handler.java (getDefaultPort): New method.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67640
138bc75d-0d04-0410-961f-
82ee72b054a4
+2003-06-08 Anthony Green <green@redhat.com>
+
+ * java/net/URLStreamHandler.java (sameFile): Fix port value
+ comparison.
+ * java/net/URL.java (handler): Make package private.
+ * gnu/gcj/protocol/http/Handler.java (getDefaultPort): New method.
+
2003-06-07 Tom Tromey <tromey@redhat.com>
For PR libgcj/11085:
// Handler.java - URLStreamHandler for http protocol.
-/* Copyright (C) 1999 Free Software Foundation
+/* Copyright (C) 1999, 2003 Free Software Foundation
This file is part of libgcj.
import java.io.IOException;
/**
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Warren Levy
+ * @author Anthony Green <green@redhat.com>
* @date March 26, 1999.
*/
{
return new Connection(url);
}
+
+ protected int getDefaultPort ()
+ {
+ return 80;
+ }
}
/* URL.java -- Uniform Resource Locator Class
- Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
/**
* The protocol handler in use for this URL
*/
- transient private URLStreamHandler handler;
+ transient URLStreamHandler handler;
/**
* This a table where we cache protocol handlers to avoid the overhead
return true;
// This comparison is very conservative. It assumes that any
// field can be null.
- if (url1 == null || url2 == null || url1.getPort() != url2.getPort())
+ if (url1 == null || url2 == null)
+ return false;
+ int p1 = url1.getPort ();
+ if (p1 == -1)
+ p1 = url1.handler.getDefaultPort ();
+ int p2 = url2.getPort ();
+ if (p2 == -1)
+ p2 = url2.handler.getDefaultPort ();
+ if (p1 != p2)
return false;
String s1, s2;
s1 = url1.getProtocol();