瀏覽代碼

输出流close

dengsixing 2 年之前
父節點
當前提交
d5249d4db1

+ 3 - 1
4dkankan-common-web/src/main/java/com/fdkankan/web/util/BASE64DecodedMultipartFile.java

@@ -54,7 +54,9 @@ public class BASE64DecodedMultipartFile implements MultipartFile {
 
     @Override
     public void transferTo(File dest) throws IOException, IllegalStateException {
-        new FileOutputStream(dest).write(imgContent);
+        try (FileOutputStream ios = new FileOutputStream(dest)){
+            ios.write(imgContent);
+        }
     }