* java/lang/natClass.cc (_Jv_IsAssignableFrom): Handle the case of
an uninitialized target class.
+
+ * 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.
2001-09-28 Per Bothner <per@bothner.com>
// 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
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.
// Until the ftp protocol handler is written, this will cause
// a NullPointerException.
return url.openConnection();
+ */
}
return new Connection(url);
this.handler = setURLStreamHandler(protocol);
if (this.handler == null)
- throw new MalformedURLException("Handler for protocol not found");
+ throw new MalformedURLException("Protocol handler not found: " + protocol);
this.host = host;
this.handler = setURLStreamHandler(protocol);
if (this.handler == null)
- throw new MalformedURLException("Handler for protocol not found");
+ 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 '#'