From eb7a5984e509af2e98bee310336faacd660533e0 Mon Sep 17 00:00:00 2001 From: Alejandro Revilla Date: Wed, 6 Jul 2022 22:03:44 -0300 Subject: [PATCH] Use try with resource closes #253 --- modules/status/src/main/java/org/jpos/ee/status/Ping.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/status/src/main/java/org/jpos/ee/status/Ping.java b/modules/status/src/main/java/org/jpos/ee/status/Ping.java index dcbf7947aa..437b09594a 100644 --- a/modules/status/src/main/java/org/jpos/ee/status/Ping.java +++ b/modules/status/src/main/java/org/jpos/ee/status/Ping.java @@ -36,10 +36,8 @@ public String checkService () { boolean rc = false; String detail = ""; long start = System.currentTimeMillis(); - try { - Socket socket = new Socket(host, port); + try (Socket socket = new Socket(host, port)){ socket.setSoLinger (true, 0); - socket.close(); rc = true; } catch (ConnectException e) { rc = true;