Explorar o código

使用closeable关闭

o2null %!s(int64=5) %!d(string=hai) anos
pai
achega
26bfee3e94

+ 3 - 3
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/personcard/CodeUtil.java

@@ -214,9 +214,9 @@ public class CodeUtil {
 	 */
 	 */
 	public static File decoderBase64File(String targetPath, String base64Code) throws Exception {
 	public static File decoderBase64File(String targetPath, String base64Code) throws Exception {
 		byte[] buffer = Base64.decodeBase64(base64Code);
 		byte[] buffer = Base64.decodeBase64(base64Code);
-		FileOutputStream out = new FileOutputStream(targetPath);
-		out.write(buffer);
-		out.close();
+		try (FileOutputStream out = new FileOutputStream(targetPath)) {
+			out.write(buffer);
+		}
 		File file = new File(targetPath);
 		File file = new File(targetPath);
 		return file;
 		return file;
 	}
 	}