re PR libgcj/4383 (file: protocol not supported in URLConnection?)
PR libgcj/4383 * gnu/gcj/protocol/file/Connection.java (connect): Throw FileNotFoundException if appropriate. * gnu/gcj/protocol/file/Handler.java (openConnection): Throw an IOException if we got a file: url with a hostname. Comment out protocol switch to ftp for now. * java/net/URL.java (URL): Include protocol name in exception message when handler can't be found. From-SVN: r45898
This commit is contained in:
parent
fa82903832
commit
218e1e912d
4 changed files with 18 additions and 3 deletions
|
@ -48,7 +48,11 @@ class Connection extends URLConnection
|
|||
|
||||
// If not connected, then file needs to be openned.
|
||||
fileIn = new File(url.getFile());
|
||||
connected = true;
|
||||
|
||||
if (fileIn.exists())
|
||||
connected = true;
|
||||
else
|
||||
throw new FileNotFoundException("No such file or directory");
|
||||
}
|
||||
|
||||
public InputStream getInputStream() throws IOException
|
||||
|
|
|
@ -35,6 +35,8 @@ public class Handler extends URLStreamHandler
|
|||
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.
|
||||
|
@ -43,6 +45,7 @@ public class Handler extends URLStreamHandler
|
|||
// Until the ftp protocol handler is written, this will cause
|
||||
// a NullPointerException.
|
||||
return url.openConnection();
|
||||
*/
|
||||
}
|
||||
|
||||
return new Connection(url);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue