xiatian 5 лет назад
Родитель
Сommit
3af70eed91

+ 7 - 3
src/main/java/cn/com/qmth/examcloud/web/filestorage/FileStorageUtil.java

@@ -198,7 +198,7 @@ public class FileStorageUtil {
 	 * @param localFilePath 例如D:/123.txt
 	 * @throws IOException
 	 */
-	public static void saveUrlAs(String fileUrl, String localFilePath) throws IOException {
+	private static void saveUrlAs(String fileUrl, String localFilePath) throws IOException {
 		URL url = new URL(fileUrl);
 
 		HttpURLConnection connection;
@@ -226,8 +226,12 @@ public class FileStorageUtil {
 	 * @param localFile  本地文件对象
 	 * @throws IOException
 	 */
-	public static void saveUrlAs(String fileUrl, File localFile) throws IOException {
-		saveUrlAs(fileUrl, localFile.getAbsoluteFile());
+	public static void saveUrlAs(String fileUrl, File localFile)  {
+		try {
+			saveUrlAs(fileUrl, localFile.getAbsolutePath());
+		} catch (IOException e) {
+			throw new StatusException("1001", "下载文件出错",e);
+		}
 	}
 
 	/**获取指定云存储的签名