Does anyone know whether there is a tool or something similar to replace single catch clauses with duplicate code within it in java with multiple catch clauses to remove duplicate code?
Context is an upgrade vom java jdk6 to 7.
Thanks and cheers, Ste
I don't think there is a automatic way, You can do something like following
try {
// code
} catch (Exception1 e1) {
// caught Exception1
} catch (Exception2 e2) {
// caught Exception2
}
You can change this to
try {
// code
} catch (Exception1|Exception2 e) {
// caught Exception1 or Exception2
}