You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "bmarwell (via GitHub)" <gi...@apache.org> on 2023/07/05 07:28:26 UTC

[GitHub] [maven-resolver] bmarwell commented on a diff in pull request #315: [MRESOLVER-382] allow setting outgoing interface

bmarwell commented on code in PR #315:
URL: https://github.com/apache/maven-resolver/pull/315#discussion_r1252667551


##########
maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java:
##########
@@ -295,6 +300,20 @@ final class HttpTransporter extends AbstractTransporter {
         this.client = builder.build();
     }
 
+    private InetAddress getBindAddress(RepositorySystemSession session) {
+        String bindAddress = ConfigUtils.getString(session, null, BIND_ADDRESS);
+        return Optional.ofNullable(bindAddress).map(this::resolveAddressOrNull).orElse(null);
+    }
+
+    private InetAddress resolveAddressOrNull(String hostOrIp) {
+        try {
+            return InetAddress.getByName(hostOrIp);
+        } catch (UnknownHostException uhe) {
+            LOGGER.warn("Given bind host (" + hostOrIp + ") cannot be resolved. Reverting to default route.");

Review Comment:
   Thanks!
   I just saw I swallowed the UHE. Maybe add a debug logging?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org