Skip to content

Commit 5fa4ccf

Browse files
committed
Replace deprecated URL constructor
1 parent 9a748a0 commit 5fa4ccf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/org/xbill/DNS/DohResolver.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.net.HttpURLConnection;
1111
import java.net.SocketTimeoutException;
1212
import java.net.URI;
13-
import java.net.URL;
13+
import java.net.URISyntaxException;
1414
import java.security.NoSuchAlgorithmException;
1515
import java.time.Duration;
1616
import java.time.temporal.ChronoUnit;
@@ -344,7 +344,7 @@ private CompletionStage<Message> sendAsync8(final Message query, Executor execut
344344
return CompletableFuture.completedFuture(response);
345345
} catch (SocketTimeoutException e) {
346346
return this.<Message>timeoutFailedFuture(query, e);
347-
} catch (IOException e) {
347+
} catch (IOException | URISyntaxException e) {
348348
return this.<Message>failedFuture(e);
349349
} finally {
350350
permit.release();
@@ -362,8 +362,8 @@ private static class SendAndGetMessageBytesResponse {
362362
}
363363

364364
private SendAndGetMessageBytesResponse sendAndGetMessageBytes(
365-
String url, byte[] queryBytes, long startTime) throws IOException {
366-
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
365+
String url, byte[] queryBytes, long startTime) throws IOException, URISyntaxException {
366+
HttpURLConnection conn = (HttpURLConnection) new URI(url).toURL().openConnection();
367367
if (conn instanceof HttpsURLConnection) {
368368
((HttpsURLConnection) conn).setSSLSocketFactory(sslSocketFactory);
369369
}

0 commit comments

Comments
 (0)