diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/common/util/ReadLineUtil.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/common/util/ReadLineUtil.java index 6b39656f..26a27197 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/common/util/ReadLineUtil.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/common/util/ReadLineUtil.java @@ -44,6 +44,7 @@ public class ReadLineUtil { throw new RuntimeException("ftp连接失败!"); } InputStream iStream = null; + File file = null; try { ftpClient.enterLocalPassiveMode(); String fileName = filePath.substring(filePath.lastIndexOf(StringPool.SLASH) + 1); @@ -63,7 +64,7 @@ public class ReadLineUtil { //读取ftp文件的输入流 iStream=ftpClient.retrieveFileStream(ftpFile.getName()); //声明一个临时文件 - File file = File.createTempFile("betaGamma", null); + file = File.createTempFile("betaGamma", null); //将ftp文件的输入流复制给临时文件 FileUtils.copyInputStreamToFile(iStream, file); List allLines = FileUtils.readLines(file, encoding); @@ -93,6 +94,9 @@ public class ReadLineUtil { if (Objects.nonNull(iStream)){ iStream.close(); } + if (Objects.nonNull(file)) { + file.delete(); + } } catch (IOException e) { throw new RuntimeException(e); }