From 2697d6a4fbdc9d9d6f739badcaecca90e666dd99 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 8 Nov 2018 22:15:21 -0800 Subject: [PATCH] fix deleting bucket --- .../copier/src/main/java/com/seaweedfs/s3/PutObject.java | 7 +++++++ weed/storage/volume_read_write.go | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/other/java/s3copy/copier/src/main/java/com/seaweedfs/s3/PutObject.java b/other/java/s3copy/copier/src/main/java/com/seaweedfs/s3/PutObject.java index 9095cd739..c310f0162 100644 --- a/other/java/s3copy/copier/src/main/java/com/seaweedfs/s3/PutObject.java +++ b/other/java/s3copy/copier/src/main/java/com/seaweedfs/s3/PutObject.java @@ -79,6 +79,13 @@ public class PutObject { // test deletes s3Client.deleteObject(bucketName, stringObjKeyName); + + // delete bucket + String tmpBucket = "tmpbucket"; + s3Client.createBucket(tmpBucket); + s3Client.putObject(tmpBucket, stringObjKeyName, stringContent); + s3Client.deleteBucket(tmpBucket); + } catch (AmazonServiceException e) { // The call was transmitted successfully, but Amazon S3 couldn't process // it, so it returned an error response. diff --git a/weed/storage/volume_read_write.go b/weed/storage/volume_read_write.go index 7644ec7fd..f68f6b559 100644 --- a/weed/storage/volume_read_write.go +++ b/weed/storage/volume_read_write.go @@ -42,7 +42,9 @@ func (v *Volume) Destroy() (err error) { } v.Close() os.Remove(v.FileName() + ".dat") - err = v.nm.Destroy() + if v.nm!=nil{ + err = v.nm.Destroy() + } os.Remove(v.FileName() + ".cpd") os.Remove(v.FileName() + ".cpx") os.Remove(v.FileName() + ".ldb")