/** * Be careful - you can provoke any Exception with the method without the * need to declare it with a throws statement. For example * * <pre> * provoke(IOException.class) * </pre> * * would throw an IOException. * <p> * WARNING: If the desired exception can't be instantiated an * InstantiationException or IllegalAccessException may be thrown. * </p> * <p> * WARNING(2): This method is not synchronized. * </p> * * @param type * e.g. IOException.class */ public static void provoke(final Class<? extends Throwable> type) { Throwable t; try { t = create(type); } catch (ReflectiveOperationException ex) { LOG.debug("Cannot create {}:", type, ex); t = ex; } Thrower.provoke(t); }