...
| Code Block | ||
|---|---|---|
| ||
public class Operation {
static void doOperation(String some_file) throws IOException {
try (BufferedReader reader = new BufferedReader(new FileReader(some_file))) {
// Do operations
}
}
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Please supply a path as an argument");
return;
}
try {
doOperation(args[0]);
} catch (IOException ex) {
System.outerr.println("thrown exception: " + ex.toString());
Throwable[] suppressed = ex.getSuppressed();
for (int i = 0; i < suppressed.length; i++) {
System.outerr.println("suppressed exception: " + suppressed[i].toString());
}
// Handle exception
}
}
}
|
...