This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-net.git
commit 3dbd77d782a4fd1d722195e7feb62c30bd965c02 Author: Gary Gregory <[email protected]> AuthorDate: Sun Jun 16 13:06:16 2024 -0400 Refactor magic string --- src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java b/src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java index 331aa60c..491cc4d9 100644 --- a/src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java +++ b/src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java @@ -44,6 +44,7 @@ import org.apache.commons.net.ntp.TimeStamp; */ public final class NTPClient { + private static final String OWN_CLOCK_IP_ADDRESS = "127.127.1.0"; private static final NumberFormat numberFormat = new java.text.DecimalFormat("0.00"); public static void main(final String[] args) { @@ -108,7 +109,7 @@ public final class NTPClient { String refAddr = NtpUtils.getHostAddress(refId); String refName = null; if (refId != 0) { - if (refAddr.equals("127.127.1.0")) { + if (refAddr.equals(OWN_CLOCK_IP_ADDRESS)) { refName = "LOCAL"; // This is the ref address for the Local Clock } else if (stratum >= 2) { // If reference id has 127.127 prefix then it uses its own reference clock
