List of usage examples for com.google.common.util.concurrent UncheckedExecutionException getCause
public synchronized Throwable getCause()
From source file:org.opendaylight.infrautils.caches.guava.internal.CacheGuavaAdapter.java
private static RuntimeException throwCause(UncheckedExecutionException unchecked) { Throwable cause = unchecked.getCause(); Throwables.throwIfUnchecked(cause);/*from w w w. j a v a 2s .c o m*/ throw new RuntimeException(cause); }
From source file:org.mycore.datamodel.metadata.MCRObjectIDPool.java
static MCRObjectID getMCRObjectID(String id) { try {//ww w. j a va 2 s .c o m return objectIDCache.getUnchecked(id); } catch (UncheckedExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof MCRException) { throw (MCRException) cause; } throw e; } }
From source file:com.blackducksoftware.bdio.SimpleBase.java
/** * Applies a function that can potentially throw an {@code UncheckedExecutionException} (like a cache). */// w ww .j a v a 2 s .com protected static <T> T apply(Function<String, T> converter, String fullyQualifiedName) { try { return converter.apply(fullyQualifiedName); } catch (UncheckedExecutionException e) { Throwables.propagateIfPossible(e.getCause()); throw e; } }
From source file:org.robotninjas.commandbus.AnnotatedHandlerFinder.java
private static ImmutableList<Method> getAnnotatedMethods(Class<?> clazz) { try {// www . ja v a 2s . c o m return handlerMethodsCache.getUnchecked(clazz); } catch (UncheckedExecutionException e) { throw Throwables.propagate(e.getCause()); } }
From source file:com.github.legman.AnnotatedHandlerFinder.java
private static ImmutableList<EventMetadata> getEventMetadata(Class<?> clazz) { try {/*from w w w . ja v a 2 s. c om*/ return handlerMethodsCache.getUnchecked(clazz); } catch (UncheckedExecutionException e) { throw Throwables.propagate(e.getCause()); } }
From source file:org.bugkillers.bus.eventbus.SubscriberRegistry_.java
/** * Flattens a class's type hierarchy into a set of {@code Class} objects including all * superclasses (transitively) and all interfaces implemented by these superclasses. *///from w w w. j a v a2s .com @VisibleForTesting static ImmutableSet<Class<?>> flattenHierarchy(Class<?> concreteClass) { try { return flattenHierarchyCache.getUnchecked(concreteClass); } catch (UncheckedExecutionException e) { throw Throwables.propagate(e.getCause()); } }
From source file:org.opendaylight.yangtools.binding.data.codec.impl.SchemaRootCodecContext.java
private static <K, V> V getOrRethrow(final LoadingCache<K, V> cache, final K key) { try {// www.j a va 2 s . co m return cache.getUnchecked(key); } catch (final UncheckedExecutionException e) { final Throwable cause = e.getCause(); if (cause != null) { Throwables.propagateIfPossible(cause); } throw e; } }
From source file:org.jclouds.reflect.Reflection2.java
/** * ensures that exceptions are not doubly-wrapped *///from w w w .j a va 2 s . c om private static <K, V> V get(LoadingCache<K, V> cache, K key) { try { return cache.get(key); } catch (UncheckedExecutionException e) { throw propagate(e.getCause()); } catch (ExecutionException e) { throw propagate(e.getCause()); } }
From source file:com.google.errorprone.dataflow.nullnesspropagation.inference.NullnessQualifierInference.java
public static InferredNullability getInferredNullability(Tree methodOrInitializerOrLambda) { checkArgument(/*w w w. j av a2s . c om*/ methodOrInitializerOrLambda instanceof MethodTree || methodOrInitializerOrLambda instanceof LambdaExpressionTree || methodOrInitializerOrLambda instanceof BlockTree || methodOrInitializerOrLambda instanceof VariableTree, "Tree `%s` is not a lambda, initializer, or method.", methodOrInitializerOrLambda); try { return inferenceCache.getUnchecked(methodOrInitializerOrLambda); } catch (UncheckedExecutionException e) { throw e.getCause() instanceof CompletionFailure ? (CompletionFailure) e.getCause() : e; } }
From source file:io.prestosql.plugin.hive.metastore.CachingHiveMetastore.java
private static <K, V> V get(LoadingCache<K, V> cache, K key) { try {//from w ww . j a v a2s .co m return cache.getUnchecked(key); } catch (UncheckedExecutionException e) { throwIfInstanceOf(e.getCause(), PrestoException.class); throw e; } }