diff options
author | Tom Tromey <tromey@redhat.com> | 2002-08-30 18:16:00 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2002-08-30 18:16:00 +0000 |
commit | 4c322bff290ba4cf86aefa934a8c26acd3350aae (patch) | |
tree | 6b8d006ff1e5363ff7071fe6e79480680b240d33 /libjava/java/net/URL.java | |
parent | 55f49e3d50d0a2d4158ecb93fbb8d079f396b1d2 (diff) | |
download | gcc-4c322bff290ba4cf86aefa934a8c26acd3350aae.zip gcc-4c322bff290ba4cf86aefa934a8c26acd3350aae.tar.gz gcc-4c322bff290ba4cf86aefa934a8c26acd3350aae.tar.bz2 |
JarURLConnection.java (getCertificates): New method from Classpath.
* java/net/JarURLConnection.java (getCertificates): New method
from Classpath.
* java/net/URLClassLoader.java (URLClassLoader): Extends
SecureClassLoader.
(definePackage): New method from Classpath.
(getPermissions): Likewise.
(newInstance): Likewise.
(findClass): Construct CodeSource for new class (from Classpath).
* java/net/SocketImpl.java (shutdownInput, shutdownOutput): New
methods.
* java/net/URL.java (getUserInfo): New method.
(set(String,String,int,String,String,String,String,String)): New
method.
* java/net/PlainSocketImpl.java (_Jv_SO_KEEPALIVE_): Define.
(shutdownInput, shutdownOutput): Declare.
* java/net/PlainDatagramSocketImpl.java (_Jv_SO_KEEPALIVE_):
Define.
* java/net/natPlainSocketImpl.cc (setOption): Handle keepalive.
(getOption): Likewise.
(shutdownInput): New method.
(shutdownOutput): Likewise.
* java/net/natPlainDatagramSocketImpl.cc (setOption): Handle
keepalive.
(getOption): Likewise.
* java/net/SocketOptions.java (SO_KEEPALIVE): New constant.
* java/net/Socket.java (setKeepAlive): New method.
(getKeepAlive): Likewise.
(shutdownInput, shutdownOutput): New methods.
From-SVN: r56685
Diffstat (limited to 'libjava/java/net/URL.java')
-rw-r--r-- | libjava/java/net/URL.java | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/libjava/java/net/URL.java b/libjava/java/net/URL.java index a3e9d78..73edeca 100644 --- a/libjava/java/net/URL.java +++ b/libjava/java/net/URL.java @@ -175,7 +175,8 @@ public final class URL implements Serializable this.handler = setURLStreamHandler(protocol); if (this.handler == null) - throw new MalformedURLException("Protocol handler not found: " + protocol); + throw new MalformedURLException("Protocol handler not found: " + + protocol); // JDK 1.2 doc for parseURL specifically states that any '#' ref // is to be excluded by passing the 'limit' as the indexOf the '#' @@ -245,6 +246,12 @@ public final class URL implements Serializable return ref; } + public String getUserInfo () + { + int at = host.indexOf('@'); + return at < 0 ? null : host.substring(0, at); + } + public int hashCode() { // JCL book says this is computed using (only) the hashcodes of the @@ -299,6 +306,30 @@ public final class URL implements Serializable hashCode = hashCode(); // Used for serialization. } + /** @since 1.3 */ + protected void set(String protocol, String host, int port, + String authority, String userInfo, + String path, String query, String ref) + { + // TBD: Theoretically, a poorly written StreamHandler could pass an + // invalid protocol. It will cause the handler to be set to null + // thus overriding a valid handler. Callers of this method should + // be aware of this. + this.handler = setURLStreamHandler(protocol); + this.protocol = protocol; + if (userInfo == null) + this.host = host; + else + this.host = userInfo + "@" + host; + this.port = port; + if (query == null) + this.file = path; + else + this.file = path + "?" + query; + this.ref = ref; + hashCode = hashCode(); // Used for serialization. + } + public static synchronized void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) { |