Example usage for com.google.common.util.concurrent UncheckedExecutionException getCause

List of usage examples for com.google.common.util.concurrent UncheckedExecutionException getCause

Introduction

In this page you can find the example usage for com.google.common.util.concurrent UncheckedExecutionException getCause.

Prototype

public synchronized Throwable getCause() 

Source Link

Document

Returns the cause of this throwable or null if the cause is nonexistent or unknown.

Usage

From source file:org.openehr.adl.DelegatingFlatArchetypeProvider.java

@Override
public FlatArchetype getFlatArchetype(String archetypeId) {
    try {//from  w ww. j  a v a 2s .c  om
        return flatArchetypeCache.getUnchecked(archetypeId);
    } catch (UncheckedExecutionException e) {
        if (e.getCause() instanceof RuntimeException) {
            throw (RuntimeException) e.getCause();
        }
        throw e;
    }
}

From source file:com.facebook.buck.core.rules.knowntypes.KnownRuleTypesProvider.java

/** Returns {@link KnownRuleTypes} for a given {@link Cell}. */
public KnownRuleTypes get(Cell cell) {
    try {//w w  w.j  a v  a  2  s  . co  m
        return typesCache.getUnchecked(cell);
    } catch (UncheckedExecutionException e) {
        Throwables.throwIfUnchecked(e.getCause());
        throw e;
    }
}

From source file:com.facebook.buck.core.rules.knowntypes.AbstractKnownBuildRuleTypesProvider.java

public KnownBuildRuleTypes get(Cell cell) {
    try {//  w ww. ja  v  a  2  s.  com
        return getKnownBuildRuleTypesCache().getUnchecked(cell);
    } catch (UncheckedExecutionException e) {
        Throwables.throwIfUnchecked(e.getCause());
        throw e;
    }
}

From source file:com.vityuk.ginger.provider.plural.DefaultPluralFormSelectorResolver.java

private PluralRule resolvePluralRule(String languageCode) {
    try {/*  w  ww .j ava2 s  . c  o  m*/
        return pluralRuleCache.getUnchecked(languageCode);
    } catch (UncheckedExecutionException e) {
        throw Throwables.propagate(e.getCause());
    }
}

From source file:net.derquinse.common.util.zip.LoadedZipFile.java

/**
 * Transform the entry map./* ww w  .  j a va2  s  .  c o m*/
 */
private <T> Map<String, T> transform(Function<? super MemoryByteSource, T> f) throws IOException {
    try {
        return ImmutableMap.copyOf(Maps.transformValues(entryMap, f));
    } catch (UncheckedExecutionException e) {
        Throwable t = e.getCause();
        if (t instanceof IOException) {
            throw (IOException) t;
        }
        throw e;
    }
}

From source file:com.google.javascript.jscomp.transpile.CachingTranspiler.java

@Override
public TranspileResult transpile(URI path, String code) {
    try {//www .  j  a  v a 2  s . com
        return cache.getUnchecked(new Key(path, code));
    } catch (UncheckedExecutionException e) {
        if (e.getCause() instanceof TranspilationException) {
            // If transpilation fails due to a parse error we can get an UncheckedExecutionException.
            // This is because BaseTranspiler wraps the parse error as an TranspilationException.
            // TODO(joeltine): This might better as a checked exception?
            throw new TranspilationException(e);
        } else {
            throw e;
        }
    }
}

From source file:com.facebook.buck.config.ConfigViewCache.java

public <V extends ConfigView<T>> V getView(Class<V> viewClass) {
    try {/*from w  w w . ja  v  a2 s . co  m*/
        return viewClass.cast(cache.getUnchecked(viewClass));
    } catch (UncheckedExecutionException e) {
        throw Throwables.propagate(e.getCause());
    }
}

From source file:com.facebook.buck.core.config.ConfigViewCache.java

public <V extends ConfigView<T>> V getView(Class<V> viewClass) {
    try {/*w  w  w . ja  v a  2 s  .co m*/
        return viewClass.cast(cache.getUnchecked(viewClass));
    } catch (UncheckedExecutionException e) {
        Throwables.throwIfUnchecked(e.getCause());
        throw e;
    }
}

From source file:org.n52.sos.util.LazyThreadSafeProducer.java

@Override
public T get(Locale language) throws ConfigurationException {
    if (language == null) {
        this.lock.readLock().lock();
        try {/* www .ja v a2  s.  com*/
            return this.nullLocale;
        } finally {
            this.lock.readLock().unlock();
        }
    } else {
        try {
            return this.cache.getUnchecked(language);
        } catch (UncheckedExecutionException ex) {
            if (ex.getCause() instanceof ConfigurationException) {
                throw (ConfigurationException) ex.getCause();
            } else {
                throw ex;
            }
        }
    }
}

From source file:com.facebook.buck.core.rules.platform.RuleBasedConstraintResolver.java

@Override
public ConstraintSetting getConstraintSetting(BuildTarget buildTarget) {
    try {//from ww  w. j  av a 2 s.com
        return constraintSettingCache.getUnchecked(buildTarget);
    } catch (UncheckedExecutionException e) {
        Throwables.throwIfUnchecked(e.getCause());
        throw new RuntimeException(e.getCause());
    }
}