Patch: gnu.java.net.protocol.file.Handler

Bryce McKinlay mckinlay@redhat.com
Sat Sep 11 22:03:00 GMT 2004


Michael Koch wrote:

>2004-09-10  Michael Koch  <konqueror@gmx.de>
>
>	* gnu/java/net/protocol/file/Handler.java
>	(openConnection): Don't throw exception if host part for file: URI is
>	present. setURL() keeps file: protocol if ftp: protocol is not
>	available.
>- -- 
>Homepage: http://www.worldforge.org/
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.2.4 (GNU/Linux)
>
>iD8DBQFBQaZKWSOgCCdjSDsRAusGAJwL8nHPOREph3kntvyt+XlD9Iz80QCeOzpw
>bT0hbNZezWnrw6XL1fD+JjU=
>=I3FP
>-----END PGP SIGNATURE-----
>  
>
>------------------------------------------------------------------------
>
>Index: gnu/java/net/protocol/file/Handler.java
>===================================================================
>RCS file: /cvs/gcc/gcc/libjava/gnu/java/net/protocol/file/Handler.java,v
>retrieving revision 1.3
>diff -u -r1.3 Handler.java
>--- gnu/java/net/protocol/file/Handler.java	26 Nov 2003 10:17:51 -0000	1.3
>+++ gnu/java/net/protocol/file/Handler.java	10 Sep 2004 12:55:43 -0000
>@@ -1,5 +1,5 @@
> /* Handler.java -- "file" protocol handler for java.net
>-   Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
>+   Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
> 
> This file is part of GNU Classpath.
> 
>@@ -76,17 +76,15 @@
>     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.
>+	// N.B.: FTP protocol is not supported by default in GNU Classpath
>+	// but it does not matter because setURL will keep the current protocol
>+	// if "ftp" is not available.
>  
>

Hmm, this looks ok, but I'm not sure that "keeping the current protocol" 
is the right behaviour if ftp is unavailable. An exception should be 
thrown at some point, IMO. What will happen with this patch if someone 
tries to connect an ftp URL, but the ftp handler is not installed?

Regards

Bryce



More information about the Java-patches mailing list