From 2c491b508f0a6dcc3d55c0d3e0a33a3db2a63380 Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Sun, 17 Nov 2024 18:50:12 -0500 Subject: [PATCH] Fix cross-test failure --- .../main/java/com/zeroc/Ice/IPEndpointI.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/java/src/com.zeroc.ice/src/main/java/com/zeroc/Ice/IPEndpointI.java b/java/src/com.zeroc.ice/src/main/java/com/zeroc/Ice/IPEndpointI.java index 50f12073548..f83fd495882 100644 --- a/java/src/com.zeroc.ice/src/main/java/com/zeroc/Ice/IPEndpointI.java +++ b/java/src/com.zeroc.ice/src/main/java/com/zeroc/Ice/IPEndpointI.java @@ -15,7 +15,8 @@ protected IPEndpointI( java.net.InetSocketAddress sourceAddr, String connectionId) { _instance = instance; - _host = normalizeHost(host); + _host = host; + _normalizedHost = normalizeHost(host); _port = port; _sourceAddr = sourceAddr; _connectionId = connectionId; @@ -135,7 +136,7 @@ public boolean equivalent(EndpointI endpoint) { IPEndpointI ipEndpointI = (IPEndpointI) endpoint; return ipEndpointI.type() == type() - && ipEndpointI._host.equals(_host) + && ipEndpointI._normalizedHost.equals(_normalizedHost) && ipEndpointI._port == _port && java.util.Objects.equals(ipEndpointI._sourceAddr, _sourceAddr); } @@ -247,14 +248,16 @@ public void fillEndpointInfo(IPEndpointInfo info) { info.sourceAddress = _sourceAddr == null ? "" : _sourceAddr.getAddress().getHostAddress(); } - public void initWithOptions(java.util.ArrayList args, boolean oaEndpoint) { + void initWithOptions(java.util.ArrayList args, boolean oaEndpoint) { super.initWithOptions(args); if (_host == null || _host.isEmpty()) { - _host = normalizeHost(_instance.defaultHost()); + _host = _instance.defaultHost(); + _normalizedHost = normalizeHost(_host); } else if (_host.equals("*")) { if (oaEndpoint) { _host = ""; + _normalizedHost = ""; } else { throw new ParseException( "'-h *' not valid for proxy endpoint '" + toString() + "'"); @@ -263,6 +266,7 @@ public void initWithOptions(java.util.ArrayList args, boolean oaEndpoint if (_host == null) { _host = ""; + _normalizedHost = ""; } if (_sourceAddr == null) { @@ -282,7 +286,8 @@ protected boolean checkOption(String option, String argument, String endpoint) { throw new ParseException( "no argument provided for -h option in endpoint '" + endpoint + "'"); } - _host = normalizeHost(argument); + _host = argument; + _normalizedHost = normalizeHost(argument); } else if (option.equals("-p")) { if (argument == null) { throw new ParseException( @@ -347,4 +352,7 @@ protected abstract Connector createConnector( protected int _port; protected java.net.InetSocketAddress _sourceAddr; protected final String _connectionId; + + // Set when we set _host; used by the implementation of equivalent. + private String _normalizedHost; }