mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8272996: JNDI DNS provider fails to resolve SRV entries when IPV6 stack is enabled
Reviewed-by: dfuchs
This commit is contained in:
parent
f3e8242683
commit
4c169495a2
1 changed files with 13 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -26,10 +26,12 @@
|
|||
package com.sun.jndi.dns;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.DatagramPacket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.PortUnreachableException;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.security.SecureRandom;
|
||||
|
@ -275,7 +277,16 @@ public class DnsClient {
|
|||
} // servers
|
||||
}
|
||||
return new ResourceRecords(msg, msg.length, hdr, false);
|
||||
|
||||
} catch (UncheckedIOException | PortUnreachableException ex) {
|
||||
// DatagramSocket.connect in doUdpQuery can throw UncheckedIOException
|
||||
// DatagramSocket.send in doUdpQuery can throw PortUnreachableException
|
||||
if (debug) {
|
||||
dprint("Caught Exception:" + ex);
|
||||
}
|
||||
if (caughtException == null) {
|
||||
caughtException = ex;
|
||||
}
|
||||
doNotRetry[i] = true;
|
||||
} catch (IOException e) {
|
||||
if (debug) {
|
||||
dprint("Caught IOException:" + e);
|
||||
|
@ -283,12 +294,6 @@ public class DnsClient {
|
|||
if (caughtException == null) {
|
||||
caughtException = e;
|
||||
}
|
||||
// Use reflection to allow pre-1.4 compilation.
|
||||
// This won't be needed much longer.
|
||||
if (e.getClass().getName().equals(
|
||||
"java.net.PortUnreachableException")) {
|
||||
doNotRetry[i] = true;
|
||||
}
|
||||
} catch (NameNotFoundException e) {
|
||||
// This is authoritative, so return immediately
|
||||
throw e;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue