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


The following commit(s) were added to refs/heads/master by this push:
     new fea82bc3 Use Objects.toString()
     new 2f617700 Merge branch 'master' of 
https://gitbox.apache.org/repos/asf/commons-net.git
fea82bc3 is described below

commit fea82bc3633ce447342be2f4872862165a9e5095
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Tue Jun 11 10:56:04 2024 -0400

    Use Objects.toString()
---
 src/main/java/org/apache/commons/net/examples/ntp/NTPClient.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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 9ba0c853..331aa60c 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
@@ -23,6 +23,7 @@ import java.net.SocketException;
 import java.net.UnknownHostException;
 import java.text.NumberFormat;
 import java.time.Duration;
+import java.util.Objects;
 
 import org.apache.commons.net.ntp.NTPUDPClient;
 import org.apache.commons.net.ntp.NtpUtils;
@@ -161,8 +162,8 @@ public final class NTPClient {
         info.computeDetails(); // compute offset/delay if not already done
         final Long offsetMillis = info.getOffset();
         final Long delayMillis = info.getDelay();
-        final String delay = delayMillis == null ? "N/A" : 
delayMillis.toString();
-        final String offset = offsetMillis == null ? "N/A" : 
offsetMillis.toString();
+        final String delay = Objects.toString(delayMillis, "N/A");
+        final String offset = Objects.toString(offsetMillis, "N/A");
 
         System.out.println(" Roundtrip delay(ms)=" + delay + ", clock 
offset(ms)=" + offset); // offset in ms
     }

Reply via email to