|
@@ -41,8 +41,12 @@ public class DownloadUtil {
|
|
|
file.getParentFile().mkdirs();
|
|
|
}
|
|
|
try {
|
|
|
- HttpUtil.downloadFileFromUrl(url,path);
|
|
|
- if(FileUtil.size(new File(path)) == 0){
|
|
|
+ try {
|
|
|
+ HttpUtil.downloadFileFromUrl(url,path);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("下载失败,url:{}, path:{}", url, path, e);
|
|
|
+ }
|
|
|
+ if(!FileUtil.exist(path) || FileUtil.size(new File(path)) == 0){
|
|
|
while (index<=50){
|
|
|
index++;
|
|
|
HttpUtil.downloadFileFromUrl(url,path);
|
|
@@ -58,6 +62,7 @@ public class DownloadUtil {
|
|
|
log.info("文件第{}次下载成功:{}", index, path);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
+ log.error("下载报错停止,url:{}, path:{}", url, path, e);
|
|
|
throw new BusinessException(-1,"下载报错停止,"+url+","+path);
|
|
|
}
|
|
|
}
|