Julho 06
Prof(s). Eduardo Bezerra & Ismael H. F. Santos                                                2
Repassando uma Exceção
ntry {
n  try {
n    ...
n  } catch( FileNotFoundException e ) {
n    System.err.println("FileNotFoundException: “+e.getMessage());
n    throw new RuntimeException(e);
n  }catch (IOException e) {
n    class SampleException extends Exception {
n      public SampleException(String msg) {super(msg);}
n      public SampleException(Throwable t) { super(t); }
n      public SampleException(String msg,Throwable t){super(msg,t);}
n    }
n    SampleException ex=new SampleException("Other IOException", e);
n    throw ex;
n  }
n}catch (Exception cause) {
n  System.err.println("Cause: " + cause);
n  System.err.println("Original cause: " + cause.getCause());
n}