deason 1 năm trước cách đây
mục cha
commit
86aa08b824

+ 6 - 3
examcloud-support/src/main/java/cn/com/qmth/examcloud/support/fss/FssHelper.java

@@ -61,8 +61,11 @@ public class FssHelper {
      * 获取文件的MD5值
      */
     public static String getFileMD5(File file) {
-        if (file == null || !file.isFile()) {
-            return null;
+        if (file == null) {
+            throw new RuntimeException("文件不能为空!");
+        }
+        if (!file.isFile()) {
+            throw new RuntimeException("文件类型不能正确!");
         }
 
         try (FileInputStream fis = new FileInputStream(file);) {
@@ -77,7 +80,7 @@ public class FssHelper {
             return new String(Hex.encodeHex(md.digest()));
         } catch (Exception e) {
             log.error(e.getMessage(), e);
-            return null;
+            throw new RuntimeException("获取文件的MD5值失败!");
         }
     }
 

+ 1 - 1
examcloud-support/src/main/java/cn/com/qmth/examcloud/support/fss/FssProperty.java

@@ -21,7 +21,7 @@ public class FssProperty {
 
     public static String FSS_URL_PREFIX;
 
-    @Value("${examcloud.fss.type:}")
+    @Value("${examcloud.fss.type}")
     public void fssType(FssType fssType) {
         FSS_TYPE = fssType;
     }