Esempio n. 1
0
  public static void main(String... args) {

    try (JammedTurkeyCage t = new JammedTurkeyCage()) {
      throw new IllegalStateException("turkeys ran out !");
    } catch (IllegalStateException e) {
      out.println(e.getMessage());
      for (Throwable t : e.getSuppressed()) {
        out.println(t.getMessage());
      }
    }
  } // end main
Esempio n. 2
0
  public static void main(String... args) {

    try (One one = new One();
        Two two = new Two(); ) {
      throw new ArrayIndexOutOfBoundsException("AIOOBE");
    } catch (IllegalStateException e) {
      out.println(e.getMessage());
      for (Throwable t : e.getSuppressed()) {
        out.println(t.getMessage());
      }
    }
  } // end main