emul/src/main/java/java/net/URLStreamHandler.java
changeset 339 7579a0ee92fb
parent 327 444cfb098f1a
     1.1 --- a/emul/src/main/java/java/net/URLStreamHandler.java	Sun Dec 16 20:13:00 2012 +0100
     1.2 +++ b/emul/src/main/java/java/net/URLStreamHandler.java	Mon Dec 17 09:55:07 2012 +0100
     1.3 @@ -25,13 +25,6 @@
     1.4  
     1.5  package java.net;
     1.6  
     1.7 -import java.io.IOException;
     1.8 -import java.io.InputStream;
     1.9 -import java.io.File;
    1.10 -import java.io.OutputStream;
    1.11 -import java.util.Hashtable;
    1.12 -import sun.net.util.IPAddressUtil;
    1.13 -import sun.net.www.ParseUtil;
    1.14  
    1.15  /**
    1.16   * The abstract class <code>URLStreamHandler</code> is the common
    1.17 @@ -69,7 +62,7 @@
    1.18       * @exception  IOException  if an I/O error occurs while opening the
    1.19       *               connection.
    1.20       */
    1.21 -    abstract protected URLConnection openConnection(URL u) throws IOException;
    1.22 +//    abstract protected URLConnection openConnection(URL u) throws IOException;
    1.23  
    1.24      /**
    1.25       * Same as openConnection(URL), except that the connection will be
    1.26 @@ -93,9 +86,9 @@
    1.27       *               implements the protocol doesn't support this method.
    1.28       * @since      1.5
    1.29       */
    1.30 -    protected URLConnection openConnection(URL u, Proxy p) throws IOException {
    1.31 -        throw new UnsupportedOperationException("Method not implemented.");
    1.32 -    }
    1.33 +//    protected URLConnection openConnection(URL u, Proxy p) throws IOException {
    1.34 +//        throw new UnsupportedOperationException("Method not implemented.");
    1.35 +//    }
    1.36  
    1.37      /**
    1.38       * Parses the string representation of a <code>URL</code> into a
    1.39 @@ -185,11 +178,11 @@
    1.40  
    1.41                          String nhost = host ;
    1.42                          host = nhost.substring(0,ind+1);
    1.43 -                        if (!IPAddressUtil.
    1.44 -                            isIPv6LiteralAddress(host.substring(1, ind))) {
    1.45 -                            throw new IllegalArgumentException(
    1.46 -                                "Invalid host: "+ host);
    1.47 -                        }
    1.48 +//                        if (!IPAddressUtil.
    1.49 +//                            isIPv6LiteralAddress(host.substring(1, ind))) {
    1.50 +//                            throw new IllegalArgumentException(
    1.51 +//                                "Invalid host: "+ host);
    1.52 +//                        }
    1.53  
    1.54                          port = -1 ;
    1.55                          if (nhost.length() > ind+1) {
    1.56 @@ -351,7 +344,7 @@
    1.57              h += protocol.hashCode();
    1.58  
    1.59          // Generate the host part.
    1.60 -        InetAddress addr = getHostAddress(u);
    1.61 +        Object addr = getHostAddress(u);
    1.62          if (addr != null) {
    1.63              h += addr.hashCode();
    1.64          } else {
    1.65 @@ -425,22 +418,7 @@
    1.66       * IP address.
    1.67       * @since 1.3
    1.68       */
    1.69 -    protected synchronized InetAddress getHostAddress(URL u) {
    1.70 -        if (u.hostAddress != null)
    1.71 -            return u.hostAddress;
    1.72 -
    1.73 -        String host = u.getHost();
    1.74 -        if (host == null || host.equals("")) {
    1.75 -            return null;
    1.76 -        } else {
    1.77 -            try {
    1.78 -                u.hostAddress = InetAddress.getByName(host);
    1.79 -            } catch (UnknownHostException ex) {
    1.80 -                return null;
    1.81 -            } catch (SecurityException se) {
    1.82 -                return null;
    1.83 -            }
    1.84 -        }
    1.85 +    private synchronized Object getHostAddress(URL u) {
    1.86          return u.hostAddress;
    1.87      }
    1.88  
    1.89 @@ -453,8 +431,8 @@
    1.90       * @since 1.3
    1.91       */
    1.92      protected boolean hostsEqual(URL u1, URL u2) {
    1.93 -        InetAddress a1 = getHostAddress(u1);
    1.94 -        InetAddress a2 = getHostAddress(u2);
    1.95 +        Object a1 = getHostAddress(u1);
    1.96 +        Object a2 = getHostAddress(u2);
    1.97          // if we have internet address for both, compare them
    1.98          if (a1 != null && a2 != null) {
    1.99              return a1.equals(a2);