The more specific you can be the more information you can get about the trouble and thus the better equipped you can be to recover from it. Exceptions can be caught from more specific to more general. Using
finally is a way to cleanup if an exception causes you to leave the execution of your code, eg, an error in reading a file causes execution to leave your try block and ends up in a catch block skipping over the
br.close() statement. You could close the reader in a finally block. In pseudocode:
try {
URL url = new URL(some_path);
File file = new File(url.toURI());
BufferedReader br = new BufferedReader(
new InputStreamReader(
new FileInputStream(file)));
// read and process file
br.close();
} catch(MalformedURLException mue) {
System.out.println("Bad URL: " + mue.getMessage());
} catch(FileNotFoundException fnfe) {
System.out.println("FileNotFound: " + fnfe.getMessage());
} catch(IOException ioe) {
System.out.println("Read error: " + ioe.getMessage());
}