From fa859723b582b398666abe6df10c24470a25dbc9 Mon Sep 17 00:00:00 2001 From: lengleng Date: Sun, 28 Feb 2021 22:26:41 +0800 Subject: [PATCH] =?UTF-8?q?:arrow=5Fdown:=20Downgrading=20dependencies.=20?= =?UTF-8?q?|=202.3.1=20=E9=81=BF=E5=85=8D=202.4.0=20=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=B8=8D=E5=87=86=E7=A1=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pigx/common/oss/service/OssTemplate.java | 29 +++++++++++++------ pom.xml | 2 +- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/service/OssTemplate.java b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/service/OssTemplate.java index f3fb08030..419c8c27f 100755 --- a/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/service/OssTemplate.java +++ b/pigx-common/pigx-common-oss/src/main/java/com/pig4cloud/pigx/common/oss/service/OssTemplate.java @@ -17,6 +17,16 @@ package com.pig4cloud.pigx.common.oss.service; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.List; +import java.util.Optional; + import com.amazonaws.ClientConfiguration; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.AWSCredentialsProvider; @@ -25,18 +35,19 @@ import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.client.builder.AwsClientBuilder; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3Client; -import com.amazonaws.services.s3.model.*; +import com.amazonaws.services.s3.model.Bucket; +import com.amazonaws.services.s3.model.ObjectListing; +import com.amazonaws.services.s3.model.ObjectMetadata; +import com.amazonaws.services.s3.model.PutObjectResult; +import com.amazonaws.services.s3.model.S3Object; +import com.amazonaws.services.s3.model.S3ObjectSummary; import com.amazonaws.util.IOUtils; import com.pig4cloud.pigx.common.oss.OssProperties; +import lombok.Cleanup; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; import org.springframework.beans.factory.InitializingBean; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.net.URL; -import java.util.*; - /** * aws-s3 通用存储操作 支持所有兼容s3协议的云存储: {阿里云OSS,腾讯云COS,七牛云,京东云,minio 等} * @@ -181,12 +192,12 @@ public class OssTemplate implements InitializingBean { * 获取文件信息 * @param bucketName bucket名称 * @param objectName 文件名称 - * @throws Exception * @see AWS * API Documentation */ - public S3Object getObjectInfo(String bucketName, String objectName) throws Exception { - return amazonS3.getObject(bucketName, objectName); + public S3Object getObjectInfo(String bucketName, String objectName) throws Exception{ + @Cleanup S3Object object = amazonS3.getObject(bucketName, objectName); + return object; } /** diff --git a/pom.xml b/pom.xml index 33527c61a..c0c078f09 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,7 @@ 3.8.1 0.0.23 2.2.5 - 2.4.0 + 2.3.1 5.5.8 1.2.7 3.0.0