Guava UncheckedExecutionException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava UncheckedExecutionException class.

This code example shows how to use the following methods:
 
   @Test(expectedExceptions = UncheckedExecutionException.class) 
   void testDoesntCatchOtherExceptions() { 
      BackoffOnNotFoundWhenGetBucketACL backoff = new BackoffOnNotFoundWhenGetBucketACL(mock); 
 
      expect(mock.getBucketACL("foo")).andThrow(new UncheckedExecutionException(new TimeoutException())); 
 
      replay(mock); 
      backoff.load("foo"); 
      verify(mock); 
   } 
} 
6
CodeRank
This code example shows how to use the following methods:getMessage
                  DriveInfo drive = cache.getUnchecked(bootDevice.getDriveUuid());
                  imageId = drive.getName();
               } catch (NullPointerException e) {
                  logger.debug("drive %s not found", bootDevice.getDriveUuid());
               } catch (UncheckedExecutionException e) {
                  logger.warn(e, "error finding drive %s: %s", bootDevice.getDriveUuid(), e.getMessage());
               } 
            } 
         } 
         return imageId;
      } 
   } 
 
} 
6
CodeRank
This code example shows how to use the following methods:
      boolean completed = jobComplete.apply(job.getJobId());
      logger.trace("<< job(%s) complete(%s)", job, completed);
      AsyncJob<T> jobWithResult = client.getAsyncJobApi().<T> getAsyncJob(job.getJobId());
      checkState(completed, "job %s failed to complete in time %s", job.getJobId(), jobWithResult);
      if (jobWithResult.getError() != null)
         throw new UncheckedExecutionException(String.format("job %s failed with exception %s", job.getJobId(),
               jobWithResult.getError().toString())) {
         }; 
      return jobWithResult.getResult();
   } 
} 
5
CodeRank
This code example shows how to use the following methods:
  @Override 
  public V getUnchecked(K key) {
    try { 
      return get(key);
    } catch (ExecutionException e) {
      throw new UncheckedExecutionException(e.getCause());
    } 
  } 
 
  @Override 
  public ImmutableMap<K, V> getAll(Iterable<? extends K> keys) throws ExecutionException {
    Map<K, V> result = Maps.newLinkedHashMap();
    for (K key : keys) {
      if (!result.containsKey(key)) {
        result.put(key, get(key));
      } 
    } 
    return ImmutableMap.copyOf(result);
  } 
 
4
CodeRank
This code example shows how to use the following methods:getCause
            } 
            // Attempt to re-throw as-is 
            Throwables.propagateIfPossible(cause, AuthenticationException.class);
            throw new AuthenticationException(cause);
        } catch (UncheckedExecutionException e) {
            throw Throwables.propagate(e.getCause());
        } finally { 
            context.stop();
        } 
    } 
 
    /** 
     * Discards any cached principal for the given credentials. 
     * 
     * @param credentials a set of credentials 
     */ 
    public void invalidate(C credentials) {
        cache.invalidate(credentials);
    } 
 
4
CodeRank
This code example shows how to use the following methods:getCause
		try { 
			return cache.get(key);
		} catch(ExecutionException ee){
			throw new InvalidFeatureException(key);
		} catch(UncheckedExecutionException uee){
			Throwable cause = uee.getCause();
 
			if(cause instanceof PMMLException){
				throw (PMMLException)cause;
			} 
 
			throw new InvalidFeatureException(key);
		} 
	} 
 
	static 
	public <K extends PMMLObject, V> V getValue(K key, Callable<? extends V> loader, Cache<K, V> cache){
 
		try { 
			return cache.get(key, loader);
4
CodeRank
This code example shows how to use the following methods:getCause
 
    try { 
      cache.getUnchecked(new Object()); 
      fail();
    } catch (UncheckedExecutionException expected) {
      assertEquals(cause, expected.getCause());
    } 
 
    Object newValue = new Object(); 
    valueRef.set(newValue); 
    assertSame(newValue, cache.getUnchecked(new Object()));
  } 
 
  public void testGetUnchecked_unchecked() { 
    final RuntimeException cause = new RuntimeException();
    final AtomicReference<Object> valueRef = new AtomicReference<Object>();
    LoadingCache<Object, Object> cache = new AbstractLoadingCache<Object, Object>() {
      @Override 
      public Object get(Object key) throws ExecutionException { 
        Object v = valueRef.get(); 
4
CodeRank
This code example shows how to use the following methods:getCause
 
    try { 
      map.getUnchecked(new Object()); 
      fail();
    } catch (UncheckedExecutionException uee) {
      assertSame(e, uee.getCause());
    } 
    assertTrue(listener.isEmpty());
    checkEmpty(map); 
  } 
} 
4
CodeRank