Hi,

On Tue, 2004-04-20 at 09:24, Guilhem Lavaux wrote:
> Apparently the special parseURL implementation in
> gnu.java.net.protocol.file.Handler is not required anymore and even
> broken according to mauve test gnu.testlet.java.net.URL.URLTest. If we
> replace it using GCJ implementation (attached) 39 failures are fixed and
> no regression happens. So I suggest to use it directly.

If we do use it directly, lets please clean it up first.

  protected URLConnection openConnection(URL url) throws IOException
  {
    // If a hostname is set, then we need to switch protocols to ftp
    // in order to transfer this from the remote host.
    String host = url.getHost();
    if ((host != null) && (! host.equals("")))
      {
//        throw new IOException("ftp protocol handler not yet implemented.");
//        /*
        // Reset the protocol (and implicitly the handler) for this URL.
        // Then have the URL attempt the connection again, as it will
        // get the changed handler the next time around.
        setURL (url, "ftp", url.getHost(), url.getPort(), url.getFile(),
                url.getRef());
        // Until the ftp protocol handler is written, this will cause
        // a NullPointerException.
        return url.openConnection();
//      */
      }

    return new Connection(url);
  }

The // comments commenting out the /* */ comments really make this far to hard to read

Lets replace it with:

  protected URLConnection openConnection(URL url) throws IOException
  {
    // If a hostname is set, then we need to switch protocols to ftp
    // in order to transfer this from the remote host.
    String host = url.getHost();
    if ((host != null) && (! host.equals("")))
      {
        // Reset the protocol (and implicitly the handler) for this URL.
        // Then have the URL attempt the connection again, as it will
        // get the changed handler the next time around.
        setURL (url, "ftp", url.getHost(), url.getPort(), url.getFile(),
                url.getRef());

        // Until the ftp protocol handler is written, this will cause
        // a NullPointerException.
        return url.openConnection();
      }

    return new Connection(url);
  }

And we might want to do something nicer then throwing a
NullPointerException when the "ftp" protocol isn't found (as in standard
GNU Classpath).

Cheers,

Mark

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to