diff --git a/inlong-audit/audit-sdk/src/main/java/org/apache/inlong/audit/send/SenderManager.java b/inlong-audit/audit-sdk/src/main/java/org/apache/inlong/audit/send/SenderManager.java index b795b7aa98..97f2baf33c 100644 --- a/inlong-audit/audit-sdk/src/main/java/org/apache/inlong/audit/send/SenderManager.java +++ b/inlong-audit/audit-sdk/src/main/java/org/apache/inlong/audit/send/SenderManager.java @@ -77,15 +77,16 @@ public void closeSocket() { public boolean checkSocket() { if (socket.isClosed() || !socket.isConnected()) { + InetSocketAddress inetSocketAddress = null; try { - InetSocketAddress inetSocketAddress = ProxyManager.getInstance().getInetSocketAddress(); + inetSocketAddress = ProxyManager.getInstance().getInetSocketAddress(); if (inetSocketAddress == null) { LOGGER.error("Audit proxy address is null!"); return false; } reconnect(inetSocketAddress, auditConfig.getSocketTimeout()); } catch (IOException exception) { - LOGGER.error("Connect to audit proxy {} has exception!", socket.getInetAddress(), exception); + LOGGER.error("Connect to audit proxy {} has exception!", inetSocketAddress, exception); return false; } }