Code example for FileNotFoundException

0
    // if the requested file does not exist, throw an exception formerly the 
    // Error page from the server was returned if the requested file was 
    // text/html this has changed to return FileNotFoundException for all 
    // file types 
    if (getResponseCode() >= HTTP_BAD_REQUEST) {
      throw new FileNotFoundException(url.toString());
    } 
 
    InputStream result = response.getResponseBody();
    if (result == null) {
      throw new ProtocolException("No response body exists; responseCode=" + getResponseCode());
    } 
    return result;
  } 
 
  @Override public final OutputStream getOutputStream() throws IOException {
    connect(); 
 
    OutputStream out = httpEngine.getRequestBody();
    if (out == null) {
      throw new ProtocolException("method does not support a request body: " + method);