diff --git a/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java b/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java index b358bec7..380624af 100644 --- a/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java +++ b/src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java @@ -2024,7 +2024,7 @@ public void cleanUpServerEnv() { // Delete server.env file serverEnvFile.delete(); } - } catch (IOException e) { + } catch (Exception e) { error("Could not retrieve server.env: " + e.getMessage()); } } @@ -2036,7 +2036,7 @@ public void cleanUpTempConfig() { try { FileUtils.deleteDirectory(tempConfig); debug("Successfully deleted liberty:dev temporary configuration folder"); - } catch (IOException e) { + } catch (Exception e) { warn("Could not delete liberty:dev temporary configuration folder: " + e.getMessage()); } } @@ -2050,7 +2050,7 @@ public void cleanUpTempDockerfile() { try { Files.delete(tempDockerfilePath); debug("Successfully deleted dev mode temporary Dockerfile"); - } catch (IOException e) { + } catch (Exception e) { warn("Could not delete dev mode temporary Dockerfile: " + e.getMessage()); } } @@ -2078,30 +2078,34 @@ public void run() { } private void runShutdownHook(final ThreadPoolExecutor executor) { - if (!calledShutdownHook.getAndSet(true)) { - - if (trackingMode == FileTrackMode.POLLING || trackingMode == FileTrackMode.NOT_SET) { - disablePolling(); - } - - setDevStop(true); - cleanUpTempConfig(); - cleanUpServerEnv(); - - if (hotkeyReader != null) { - hotkeyReader.shutdown(); - } - - // shutdown tests - executor.shutdown(); + try { + if (!calledShutdownHook.getAndSet(true)) { - // stopping server - if (container) { - cleanUpTempDockerfile(); - stopContainer(); - } else { - stopServer(); + if (trackingMode == FileTrackMode.POLLING || trackingMode == FileTrackMode.NOT_SET) { + disablePolling(); + } + + setDevStop(true); + cleanUpTempConfig(); + cleanUpServerEnv(); + + if (hotkeyReader != null) { + hotkeyReader.shutdown(); + } + + // shutdown tests + executor.shutdown(); + + // stopping server + if (container) { + cleanUpTempDockerfile(); + stopContainer(); + } else { + stopServer(); + } } + } catch (Exception e) { + warn("Received exception during server shutdown and cleanup: " + e.getMessage()); } } @@ -4552,12 +4556,14 @@ public void installFeaturesToTempDir(File fileChanged, File srcDir, String targe FileUtils.copyDirectory(serverDirectory, tempConfig, new FileFilter() { public boolean accept(File pathname) { String name = pathname.getName(); + String parent = pathname.getParentFile().getName(); + String serverDirName = serverDirectory.getName(); // skip: // - ignore list - // - workarea and logs dirs from the server directory, since those can be + // - workarea, messaging and logs dirs from the server directory, since those can be // changing - boolean skip = ignoreFileOrDir(pathname) - || (pathname.isDirectory() && (name.equals("workarea") || name.equals("logs"))); + boolean skip = ignoreFileOrDir(pathname) || (pathname.isDirectory() && + (name.equals("workarea") || name.equals("logs") || (name.equals("messaging") && parent.equals(serverDirName)))); return !skip; } }, true);