Github user wilderrodrigues commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1083#discussion_r45335913
  
    --- Diff: core/src/com/cloud/storage/template/S3TemplateDownloader.java ---
    @@ -342,47 +274,38 @@ public InputStream getS3ObjectInputStream() {
                 return null;
             }
     
    -        return S3Utils.getObjectStream(s3to, s3to.getBucketName(), s3Key);
    +        return S3Utils.getObjectStream(s3TO, s3TO.getBucketName(), s3Key);
         }
     
         public void cleanupAfterError() {
    -        if (status != Status.UNRECOVERABLE_ERROR) {
    -            s_logger.debug("S3Template downloader does not have state 
UNRECOVERABLE_ERROR, no cleanup neccesarry.");
    -            return;
    -        }
    -
    -        s_logger.info("Cleanup after UNRECOVERABLE_ERROR, trying to remove 
object: " + s3Key);
    +        LOGGER.warn("Cleanup after error, trying to remove object: " + 
s3Key);
     
    -        S3Utils.deleteObject(s3to, s3to.getBucketName(), s3Key);
    +        S3Utils.deleteObject(s3TO, s3TO.getBucketName(), s3Key);
         }
     
         @Override
    -    @SuppressWarnings("fallthrough")
         public boolean stopDownload() {
    -        switch (getStatus()) {
    -        case IN_PROGRESS:
    -            if (request != null) {
    -                request.abort();
    -            }
    -            status = TemplateDownloader.Status.ABORTED;
    -            return true;
    -        case UNKNOWN:
    -        case NOT_STARTED:
    -        case RECOVERABLE_ERROR:
    -        case UNRECOVERABLE_ERROR:
    -        case ABORTED:
    -            status = TemplateDownloader.Status.ABORTED;
    -        case DOWNLOAD_FINISHED:
    -            try {
    -                S3Utils.deleteObject(s3to, s3to.getBucketName(), s3Key);
    -            } catch (Exception ex) {
    -                // ignore delete exception if it is not there
    -            }
    -            return true;
    -
    -        default:
    -            return true;
    +        switch (status) {
    --- End diff --
    
    Same here: let's refactor this in the a second round. Now we can merge, but 
let's improve. :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to