Skip to content

Instantly share code, notes, and snippets.

@arn-e
Last active December 11, 2015 03:59
Show Gist options
  • Save arn-e/4542287 to your computer and use it in GitHub Desktop.
Save arn-e/4542287 to your computer and use it in GitHub Desktop.
(poorly) handled checked exception - Java
public class FileReaderTest {
public static void main(String[] args) {
String filename = "./public/non_existent.file";
try {
List<String> allLines = Files.readAllLines(Paths.get(filename), Charset.defaultCharset());
for ( String i : allLines ) {
System.out.println(i);
}
} catch(IOException exception) {
// Absolutely nothing happens here
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment