update 优化 去除桶检测 桶不存在自然会报错无需额外检测

dev
疯狂的狮子Li 1 year ago
parent dabf8e91b7
commit 612fed0428

@ -113,7 +113,6 @@ public class OssClient {
.serviceConfiguration(config)
.build();
checkBucket();
} catch (Exception e) {
if (e instanceof OssException) {
throw e;
@ -122,25 +121,6 @@ public class OssClient {
}
}
/**
*
*
* @throws OssException
*/
public void checkBucket() {
String bucketName = properties.getBucketName();
try {
// 尝试获取存储桶的信息
client.headBucket(x -> x.bucket(bucketName).build()).join();
} catch (Exception ex) {
if (ex.getCause() instanceof NoSuchBucketException) {
throw new OssException("Bucket桶是不存在的请核对配置信息:[" + ex.getMessage() + "]");
} else {
throw new OssException("判断Bucket是否存在失败请核对配置信息:[" + ex.getMessage() + "]");
}
}
}
/**
* Amazon S3
*

Loading…
Cancel
Save