Skip to content

Commit 08e1bcc

Browse files
committed
Merge branch 'stable'
2 parents c8d7fff + 6333514 commit 08e1bcc

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/main/java/com/rabbitmq/client/DnsRecordIpAddressResolver.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,12 @@ public DnsRecordIpAddressResolver(Address address, boolean ssl) {
6666
* @throws IOException if DNS resolution fails
6767
*/
6868
@Override
69-
public List<Address> getAddresses() throws IOException {
69+
public List<Address> getAddresses() throws UnknownHostException {
7070
String hostName = address.getHost();
7171
int portNumber = ConnectionFactory.portOrDefault(address.getPort(), ssl);
72-
InetAddress[] inetAddresses;
73-
try {
74-
inetAddresses = resolveIpAddresses(hostName);
75-
} catch (UnknownHostException e) {
76-
throw new IOException("Could not resolve IP addresses for host "+hostName, e);
77-
}
72+
73+
InetAddress[] inetAddresses = resolveIpAddresses(hostName);
74+
7875
List<Address> addresses = new ArrayList<Address>();
7976
for (InetAddress inetAddress : inetAddresses) {
8077
addresses.add(new Address(inetAddress.getHostAddress(), portNumber));

src/test/java/com/rabbitmq/client/test/DnsRecordIpAddressResolverTests.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package com.rabbitmq.client.test;
22

3-
import static org.junit.Assert.fail;
3+
import com.rabbitmq.client.Connection;
4+
import com.rabbitmq.client.ConnectionFactory;
5+
import com.rabbitmq.client.DnsRecordIpAddressResolver;
6+
import org.junit.Test;
47

58
import java.io.IOException;
9+
import java.net.UnknownHostException;
610
import java.util.concurrent.TimeoutException;
711

8-
import org.junit.Test;
9-
10-
import com.rabbitmq.client.Connection;
11-
import com.rabbitmq.client.ConnectionFactory;
12-
import com.rabbitmq.client.DnsRecordIpAddressResolver;
12+
import static org.junit.Assert.fail;
1313

1414
/**
1515
*
@@ -45,7 +45,7 @@ public class DnsRecordIpAddressResolverTests extends BrokerTestCase {
4545
try {
4646
connectionFactory.newConnection(addressResolver);
4747
fail("The host resolution should have failed");
48-
} catch (IOException e) {
48+
} catch (UnknownHostException e) {
4949
// expected
5050
}
5151
}

0 commit comments

Comments
 (0)