Browse Source

Merge pull request #17305 in DESIGN/design from bugfix/11.0 to feature/x

* commit 'c604544efe4e5ef729027c5cfac7029fcbf35a74':
  REPORT-153340 代码中部分资源流未关闭,使用 try-with-resources 自动关闭流
feature/x
superman 1 week ago
parent
commit
a53dcb61eb
  1. 11
      designer-base/src/main/java/com/fr/design/RestartHelper.java

11
designer-base/src/main/java/com/fr/design/RestartHelper.java

@ -110,8 +110,8 @@ public class RestartHelper {
private static boolean deleteWhenDebug() {
File ff = new File(RECORD_FILE);
Properties properties = new Properties();
try {
properties.load(new FileInputStream(ff));
try (FileInputStream fis = new FileInputStream(ff)) {
properties.load(fis);
} catch (IOException ignore) {
return true;
}
@ -163,7 +163,6 @@ public class RestartHelper {
}
/**
* 重启设计器并删除某些特定的文件
*
@ -180,13 +179,13 @@ public class RestartHelper {
try {
File restartLockFile = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), "restart.lock"));
StableUtils.makesureFileExist(restartLockFile);
randomAccessFile = new RandomAccessFile(restartLockFile,"rw");
randomAccessFile = new RandomAccessFile(restartLockFile, "rw");
FileChannel restartLockFC = randomAccessFile.getChannel();
FileLock restartLock = restartLockFC.tryLock();
if(restartLock == null) {
if (restartLock == null) {
FineLoggerFactory.getLogger().error("restart lock null!");
}
}catch (Exception e){
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
restartAction.execute(filesToBeDelete);

Loading…
Cancel
Save