Tabnine Logo
Exceptions.throwUnchecked
Code IndexAdd Tabnine to your IDE (free)

How to use
throwUnchecked
method
in
uk.org.lidalia.lang.Exceptions

Best Java code snippets using uk.org.lidalia.lang.Exceptions.throwUnchecked (Showing top 9 results out of 315)

origin: uk.org.lidalia/lidalia-lang

/**
 * @param toThrow The throwable that will be thrown, unwrapped and unchecked; must not be null
 * @throws NullPointerException if toThrow is null
 */
public static void throwUnchecked(final Throwable toThrow) {
  throwUnchecked(toThrow, null);
}
origin: uk.org.lidalia/slf4j-test

  @Override
  public Properties apply(final InputStream propertyResource) {
    try (InputStream closablePropertyResource = propertyResource) {
      final Properties loadedProperties = new Properties();
      loadedProperties.load(closablePropertyResource);
      return loadedProperties;
    } catch (IOException ioException) {
      return throwUnchecked(ioException, null);
    }
  }
};
origin: Mahoney/slf4j-test

  @Override
  public Properties apply(final InputStream propertyResource) {
    try (InputStream closablePropertyResource = propertyResource) {
      final Properties loadedProperties = new Properties();
      loadedProperties.load(closablePropertyResource);
      return loadedProperties;
    } catch (IOException ioException) {
      return throwUnchecked(ioException, null);
    }
  }
};
origin: uk.org.lidalia/lidalia-lang

private FluentIterable<FieldFacade> fields() {
  try {
    return IDENTITY_FIELDS.get(getClass());
  } catch (ExecutionException e) {
    return throwUnchecked(e.getCause(), null);
  }
}
origin: uk.org.lidalia/lidalia-test

  @Override
  protected Throwable featureValueOf(final Constructor<?> constructor) {
    try {
      constructor.setAccessible(true);
      constructor.newInstance();
      return null;
    } catch (InvocationTargetException e) {
      return e.getCause();
    } catch (Exception e) {
      return throwUnchecked(e, null);
    } finally {
      constructor.setAccessible(false);
    }
  }
};
origin: uk.org.lidalia/lidalia-lang

/**
 * @throws Exception thrown by {@link #perform()} - unchecked
 */
@Override
public final void run() {
  try {
    perform();
  } catch (Exception e) {
    throwUnchecked(e);
  }
}
origin: Mahoney/sysout-over-slf4j

private static <T> T doWithSystemClasses(Callable<T> callable) throws SysOutOverSLF4JSystemJarNotPresentException {
  try {
    return callable.call();
  } catch (NoClassDefFoundError error) {
    if (error.getMessage().contains("sysoutslf4j/system")) {
      throw new SysOutOverSLF4JSystemJarNotPresentException(error);
    } else {
      throw error;
    }
  } catch (Exception e) {
    return throwUnchecked(e, null);
  }
}
origin: uk.org.lidalia/lidalia-lang

/**
 * @throws Exception thrown by the original caller, unwrapped
 * @return the result of the expression passed to the constructor; this is evaluated the first time this method is called,
 *         subsequent calls return the same result without re-evaluating it. Concurrent calls block until the first execution
 *         is complete.
 */
@Override
public T call() {
  supplier.run();
  try {
    return getUninterruptibly(supplier);
  } catch (ExecutionException e) {
    return throwUnchecked(e.getCause(), null);
  }
}
origin: uk.org.lidalia/lidalia-test

@SuppressWarnings({ "unchecked", "PMD.AvoidCatchingThrowable" })
private static <ThrowableType extends Throwable> ThrowableType shouldThrow(
    final Class<ThrowableType> expectedThrowableType,
    final Optional<String> message,
    final Runnable workThatShouldThrowThrowable) {
  try {
    workThatShouldThrowThrowable.run();
    throw new AssertionError(message.or("No exception thrown"));
  } catch (final Throwable actualThrowableThrown) {
    final Throwable trueThrowable = extractTrueThrowable(expectedThrowableType, actualThrowableThrown);
    if (!expectedThrowableType.isInstance(trueThrowable)) {
      throwUnchecked(actualThrowableThrown);
    }
    return (ThrowableType) trueThrowable;
  }
}
uk.org.lidalia.langExceptionsthrowUnchecked

Popular methods of Exceptions

  • doThrowUnchecked

Popular in Java

  • Making http post requests using okhttp
  • getContentResolver (Context)
  • getExternalFilesDir (Context)
  • getResourceAsStream (ClassLoader)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now