diff --git a/vaadin-dev-server/src/main/java/com/vaadin/base/devserver/BrowserLauncher.java b/vaadin-dev-server/src/main/java/com/vaadin/base/devserver/BrowserLauncher.java index 3009e252bec..429cdf2526e 100644 --- a/vaadin-dev-server/src/main/java/com/vaadin/base/devserver/BrowserLauncher.java +++ b/vaadin-dev-server/src/main/java/com/vaadin/base/devserver/BrowserLauncher.java @@ -70,18 +70,22 @@ private boolean isLaunched() { if (launchFile.exists() && TimeUnit.MILLISECONDS.toMinutes(System.currentTimeMillis() - launchFile.lastModified()) < lastModifiedDelay) { - try { - Files.writeString(launchFile.toPath(), - "" + System.currentTimeMillis()); - } catch (IOException e) { - LoggerFactory.getLogger(BrowserLauncher.class) - .debug("Failed to write browser launched file.", e); - } + writeLaunchFile(launchFile); return true; } return LAUNCHED_VALUE.equals(System.getProperty(LAUNCH_TRACKER)); } + private void writeLaunchFile(File launchFile) { + try { + Files.writeString(launchFile.toPath(), + Long.toString(System.currentTimeMillis())); + } catch (IOException e) { + getLogger() + .debug("Failed to write browser launched file.", e); + } + } + private File getLaunchFile() { ApplicationConfiguration applicationConfiguration = ApplicationConfiguration .get(context); @@ -92,13 +96,7 @@ private File getLaunchFile() { private void setLaunched() { // write launch file and update modified timestamp. - try { - Files.writeString(getLaunchFile().toPath(), - "" + System.currentTimeMillis()); - } catch (IOException e) { - LoggerFactory.getLogger(BrowserLauncher.class) - .debug("Failed to write browser launched file.", e); - } + writeLaunchFile(getLaunchFile()); System.setProperty(LAUNCH_TRACKER, LAUNCHED_VALUE); }