Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ExceptionTranslation.java
// Exception translation
public
class ExceptionTranslation {
public
String readTheFile(String f) {
try
(BufferedReader is = new BufferedReader(new FileReader(f))) {
String line = is.readLine();
return line;
}
catch (FileNotFoundException fnf) {
throw new RuntimeException("Could not open file " + f, fnf);
} catch (IOException ex) {
throw new RuntimeException("Problem reading file " + f, ex);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment