[英]AWS S3 deleteMarker() retrun null
I'm using the AWS SDK for Kotlin with Spring.我在 Spring 中使用了适用于 Kotlin 的 AWS 开发工具包。 I set dependencies two AWS SDKs.
我设置了两个 AWS SDK 的依赖项。 I made remove function.
我做了删除功能。 That ran wrong return value.
那运行错误的返回值。 Firstly, I remove file to use deleteObject.
首先,我删除文件以使用 deleteObject。 Secondly, It checked that is removed to use deleteMarker().
其次,它检查删除使用deleteMarker()。 deleteMarker function return type is boolean.
deleteMarker 函数返回类型是布尔值。 And then delete function ran after, I checked AWS S3 for checked removing file.
然后运行删除功能,我检查了 AWS S3 以检查删除文件。 It was run correctly.
它运行正确。 But, It returned null.
但是,它返回空值。
implementation("software.amazon.awssdk:s3:2.14.0") // Amazon S3
implementation("software.amazon.awssdk:aws-sdk-java:2.14.0") // Amazon All service
fun remove(path : String): Boolean {
val result = s3.deleteObject(
DeleteObjectRequest.builder().bucket(bucket.name()).key(path).build()
)
logger.info("remove in bucket : $path - ${result.deleteMarker()}")
return result.deleteMarker()
}
/* error message and log */
/*
remove in bucket : 27313e6a7307240ab190d805cc5ddd72fb24458f6b96b84616babdc85a691a30 - null
java.lang.IllegalStateException: result.deleteMarker() must not be null
at com.hanmedia.server.service.AwsService.remove(AwsService.kt:59) ~[main/:na]
*/
A delete marker will only be present if you are dealing with versioned buckets.只有在处理版本化存储桶时才会出现删除标记。 Seems like you have a "normal" bucket in which case there are no delete markers, an object is simply there or it isn't.
似乎您有一个“普通”存储桶,在这种情况下没有删除标记,对象只是存在或不存在。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.