Program: 15451
Project: 15451
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();
          res.get();
          intermediateFuture.set(res);
        }
 catch (        Exception ex) {
          LOG.error(ex,ex);
          intermediateFuture.setException(ex);
          resultFuture.setException(ex);
        }
        Threads.lookup(Empyrean.class,Futures.class).submit(new Runnable(){
          @Override public void run(){
            try {
              intermediateFuture.get().get();
            }
 catch (            InterruptedException ex) {
              LOG.error(ex);
              Thread.currentThread().interrupt();
            }
catch (            ExecutionException ex) {
              LOG.error(ex,ex);
            }
catch (            Exception ex) {
              LOG.error(ex,ex);
            }
            try {
              T res2=secondCall.call();
              resultFuture.set(res2.get());
            }
 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();
          res.get();
          intermediateFuture.set(res);
        }
 catch (        Exception ex) {
          LOG.error(ex,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) {
              LOG.error(ex,ex);
              resultFuture.setException(ex);
            }
catch (            Exception ex) {
              LOG.error(ex,ex);
              resultFuture.setException(ex);
            }
          }
        }
);
      }
 catch (      Exception ex1) {
        resultFuture.setException(ex1);
      }
      return (T)resultFuture;
    }
  }
;
  return chainingCallable;
}