Skip to content

Commit

Permalink
fix($MinIO): record -> class
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymillergh committed Apr 6, 2022
1 parent ed129b5 commit f593f94
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.jmsoftware.maf.springcloudstarter.minio;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Lists;
import io.minio.*;
import io.minio.http.Method;
import io.minio.messages.Bucket;
import io.minio.messages.DeleteObject;
import io.minio.messages.Item;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
Expand All @@ -30,12 +30,14 @@
**/
@Slf4j
@Validated
@SuppressWarnings("unused")
public record MinioHelper(MinioClient minioClient) {
@RequiredArgsConstructor
@SuppressWarnings({"unused", "ClassCanBeRecord"})
public class MinioHelper {
/**
* 7 days
*/
private static final int DEFAULT_EXPIRY_TIME = 7 * 24 * 3600;
private final MinioClient minioClient;

@SneakyThrows
public boolean bucketExists(@NotBlank String bucket) {
Expand Down Expand Up @@ -144,7 +146,7 @@ public GetObjectResponse getObject(@NotBlank String bucket, @NotBlank String obj
return null;
}
val statObjectResponse = this.statObject(bucket, object);
if (ObjectUtil.isNull(statObjectResponse) || statObjectResponse.size() == 0) {
if (statObjectResponse == null || statObjectResponse.size() == 0) {
return null;
}
return this.minioClient.getObject(GetObjectArgs.builder().bucket(bucket).object(object).build());
Expand All @@ -161,7 +163,7 @@ public GetObjectResponse getObject(
return null;
}
val statObjectResponse = this.statObject(bucket, object);
if (ObjectUtil.isNull(statObjectResponse) || statObjectResponse.size() == 0) {
if (statObjectResponse == null || statObjectResponse.size() == 0) {
return null;
}
return this.minioClient.getObject(
Expand Down

0 comments on commit f593f94

Please sign in to comment.