Program: 15201
Project: 15201
Buggy source:
/** 
 * Returns a new   {@code Callable} which will execute {@code firstCall} and, if it succeeds, {@code secondCall} in sequence. The resulting {@code resultFuture}will return one of: <ol> <li>  {@link Future#get()} returns the result of {@code secondCall}'s future result.</li> <li>  {@link Future#get()} throws the exception which caused {@code firstCall} to fail -- in this case {@code secondCall} is not executed.</li><li> {@link Future#get()} throws the exception which caused {@code secondCall} to fail.</li></ol>
 * @param < P >
 * @param firstCall
 * @param secondCall
 * @return resultFuture
 */
public static <T extends ListenableFuture<V>,V>Callable<T> combine(final Callable<T> firstCall,final Callable<T> secondCall){
  final CheckedListenableFuture<V> resultFuture=Futures.newGenericeFuture();
  final CheckedListenableFuture<T> intermediateFuture=Futures.newGenericeFuture();
  final Callable<T> chainingCallable=new Callable<T>(){
    @Override public T call(){
      try {
        try {
          final T res=firstCall.call();
          intermediateFuture.set(res);
        }
 catch (        Exception ex) {
          intermediateFuture.setException(ex);
          resultFuture.setException(ex);
        }
        Threads.lookup(Empyrean.class,Futures.class).submit(new Runnable(){
          @Override public void run(){
            try {
              intermediateFuture.get().get();
              try {
                T res2=secondCall.call();
                resultFuture.set(res2.get());
              }
 catch (              Exception ex) {
                resultFuture.setException(ex);
              }
            }
 catch (            InterruptedException ex) {
              LOG.error(ex);
              Thread.currentThread().interrupt();
              resultFuture.setException(ex);
            }
catch (            ExecutionException ex) {
              resultFuture.setException(ex.getCause());
            }
catch (            Exception ex) {
              resultFuture.setException(ex);
            }
          }
        }
);
      }
 catch (      Exception ex1) {
        resultFuture.setException(ex1);
      }
      return (T)resultFuture;
    }
  }
;
  return chainingCallable;
}

Fixed version (ground truth):
/** 
 * Returns a new   {@code Callable} which will execute {@code firstCall} and, if it succeeds, {@code secondCall} in sequence. The resulting {@code resultFuture}will return one of: <ol> <li>  {@link Future#get()} returns the result of {@code secondCall}'s future result.</li> <li>  {@link Future#get()} throws the exception which caused {@code firstCall} to fail -- in this case {@code secondCall} is not executed.</li><li> {@link Future#get()} throws the exception which caused {@code secondCall} to fail.</li></ol>
 * @param < P >
 * @param firstCall
 * @param secondCall
 * @return resultFuture
 */
public static <T extends ListenableFuture<V>,V>Callable<T> combine(final Callable<T> firstCall,final Callable<T> secondCall){
  final CheckedListenableFuture<V> resultFuture=Futures.newGenericeFuture();
  final CheckedListenableFuture<T> intermediateFuture=Futures.newGenericeFuture();
  final Callable<T> chainingCallable=new Callable<T>(){
    @Override public T call(){
      try {
        try {
          final T res=firstCall.call();
          intermediateFuture.set(res);
        }
 catch (        Exception ex) {
          resultFuture.setException(ex);
          intermediateFuture.setException(ex);
        }
        Threads.lookup(Empyrean.class,Futures.class).submit(new Runnable(){
          @Override public void run(){
            try {
              intermediateFuture.get().get();
              try {
                T res2=secondCall.call();
                resultFuture.set(res2.get());
              }
 catch (              Exception ex) {
                resultFuture.setException(ex);
              }
            }
 catch (            InterruptedException ex) {
              LOG.error(ex);
              Thread.currentThread().interrupt();
              resultFuture.setException(ex);
            }
catch (            ExecutionException ex) {
              resultFuture.setException(ex.getCause());
            }
catch (            Exception ex) {
              resultFuture.setException(ex);
            }
          }
        }
).get();
      }
 catch (      Exception ex1) {
        resultFuture.setException(ex1);
      }
      return (T)resultFuture;
    }
  }
;
  return chainingCallable;
}