Advanced Exception Throwing

Lets consider following sample: [code lang=”java”] public class Test { static class FooException extends Exception { } static class BarException extends Exception { } static Z rethrow(Throwable e, Class a, Class b) throws T, E { if (a.isAssignableFrom(e.getClass())) { System.out.println(”throw ” + a.getName()); throw (T)e; } else if (b.isAssignableFrom(e.getClass())) { System.out.println(”throw ” + b.getName()); throw…

Read more