cleanup: extract duplicating strings to constants and add comments to them

This commit is contained in:
nik
2018-07-17 15:20:25 +03:00
parent ef01d133bc
commit d31e14bc5a
2 changed files with 4 additions and 2 deletions
@@ -42,6 +42,7 @@ public class UpdateCheckerComponent implements Disposable, ApplicationComponent
private static final long CHECK_INTERVAL = DateFormatUtil.DAY;
static final String SELF_UPDATE_STARTED_FOR_BUILD_PROPERTY = "ide.self.update.started.for.build";
private static final String ERROR_LOG_FILE_NAME = "idea_updater_error.log";//must be equal to com.intellij.updater.Runner.ERROR_LOG_FILE_NAME
private final Alarm myCheckForUpdatesAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
private final Runnable myCheckRunnable = () -> UpdateChecker.updateAndShowResult().doWhenProcessed(() -> queueNextCheck(CHECK_INTERVAL));
@@ -131,7 +132,7 @@ public class UpdateCheckerComponent implements Disposable, ApplicationComponent
private static void checkIfPreviousUpdateFailed() {
PropertiesComponent properties = PropertiesComponent.getInstance();
if (ApplicationInfo.getInstance().getBuild().asString().equals(properties.getValue(SELF_UPDATE_STARTED_FOR_BUILD_PROPERTY))) {
File updateErrorsLog = new File(PathManager.getLogPath(), "idea_updater_error.log");
File updateErrorsLog = new File(PathManager.getLogPath(), ERROR_LOG_FILE_NAME);
try {
if (updateErrorsLog.isFile() && !StringUtil.isEmptyOrSpaces(FileUtil.loadFile(updateErrorsLog))) {
FUSApplicationUsageTrigger.getInstance().trigger(IdeUpdateUsageTriggerCollector.class, "update.failed");
+2 -1
View File
@@ -19,6 +19,7 @@ import java.util.zip.ZipInputStream;
public class Runner {
private static final String PATCH_FILE_NAME = "patch-file.zip";
private static final String ERROR_LOG_FILE_NAME = "idea_updater_error.log";//must be equal to com.intellij.openapi.updateSettings.impl.UpdateCheckerComponent.ERROR_LOG_FILE_NAME
private static Logger logger = null;
private static String logPath = null;
@@ -159,7 +160,7 @@ public class Runner {
update.activateOptions();
FileAppender updateError = new FileAppender();
updateError.setFile(new File(logDirectory, "idea_updater_error.log").getAbsolutePath());
updateError.setFile(new File(logDirectory, ERROR_LOG_FILE_NAME).getAbsolutePath());
updateError.setLayout(new PatternLayout("%d{dd/MM HH:mm:ss} %-5p %C{1}.%M - %m%n"));
updateError.setThreshold(Level.ERROR);
updateError.setAppend(false);