Java Exception Handling Examples (1998)
Runnable Java examples of correct and incorrect exception handling patterns — swallowing, catching too broadly, translation at boundaries, and the finally cleanup idiom.
javaexception-handlingpatterns
Java Exception Handling Examples (1998)
Side-by-side correct and incorrect exception handling patterns — the kind of examples we used in code review feedback and team training.
Contents
AntiPatterns.java— swallowing, catching Exception, empty catch blocks — all demonstratedPatterns.java— specific catching, translation at boundaries, finally cleanup, logging with contextDeviceRepository.java— realistic example: JDBC layer translating SQLException to domain exceptionsTransactionDemo.java— correct commit/rollback with finally