From ac1cd6d289663f6701c174fb9ffaf20e94c26c05 Mon Sep 17 00:00:00 2001 From: Kalin Chan Date: Tue, 8 Oct 2024 11:39:45 +0100 Subject: [PATCH] FISH-9854 Rename method and add logging --- .../enterprise/admin/servermgmt/cli/LocalServerCommand.java | 2 +- .../enterprise/admin/servermgmt/cli/StartServerHelper.java | 4 ++-- .../com/sun/enterprise/universal/process/ProcessUtils.java | 4 ++-- .../src/main/java/com/sun/enterprise/util/io/ServerDirs.java | 4 +++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/cli/LocalServerCommand.java b/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/cli/LocalServerCommand.java index 72c6f34b190..5ae5273f0d2 100644 --- a/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/cli/LocalServerCommand.java +++ b/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/cli/LocalServerCommand.java @@ -387,7 +387,7 @@ protected boolean isRunning() { return isRunningByCheckingForPidFile(); } - ProcessState b = ProcessUtils.isProcessRunningState(pp); + ProcessState b = ProcessUtils.getProcessRunningState(pp); if (b == ProcessState.ERROR) { // this means it couldn't find out! return isRunningUsingJps(); diff --git a/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/cli/StartServerHelper.java b/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/cli/StartServerHelper.java index d5ec68b6dc2..efa69bbfc3a 100644 --- a/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/cli/StartServerHelper.java +++ b/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/cli/StartServerHelper.java @@ -389,11 +389,11 @@ private void waitForParentDeath(int pid) throws CommandException { long start = System.currentTimeMillis(); try { do { - ProcessState b = ProcessUtils.isProcessRunningState(pid); + ProcessState b = ProcessUtils.getProcessRunningState(pid); if (b == ProcessState.ERROR) { // this means we were unable to find out from the OS if the process // is running or not - debugMessage("ProcessUtils.isProcessRunning(" + pid + ") " + debugMessage("ProcessUtils.getProcessRunningState(" + pid + ") " + "returned null which means we can't get process " + "info on this platform."); diff --git a/nucleus/common/common-util/src/main/java/com/sun/enterprise/universal/process/ProcessUtils.java b/nucleus/common/common-util/src/main/java/com/sun/enterprise/universal/process/ProcessUtils.java index ba06ffa8271..71fbdd3a640 100644 --- a/nucleus/common/common-util/src/main/java/com/sun/enterprise/universal/process/ProcessUtils.java +++ b/nucleus/common/common-util/src/main/java/com/sun/enterprise/universal/process/ProcessUtils.java @@ -175,7 +175,7 @@ public static String killJvm(String classname) { /** * The deprecated isProcessingRunning method * - * DO NOT USE! Retained for semantic versioning. Replaced by {@link ProcessUtils#isProcessRunningState(int)}. + * DO NOT USE! Retained for semantic versioning. Replaced by {@link ProcessUtils#getProcessRunningState(int)}. */ @Deprecated(forRemoval = true, since = "6.21.0") public static Boolean isProcessRunning(int aPid) { @@ -190,7 +190,7 @@ public static Boolean isProcessRunning(int aPid) { * @return true if it's running, false if not and null if we don't know. I.e * the return value is a true tri-state Boolean. */ - public static ProcessState isProcessRunningState(int aPid) { + public static ProcessState getProcessRunningState(int aPid) { try { if (OS.isWindowsForSure()) return isProcessRunningWindows(aPid); diff --git a/nucleus/common/common-util/src/main/java/com/sun/enterprise/util/io/ServerDirs.java b/nucleus/common/common-util/src/main/java/com/sun/enterprise/util/io/ServerDirs.java index c20631dbbb7..2eeff19e1d8 100644 --- a/nucleus/common/common-util/src/main/java/com/sun/enterprise/util/io/ServerDirs.java +++ b/nucleus/common/common-util/src/main/java/com/sun/enterprise/util/io/ServerDirs.java @@ -43,6 +43,7 @@ import java.io.*; import java.io.File; import java.nio.charset.StandardCharsets; +import java.util.logging.Logger; import com.sun.enterprise.universal.i18n.LocalStringsImpl; import com.sun.enterprise.universal.io.SmartFile; @@ -132,7 +133,7 @@ public ServerDirs(File leaf) throws IOException { try (BufferedReader r = new BufferedReader(new FileReader(localPasswordFile, StandardCharsets.UTF_8))) { localPasswordBuffer = r.readLine(); } catch (Exception e) { - // needs no handling + LOGGER.fine("Error reading local password file: " + localPasswordFile); } finally { localPassword = localPasswordBuffer; // ignore @@ -253,6 +254,7 @@ public String toString() { /////////////////////////////////////////////////////////////////////////// /////////// All Private Below ///////////////////////// /////////////////////////////////////////////////////////////////////////// + private static final Logger LOGGER = Logger.getLogger(ServerDirs.class.getName()); private final String serverName; private final File serverDir; private final File parentDir;