code: public AmazonClientException waitForException() throws InterruptedException {
          try {
  
              /**
               * Do not remove the while loop. We need this as the future returned by
               * monitor.getFuture() is set two times during the upload and copy operations.
               */
              while (!monitor.isDone()) {
                  monitor.getFuture().get();
              }
              monitor.getFuture().get();
              return null;
          } catch (ExecutionException e) {
              return unwrapExecutionException(e);
          }
      }
docs: Waits for this transfer to finish and returns any error that occurred, or
  returns <code>null</code> if no errors occurred.
  This is a blocking call; the current thread
  will be suspended until this transfer either fails or completes
  successfully.
  
  @return Any error that occurred while processing this transfer.
  Otherwise returns <code>null</code> if no errors occurred.
  
  @throws InterruptedException
  If this thread is interrupted while waiting for the transfer
  to complete.