【fix sonar】PmsUtil文件

This commit is contained in:
梁琦涛
2023-03-06 10:12:40 +08:00
parent 56445cb392
commit 3f3814699c
@@ -33,14 +33,12 @@ public class PmsUtil {
}
name += DateUtils.yyyymmddhhmmss.get().format(d) + Math.round(Math.random() * 10000);
String saveFilePath = saveFullDir + name + ".txt";
try {
//封装目的地
BufferedWriter bw = new BufferedWriter(new FileWriter(saveFilePath));
//封装目的地
try (BufferedWriter bw = new BufferedWriter(new FileWriter(saveFilePath))) {
//遍历集合
for (String s : msg) {
//写数据
if (s.indexOf("_") > 0) {
if (s.contains("_")) {
String arr[] = s.split("_");
bw.write("" + arr[0] + "行:" + arr[1]);
} else {
@@ -51,7 +49,6 @@ public class PmsUtil {
}
//释放资源
bw.flush();
bw.close();
} catch (Exception e) {
log.info("excel导入生成错误日志文件异常:" + e.getMessage());
}