>From Michael Blow <[email protected]>: Michael Blow has submitted this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21348?usp=email )
Change subject: [NO ISSUE][HYR][MISC] Correct handling of toInetSocketAddress(new HttpHost(hostname)) ...................................................................... [NO ISSUE][HYR][MISC] Correct handling of toInetSocketAddress(new HttpHost(hostname)) HttpHost.create(String) leaves the resolved InetAddress null; so fall back to resolving the host name in that case to avoid defaulting to the wildcard 0.0.0.0. Change-Id: If8539e3f67b2d02a28f3a627f9e739cccaf7a132 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21348 Reviewed-by: Michael Blow <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Ian Maxon <[email protected]> Tested-by: Jenkins <[email protected]> --- M hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/NetworkUtil.java 1 file changed, 8 insertions(+), 1 deletion(-) Approvals: Jenkins: Verified; Verified Michael Blow: Looks good to me, but someone else must approve Ian Maxon: Looks good to me, approved diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/NetworkUtil.java b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/NetworkUtil.java index 63d8902..592edc2 100644 --- a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/NetworkUtil.java +++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/NetworkUtil.java @@ -20,6 +20,7 @@ import java.io.Closeable; import java.io.IOException; +import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.StandardSocketOptions; import java.net.URI; @@ -37,6 +38,7 @@ import org.apache.http.HttpHost; import org.apache.http.client.utils.URIBuilder; import org.apache.http.conn.util.InetAddressUtils; +import org.apache.hyracks.util.annotations.AiProvenance; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -233,8 +235,13 @@ return refreshed; } + @AiProvenance(agent = AiProvenance.Agent.CLAUDE_OPUS_4_8, tool = AiProvenance.Tool.CLAUDE_UI, contributionKind = AiProvenance.ContributionKind.REFACTORED) public static InetSocketAddress toInetSocketAddress(HttpHost httpHost) { - return new InetSocketAddress(httpHost.getAddress(), httpHost.getPort()); + // HttpHost.create(String) leaves the resolved InetAddress null; new InetSocketAddress((InetAddress) null, ...) + // would yield the wildcard 0.0.0.0, so fall back to resolving the host name in that case. + InetAddress address = httpHost.getAddress(); + return address != null ? new InetSocketAddress(address, httpHost.getPort()) + : toInetSocketAddress(httpHost.getHostName(), httpHost.getPort()); } /** -- To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21348?usp=email To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Change-Id: If8539e3f67b2d02a28f3a627f9e739cccaf7a132 Gerrit-Change-Number: 21348 Gerrit-PatchSet: 3 Gerrit-Owner: Michael Blow <[email protected]> Gerrit-Reviewer: Hussain Towaileb <[email protected]> Gerrit-Reviewer: Ian Maxon <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Michael Blow <[email protected]>
