|
@@ -39,10 +39,6 @@ public class S3FileService extends AbstractFYunFileService {
|
|
|
return fYunFileConfig.getHost().concat(remoteFilePath);
|
|
|
} catch (Exception e) {
|
|
|
log.error("s3上传文件失败", e);
|
|
|
- } finally {
|
|
|
- if (s3 != null) {
|
|
|
- s3.shutdown();
|
|
|
- }
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
@@ -91,10 +87,6 @@ public class S3FileService extends AbstractFYunFileService {
|
|
|
} catch (Exception e) {
|
|
|
log.error("文件上传失败:{}",filePath);
|
|
|
e.printStackTrace();
|
|
|
- } finally {
|
|
|
- if ((ObjectUtils.isEmpty(shutdown) || shutdown) && !ObjectUtils.isEmpty(s3)) {
|
|
|
- s3.shutdown();
|
|
|
- }
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
@@ -123,10 +115,6 @@ public class S3FileService extends AbstractFYunFileService {
|
|
|
s3.deleteObject(bucket, remoteFilePath);
|
|
|
} catch (Exception e) {
|
|
|
log.error("s3删除文件失败,key=" + remoteFilePath, e);
|
|
|
- } finally {
|
|
|
- if (s3 != null) {
|
|
|
- s3.shutdown();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -157,10 +145,6 @@ public class S3FileService extends AbstractFYunFileService {
|
|
|
} while (objectListing.isTruncated());
|
|
|
} catch (Exception e) {
|
|
|
log.error("删除was文件失败,path=" + remoteFolderPath, e);
|
|
|
- } finally {
|
|
|
- if (s3 != null) {
|
|
|
- s3.shutdown();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -172,10 +156,6 @@ public class S3FileService extends AbstractFYunFileService {
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("OSS批量上传文件失败!");
|
|
|
- } finally {
|
|
|
- if (!ObjectUtils.isEmpty(s3)) {
|
|
|
- s3.shutdown();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -208,10 +188,6 @@ public class S3FileService extends AbstractFYunFileService {
|
|
|
} catch (Exception e) {
|
|
|
log.error("获取文件列表失败,path=" + sourcePath, e);
|
|
|
e.printStackTrace();
|
|
|
- } finally {
|
|
|
- if ((ObjectUtils.isEmpty(shutdown) || shutdown) && !ObjectUtils.isEmpty(s3)) {
|
|
|
- s3.shutdown();
|
|
|
- }
|
|
|
}
|
|
|
return keyList;
|
|
|
}
|
|
@@ -234,10 +210,6 @@ public class S3FileService extends AbstractFYunFileService {
|
|
|
});
|
|
|
} catch (Exception e) {
|
|
|
log.error("列举文件目录失败,key=" + sourcePath);
|
|
|
- } finally {
|
|
|
- if ((ObjectUtils.isEmpty(shutdown) || shutdown) && !ObjectUtils.isEmpty(s3)) {
|
|
|
- s3.shutdown();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -252,10 +224,6 @@ public class S3FileService extends AbstractFYunFileService {
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("批量复制文件失败!");
|
|
|
- } finally {
|
|
|
- if (!ObjectUtils.isEmpty(s3)) {
|
|
|
- s3.shutdown();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -275,14 +243,11 @@ public class S3FileService extends AbstractFYunFileService {
|
|
|
} catch (IOException e) {
|
|
|
log.error("读取aws文件流失败", e);
|
|
|
}
|
|
|
+ object.close();
|
|
|
return content.toString();
|
|
|
} catch (Exception e) {
|
|
|
log.error("获取文件内容失败:{}", remoteFilePath);
|
|
|
return null;
|
|
|
- } finally {
|
|
|
- if (!ObjectUtils.isEmpty(s3)) {
|
|
|
- s3.shutdown();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -293,10 +258,6 @@ public class S3FileService extends AbstractFYunFileService {
|
|
|
} catch (Exception e) {
|
|
|
log.error("判断文件是否存在失败:{}", objectName);
|
|
|
return false;
|
|
|
- } finally {
|
|
|
- if (!ObjectUtils.isEmpty(s3)) {
|
|
|
- s3.shutdown();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -312,10 +273,6 @@ public class S3FileService extends AbstractFYunFileService {
|
|
|
} catch (Throwable throwable) {
|
|
|
log.error("文件下载失败:{}", remoteFilePath);
|
|
|
throwable.printStackTrace();
|
|
|
- } finally {
|
|
|
- if (!ObjectUtils.isEmpty(s3)) {
|
|
|
- s3.shutdown();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|