@Test public void simpleIllegalArgumentException() { IllegalArgumentException origEx = new IllegalArgumentException("bla > 0"); Error error = new Error(origEx); try { RemoteExceptionUtil.throwOriginalExceptionIfPossible(error); } catch (Exception newEx) { newEx.printStackTrace(); assertThat(newEx).isInstanceOf(origEx.getClass()); assertThat(newEx.getMessage()).isEqualTo("bla > 0"); } }
public static void throwOriginalExceptionIfPossible(final Error error) { Throwable throwable = toThrowable(error); if (throwable instanceof RuntimeException) throw (RuntimeException) throwable; if (throwable instanceof java.lang.Error) throw (java.lang.Error) throwable; throw new RuntimeException(throwable); }
RemoteExceptionUtil { public static void throwOriginalExceptionIfPossible(final Error error) { Throwable throwable = toThrowable(error); if (throwable instanceof RuntimeException) throw (RuntimeException) throwable; if (throwable instanceof java.lang.Error) throw (java.lang.Error) throwable; throw new RuntimeException(throwable); } }
RemoteExceptionUtil { public static void throwOriginalExceptionIfPossible(final Error error) { Throwable throwable = toThrowable(error); if (throwable instanceof RuntimeException) throw (RuntimeException) throwable; if (throwable instanceof java.lang.Error) throw (java.lang.Error) throwable; throw new RuntimeException(throwable); } private  RemoteExceptionUtil(); }
RemoteExceptionUtil { public static void throwOriginalExceptionIfPossible(final Error error) { Throwable throwable = toThrowable(error); if (throwable instanceof RuntimeException) throw (RuntimeException) throwable; if (throwable instanceof java.lang.Error) throw (java.lang.Error) throwable; throw new RuntimeException(throwable); } private  RemoteExceptionUtil(); static void throwOriginalExceptionIfPossible(final Error error); }
RemoteExceptionUtil { public static void throwOriginalExceptionIfPossible(final Error error) { Throwable throwable = toThrowable(error); if (throwable instanceof RuntimeException) throw (RuntimeException) throwable; if (throwable instanceof java.lang.Error) throw (java.lang.Error) throwable; throw new RuntimeException(throwable); } private  RemoteExceptionUtil(); static void throwOriginalExceptionIfPossible(final Error error);  }