enjoy 3.8

This commit is contained in:
James 2019-04-07 21:45:28 +08:00
parent d5a88b8be4
commit eac1d8d055

View File

@ -17,9 +17,7 @@
package com.jfinal.template;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
import java.util.Map;
@ -117,16 +115,10 @@ public class Template {
* 适用于代码生成器类似应用场景
*/
public void render(Map<?, ?> data, File file) {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(file);
try (FileOutputStream fos = new FileOutputStream(file)) {
render(data, fos);
} catch (FileNotFoundException e) {
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
if (fos != null) {
try {fos.close();} catch (IOException e) {e.printStackTrace(System.err);}
}
}
}