diff --git a/components/nexus-repository/src/main/java/org/sonatype/nexus/repository/internal/blobstore/BlobStoreManagerImpl.java b/components/nexus-repository/src/main/java/org/sonatype/nexus/repository/internal/blobstore/BlobStoreManagerImpl.java index 8e3783f12c..0ec4c5e7bc 100644 --- a/components/nexus-repository/src/main/java/org/sonatype/nexus/repository/internal/blobstore/BlobStoreManagerImpl.java +++ b/components/nexus-repository/src/main/java/org/sonatype/nexus/repository/internal/blobstore/BlobStoreManagerImpl.java @@ -52,6 +52,7 @@ import static com.google.common.base.Preconditions.checkState; import static java.util.Optional.empty; import static org.sonatype.nexus.common.stateguard.StateGuardLifecycleSupport.State.STARTED; +import static org.sonatype.nexus.common.stateguard.StateGuardLifecycleSupport.State.FAILED; /** * Default {@link BlobStoreManager} implementation. @@ -265,7 +266,7 @@ public BlobStore get(final String name) { } @Override - @Guarded(by = STARTED) + @Guarded(by = { STARTED, FAILED }) public void delete(final String name) throws Exception { checkNotNull(name); if (!repositoryManagerProvider.get().isBlobstoreUsed(name)) { @@ -277,7 +278,7 @@ public void delete(final String name) throws Exception { } @Override - @Guarded(by = STARTED) + @Guarded(by = { STARTED, FAILED }) public void forceDelete(final String name) throws Exception { checkNotNull(name); databaseFreezeService.checkUnfrozen("Unable to delete a BlobStore while database is frozen."); diff --git a/plugins/nexus-blobstore-s3/src/main/java/org/sonatype/nexus/blobstore/s3/internal/S3BlobStore.java b/plugins/nexus-blobstore-s3/src/main/java/org/sonatype/nexus/blobstore/s3/internal/S3BlobStore.java index 6f9554ee98..67b69be176 100644 --- a/plugins/nexus-blobstore-s3/src/main/java/org/sonatype/nexus/blobstore/s3/internal/S3BlobStore.java +++ b/plugins/nexus-blobstore-s3/src/main/java/org/sonatype/nexus/blobstore/s3/internal/S3BlobStore.java @@ -531,6 +531,8 @@ public void remove() { catch (AmazonS3Exception s3Exception) { if ("BucketNotEmpty".equals(s3Exception.getErrorCode())) { log.warn("Unable to delete non-empty blob store bucket {}", getConfiguredBucket()); + } else if ("ExpiredToken".equals(s3Exception.getErrorCode())) { + log.warn("Unable to delete blob store bucket {}. Token expired.", getConfiguredBucket()); } else { throw new BlobStoreException(s3Exception, null);