@Test public void testRewrap() { try { throwTwoArgConstructorException(); fail("Should not get here"); } catch (TwoArgConstructorException e) { TwoArgConstructorException wrapped = Throwables.rewrap(e); assertEquals(e.getMessage(), wrapped.getMessage()); assertSame(e, wrapped.getCause()); } try { throwSQLException(); fail("Should not get here"); } catch (SQLException e) { SQLException wrapped = Throwables.rewrap(e); assertEquals(e.getMessage(), wrapped.getMessage()); assertSame(e, wrapped.getCause()); } try { throwNoUsefulConstructorException(); fail("Should not get here"); } catch (NoUsefulConstructorException e) { int sizeBefore = e.getStackTrace().length; NoUsefulConstructorException wrapped = Throwables.rewrap(e); assertSame(e, wrapped); int sizeAfter = e.getStackTrace().length; assertEquals(sizeAfter, sizeBefore); } }
public static <T extends Throwable> T rewrap(T throwable) { Preconditions.checkNotNull(throwable); return rewrap(throwable.getMessage(), throwable); }
Throwables { public static <T extends Throwable> T rewrap(T throwable) { Preconditions.checkNotNull(throwable); return rewrap(throwable.getMessage(), throwable); } }
Throwables { public static <T extends Throwable> T rewrap(T throwable) { Preconditions.checkNotNull(throwable); return rewrap(throwable.getMessage(), throwable); } private  Throwables(); }
Throwables { public static <T extends Throwable> T rewrap(T throwable) { Preconditions.checkNotNull(throwable); return rewrap(throwable.getMessage(), throwable); } private  Throwables(); static T chain(T throwable, Throwable cause); static RuntimeException rewrapAndThrowUncheckedException(Throwable ex); static RuntimeException rewrapAndThrowUncheckedException(String newMessage, Throwable ex); static AtlasDbDependencyException unwrapAndThrowAtlasDbDependencyException(Throwable ex); static Throwable unwrapIfPossible(Throwable ex); static RuntimeException throwUncheckedException(Throwable ex); static void throwIfUncheckedException(Throwable ex); static void rewrapAndThrowIfInstance(Throwable t, Class<K> clazz); @SuppressWarnings("unchecked") static void rewrapAndThrowIfInstance(String newMessage, Throwable t, Class<K> clazz); @SuppressWarnings("unchecked") static void throwIfInstance(Throwable t, Class<K> clazz); static T rewrap(T throwable); static T rewrap(final String newMessage, final T throwable); static String getThreadDump(); }
Throwables { public static <T extends Throwable> T rewrap(T throwable) { Preconditions.checkNotNull(throwable); return rewrap(throwable.getMessage(), throwable); } private  Throwables(); static T chain(T throwable, Throwable cause); static RuntimeException rewrapAndThrowUncheckedException(Throwable ex); static RuntimeException rewrapAndThrowUncheckedException(String newMessage, Throwable ex); static AtlasDbDependencyException unwrapAndThrowAtlasDbDependencyException(Throwable ex); static Throwable unwrapIfPossible(Throwable ex); static RuntimeException throwUncheckedException(Throwable ex); static void throwIfUncheckedException(Throwable ex); static void rewrapAndThrowIfInstance(Throwable t, Class<K> clazz); @SuppressWarnings("unchecked") static void rewrapAndThrowIfInstance(String newMessage, Throwable t, Class<K> clazz); @SuppressWarnings("unchecked") static void throwIfInstance(Throwable t, Class<K> clazz); static T rewrap(T throwable); static T rewrap(final String newMessage, final T throwable); static String getThreadDump();  }