ok2c commented on code in PR #418:
URL: 
https://github.com/apache/httpcomponents-client/pull/418#discussion_r1123306774


##########
httpclient5/src/test/java/org/apache/hc/client5/http/SystemDefaultDnsResolverTest.java:
##########
@@ -0,0 +1,68 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.hc.client5.http;
+
+import org.junit.jupiter.api.Test;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class SystemDefaultDnsResolverTest {
+
+    @Test
+    void resolve() throws UnknownHostException {
+        final SystemDefaultDnsResolver resolver = 
SystemDefaultDnsResolver.INSTANCE;
+
+        final InetAddress[] result1 = resolver.resolve("example.com");

Review Comment:
   @arturobernalg While extra test coverage is nice, in this particular case 
these tests introduce dependency on DNS infrastructure with public network 
access. These tests may fail when run in a private network where 'example.com' 
does not resolve. Please re-write the tests that do not require public network 
access or remote them.



##########
httpclient5/src/main/java/org/apache/hc/client5/http/SystemDefaultDnsResolver.java:
##########
@@ -40,7 +40,14 @@ public class SystemDefaultDnsResolver implements DnsResolver 
{
 
     @Override
     public InetAddress[] resolve(final String host) throws 
UnknownHostException {
-        return InetAddress.getAllByName(host);
+        try {

Review Comment:
   @arturobernalg I suggest `#stripsIPv6ZoneId` be inlined as it is not being 
used anywhere else and extra hostname comparison be eliminated.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to