Browse Source

输出流close

dengsixing 2 years ago
parent
commit
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);
+        }
     }