chore: upgrade gradle and dependencies. (#688)

pull/691/head
Ryan Wang 2020-03-17 23:56:24 +08:00 committed by GitHub
parent d4cfc3ae7f
commit fc989c965c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 133 additions and 111 deletions

View File

@ -1,17 +1,15 @@
plugins { plugins {
id 'org.springframework.boot' version '2.2.2.RELEASE' id 'org.springframework.boot' version '2.2.5.RELEASE'
id "io.freefair.lombok" version "3.6.6" id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'checkstyle' id 'checkstyle'
id 'java' id 'java'
} }
apply plugin: 'io.spring.dependency-management'
group = 'run.halo.app' group = 'run.halo.app'
archivesBaseName = 'halo' archivesBaseName = 'halo'
version = '1.3.0-beta.2' version = '1.3.0-beta.2'
sourceCompatibility = '1.8' sourceCompatibility = '1.8'
description = 'Halo, personal blog system developed in Java.' description = 'Halo, An excellent open source blog publishing application.'
repositories { repositories {
maven { maven {
@ -32,36 +30,39 @@ configurations {
runtimeClasspath { runtimeClasspath {
extendsFrom developmentOnly extendsFrom developmentOnly
} }
compileOnly {
extendsFrom annotationProcessor
}
} }
bootJar { bootJar {
manifest { manifest {
attributes('Implementation-Title': 'Halo Application', attributes('Implementation-Title': 'Halo Application',
'Implementation-Version': version) 'Implementation-Version': archiveVersion)
} }
} }
ext { ext {
hutoolVersion = '5.0.3' set('hutoolVersion', "5.2.3")
upyunSdkVersion = '4.0.1' set('upyunSdkVersion', "4.2.0")
qiniuSdkVersion = '7.2.18' set('qiniuSdkVersion', "7.2.28")
aliyunSdkVersion = '3.4.2' set('aliyunSdkVersion', "3.8.1")
baiduSdkVersion = '0.10.36' set('baiduSdkVersion', "0.10.36")
qcloudSdkVersion = '5.5.7' set('qcloudSdkVersion', "5.6.18")
swaggerVersion = '2.9.2' set('swaggerVersion', "2.9.2")
commonsLangVersion = '3.8.1' set('commonsLangVersion', "3.9")
httpclientVersion = '4.5.7' set('httpclientVersion', "4.5.12")
dataformatYamlVersion = '2.9.2' set('dataformatYamlVersion', "2.10.3")
jgitVersion = '5.3.0.201903130848-r' set('jgitVersion', "5.7.0.202003110725-r")
flexmarkVersion = '0.42.12' set('flexmarkVersion', "0.42.12")
thumbnailatorVersion = '0.4.8' set('thumbnailatorVersion', "0.4.11")
image4jVersion = '0.7zensight1' set('image4jVersion', "0.7zensight1")
flywayVersion = '6.1.0' set('flywayVersion', "6.3.1")
h2Version = '1.4.196' set('h2Version', "1.4.196")
levelDbVersion = '0.12' set('levelDbVersion', "0.12")
jsonVersion = '20190722' set('jsonVersion', "20190722")
fastJsonVersion = '1.2.56' set('fastJsonVersion', "1.2.66")
templateInheritance = "0.4.RELEASE"
} }
dependencies { dependencies {
@ -70,55 +71,57 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-undertow' implementation 'org.springframework.boot:spring-boot-starter-undertow'
implementation 'org.springframework.boot:spring-boot-starter-freemarker' implementation 'org.springframework.boot:spring-boot-starter-freemarker'
implementation "kr.pe.kwonnam.freemarker:freemarker-template-inheritance:$templateInheritance"
implementation "com.sun.mail:jakarta.mail" implementation "com.sun.mail:jakarta.mail"
implementation "cn.hutool:hutool-core:$hutoolVersion" implementation "cn.hutool:hutool-core:${hutoolVersion}"
implementation "cn.hutool:hutool-crypto:$hutoolVersion" implementation "cn.hutool:hutool-crypto:${hutoolVersion}"
implementation "cn.hutool:hutool-extra:$hutoolVersion" implementation "cn.hutool:hutool-extra:${hutoolVersion}"
implementation "com.upyun:java-sdk:$upyunSdkVersion" implementation "com.upyun:java-sdk:${upyunSdkVersion}"
implementation "com.qiniu:qiniu-java-sdk:$qiniuSdkVersion" implementation "com.qiniu:qiniu-java-sdk:${qiniuSdkVersion}"
implementation "com.aliyun.oss:aliyun-sdk-oss:$aliyunSdkVersion" implementation "com.aliyun.oss:aliyun-sdk-oss:${aliyunSdkVersion}"
implementation "com.baidubce:bce-java-sdk:$baiduSdkVersion" implementation "com.baidubce:bce-java-sdk:${baiduSdkVersion}"
implementation "com.qcloud:cos_api:$qcloudSdkVersion" implementation "com.qcloud:cos_api:${qcloudSdkVersion}"
implementation "io.springfox:springfox-swagger2:$swaggerVersion" implementation "io.springfox:springfox-swagger2:${swaggerVersion}"
implementation "io.springfox:springfox-swagger-ui:$swaggerVersion" implementation "io.springfox:springfox-swagger-ui:${swaggerVersion}"
implementation "org.apache.commons:commons-lang3:$commonsLangVersion" implementation "org.apache.commons:commons-lang3:${commonsLangVersion}"
implementation "org.apache.httpcomponents:httpclient:$httpclientVersion" implementation "org.apache.httpcomponents:httpclient:${httpclientVersion}"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$dataformatYamlVersion" implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${dataformatYamlVersion}"
implementation "org.eclipse.jgit:org.eclipse.jgit:$jgitVersion" implementation "org.eclipse.jgit:org.eclipse.jgit:${jgitVersion}"
implementation "com.vladsch.flexmark:flexmark:$flexmarkVersion" implementation "com.vladsch.flexmark:flexmark:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-attributes:$flexmarkVersion" implementation "com.vladsch.flexmark:flexmark-ext-attributes:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-autolink:$flexmarkVersion" implementation "com.vladsch.flexmark:flexmark-ext-autolink:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-emoji:$flexmarkVersion" implementation "com.vladsch.flexmark:flexmark-ext-emoji:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-escaped-character:$flexmarkVersion" implementation "com.vladsch.flexmark:flexmark-ext-escaped-character:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:$flexmarkVersion" implementation "com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-gfm-tasklist:$flexmarkVersion" implementation "com.vladsch.flexmark:flexmark-ext-gfm-tasklist:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-ins:$flexmarkVersion" implementation "com.vladsch.flexmark:flexmark-ext-ins:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-media-tags:$flexmarkVersion" implementation "com.vladsch.flexmark:flexmark-ext-media-tags:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-tables:$flexmarkVersion" implementation "com.vladsch.flexmark:flexmark-ext-tables:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-toc:$flexmarkVersion" implementation "com.vladsch.flexmark:flexmark-ext-toc:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-yaml-front-matter:$flexmarkVersion" implementation "com.vladsch.flexmark:flexmark-ext-yaml-front-matter:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-gitlab:$flexmarkVersion" implementation "com.vladsch.flexmark:flexmark-ext-gitlab:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-html-parser:$flexmarkVersion" implementation "com.vladsch.flexmark:flexmark-html-parser:${flexmarkVersion}"
implementation "net.coobird:thumbnailator:$thumbnailatorVersion" implementation "net.coobird:thumbnailator:${thumbnailatorVersion}"
implementation "net.sf.image4j:image4j:$image4jVersion" implementation "net.sf.image4j:image4j:${image4jVersion}"
implementation "org.flywaydb:flyway-core:$flywayVersion" implementation "org.flywaydb:flyway-core:${flywayVersion}"
implementation "org.json:json:$jsonVersion" implementation "org.json:json:${jsonVersion}"
implementation "com.alibaba:fastjson:$fastJsonVersion" implementation "com.alibaba:fastjson:${fastJsonVersion}"
implementation "org.iq80.leveldb:leveldb:$levelDbVersion" implementation "org.iq80.leveldb:leveldb:${levelDbVersion}"
runtimeOnly "com.h2database:h2:$h2Version" runtimeOnly "com.h2database:h2:${h2Version}"
runtimeOnly 'mysql:mysql-connector-java' runtimeOnly 'mysql:mysql-connector-java'
compileOnly 'org.projectlombok:lombok' compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-starter-test'
developmentOnly 'org.springframework.boot:spring-boot-devtools' developmentOnly 'org.springframework.boot:spring-boot-devtools'
} }

Binary file not shown.

View File

@ -1,6 +1,5 @@
#Mon Sep 09 12:27:59 CST 2019
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip

22
gradlew vendored
View File

@ -1,5 +1,21 @@
#!/usr/bin/env sh #!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
############################################################################## ##############################################################################
## ##
## Gradle start up script for UN*X ## Gradle start up script for UN*X
@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD="maximum"
@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi fi
# For Cygwin, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if $cygwin ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`

18
gradlew.bat vendored
View File

@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome

View File

@ -1,2 +0,0 @@
# This file is generated by the 'io.freefair.lombok' Gradle plugin
config.stopBubbling = true

View File

@ -4,10 +4,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import freemarker.core.TemplateClassResolver; import freemarker.core.TemplateClassResolver;
import freemarker.template.TemplateException; import freemarker.template.TemplateException;
import freemarker.template.TemplateExceptionHandler; import freemarker.template.TemplateExceptionHandler;
import freemarker.template.TemplateModel;
import kr.pe.kwonnam.freemarker.inheritance.BlockDirective;
import kr.pe.kwonnam.freemarker.inheritance.ExtendsDirective;
import kr.pe.kwonnam.freemarker.inheritance.PutDirective;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.jackson.JsonComponentModule; import org.springframework.boot.jackson.JsonComponentModule;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -39,7 +35,10 @@ import run.halo.app.security.resolver.AuthenticationArgumentResolver;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.HashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import static run.halo.app.model.support.HaloConst.FILE_SEPARATOR; import static run.halo.app.model.support.HaloConst.FILE_SEPARATOR;
import static run.halo.app.utils.HaloUtils.*; import static run.halo.app.utils.HaloUtils.*;
@ -135,16 +134,6 @@ public class WebMvcAutoConfiguration extends WebMvcConfigurationSupport {
registry.addConverterFactory(new StringToEnumConverterFactory()); registry.addConverterFactory(new StringToEnumConverterFactory());
} }
@Bean
public Map<String, TemplateModel> freemarkerLayoutDirectives() {
Map<String, TemplateModel> freemarkerLayoutDirectives = new HashMap<>(5);
freemarkerLayoutDirectives.put("extends", new ExtendsDirective());
freemarkerLayoutDirectives.put("block", new BlockDirective());
freemarkerLayoutDirectives.put("put", new PutDirective());
return freemarkerLayoutDirectives;
}
/** /**
* Configuring freemarker template file path. * Configuring freemarker template file path.
* *
@ -173,13 +162,6 @@ public class WebMvcAutoConfiguration extends WebMvcConfigurationSupport {
// Set predefined freemarker configuration // Set predefined freemarker configuration
configurer.setConfiguration(configuration); configurer.setConfiguration(configuration);
// Set layout variable
Map<String, Object> freemarkerVariables = new HashMap<>(3);
freemarkerVariables.put("layout", freemarkerLayoutDirectives());
configurer.setFreemarkerVariables(freemarkerVariables);
return configurer; return configurer;
} }

View File

@ -107,6 +107,7 @@ public class AliOssFileHandler implements FileHandler {
// Handle thumbnail // Handle thumbnail
if (FileHandler.isImageType(uploadResult.getMediaType())) { if (FileHandler.isImageType(uploadResult.getMediaType())) {
ImageReader image = ImageUtils.getImageReaderFromFile(file.getInputStream(), extension); ImageReader image = ImageUtils.getImageReaderFromFile(file.getInputStream(), extension);
assert image != null;
uploadResult.setWidth(image.getWidth(0)); uploadResult.setWidth(image.getWidth(0));
uploadResult.setHeight(image.getHeight(0)); uploadResult.setHeight(image.getHeight(0));
if (ImageUtils.EXTENSION_ICO.equals(extension)) { if (ImageUtils.EXTENSION_ICO.equals(extension)) {

View File

@ -88,6 +88,7 @@ public class BaiduBosFileHandler implements FileHandler {
// Handle thumbnail // Handle thumbnail
if (FileHandler.isImageType(uploadResult.getMediaType())) { if (FileHandler.isImageType(uploadResult.getMediaType())) {
ImageReader image = ImageUtils.getImageReaderFromFile(file.getInputStream(), extension); ImageReader image = ImageUtils.getImageReaderFromFile(file.getInputStream(), extension);
assert image != null;
uploadResult.setWidth(image.getWidth(0)); uploadResult.setWidth(image.getWidth(0));
uploadResult.setHeight(image.getHeight(0)); uploadResult.setHeight(image.getHeight(0));
if (ImageUtils.EXTENSION_ICO.equals(extension)) { if (ImageUtils.EXTENSION_ICO.equals(extension)) {

View File

@ -119,6 +119,7 @@ public class TencentCosFileHandler implements FileHandler {
// Handle thumbnail // Handle thumbnail
if (FileHandler.isImageType(uploadResult.getMediaType())) { if (FileHandler.isImageType(uploadResult.getMediaType())) {
ImageReader image = ImageUtils.getImageReaderFromFile(file.getInputStream(), extension); ImageReader image = ImageUtils.getImageReaderFromFile(file.getInputStream(), extension);
assert image != null;
uploadResult.setWidth(image.getWidth(0)); uploadResult.setWidth(image.getWidth(0));
uploadResult.setHeight(image.getHeight(0)); uploadResult.setHeight(image.getHeight(0));
if (ImageUtils.EXTENSION_ICO.equals(extension)) { if (ImageUtils.EXTENSION_ICO.equals(extension)) {

View File

@ -1,7 +1,9 @@
package run.halo.app.handler.file; package run.halo.app.handler.file;
import com.UpYun; import com.upyun.RestManager;
import com.upyun.UpException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import okhttp3.Response;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -17,6 +19,9 @@ import run.halo.app.utils.FilenameUtils;
import run.halo.app.utils.ImageUtils; import run.halo.app.utils.ImageUtils;
import javax.imageio.ImageReader; import javax.imageio.ImageReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
/** /**
@ -50,11 +55,11 @@ public class UpOssFileHandler implements FileHandler {
String styleRule = optionService.getByPropertyOrDefault(UpOssProperties.OSS_STYLE_RULE, String.class, ""); String styleRule = optionService.getByPropertyOrDefault(UpOssProperties.OSS_STYLE_RULE, String.class, "");
String thumbnailStyleRule = optionService.getByPropertyOrDefault(UpOssProperties.OSS_THUMBNAIL_STYLE_RULE, String.class, ""); String thumbnailStyleRule = optionService.getByPropertyOrDefault(UpOssProperties.OSS_THUMBNAIL_STYLE_RULE, String.class, "");
// Create up yun RestManager manager = new RestManager(bucket, operator, password);
UpYun upYun = new UpYun(bucket, operator, password); manager.setTimeout(60 * 10);
upYun.setDebug(log.isDebugEnabled()); manager.setApiDomain(RestManager.ED_AUTO);
upYun.setTimeout(60);
upYun.setApiDomain(UpYun.ED_AUTO); Map<String, String> params = new HashMap<>();
try { try {
// Get file basename // Get file basename
@ -66,10 +71,10 @@ public class UpOssFileHandler implements FileHandler {
// Build file path // Build file path
String upFilePath = StringUtils.appendIfMissing(source, "/") + md5OfFile + '.' + extension; String upFilePath = StringUtils.appendIfMissing(source, "/") + md5OfFile + '.' + extension;
// Set md5Content // Set md5Content
upYun.setContentMD5(md5OfFile); params.put(RestManager.PARAMS.CONTENT_MD5.getValue(), md5OfFile);
// Write file // Write file
boolean uploadSuccess = upYun.writeFile(upFilePath, file.getInputStream(), true, null); Response result = manager.writeFile(upFilePath, file.getInputStream(), params);
if (!uploadSuccess) { if (!result.isSuccessful()) {
throw new FileOperationException("上传附件 " + file.getOriginalFilename() + " 到又拍云失败" + upFilePath); throw new FileOperationException("上传附件 " + file.getOriginalFilename() + " 到又拍云失败" + upFilePath);
} }
@ -87,6 +92,7 @@ public class UpOssFileHandler implements FileHandler {
// Handle thumbnail // Handle thumbnail
if (FileHandler.isImageType(uploadResult.getMediaType())) { if (FileHandler.isImageType(uploadResult.getMediaType())) {
ImageReader image = ImageUtils.getImageReaderFromFile(file.getInputStream(), extension); ImageReader image = ImageUtils.getImageReaderFromFile(file.getInputStream(), extension);
assert image != null;
uploadResult.setWidth(image.getWidth(0)); uploadResult.setWidth(image.getWidth(0));
uploadResult.setHeight(image.getHeight(0)); uploadResult.setHeight(image.getHeight(0));
if (ImageUtils.EXTENSION_ICO.equals(extension)) { if (ImageUtils.EXTENSION_ICO.equals(extension)) {
@ -111,18 +117,17 @@ public class UpOssFileHandler implements FileHandler {
String bucket = optionService.getByPropertyOfNonNull(UpOssProperties.OSS_BUCKET).toString(); String bucket = optionService.getByPropertyOfNonNull(UpOssProperties.OSS_BUCKET).toString();
String operator = optionService.getByPropertyOfNonNull(UpOssProperties.OSS_OPERATOR).toString(); String operator = optionService.getByPropertyOfNonNull(UpOssProperties.OSS_OPERATOR).toString();
// Create up yun RestManager manager = new RestManager(bucket, operator, password);
UpYun upYun = new UpYun(bucket, operator, password); manager.setTimeout(60 * 10);
// Set api domain with ED_AUTO manager.setApiDomain(RestManager.ED_AUTO);
upYun.setApiDomain(UpYun.ED_AUTO);
try { try {
// Delete the file Response result = manager.deleteFile(key, null);
boolean deleteResult = upYun.deleteFile(key); if (!result.isSuccessful()) {
if (!deleteResult) { log.warn("附件 " + key + " 从又拍云删除失败");
log.warn("Failed to delete file " + key + " from UpYun");
} }
} catch (Exception e) { } catch (IOException | UpException e) {
e.printStackTrace();
throw new FileOperationException("附件 " + key + " 从又拍云删除失败", e); throw new FileOperationException("附件 " + key + " 从又拍云删除失败", e);
} }
} }