Skip to content

No UnknownHostException is thrown when invalid host is used. [JIRA: CLIENTS-401] #518

@calvernaz

Description

@calvernaz

Given an invalid host I was excepting an exception has the documentation states.

After a bit of debugging, it seems the excepted exception it's being swallowed
and we should rely on isUnresolved method.

Testing code:

client = RiakClient.newClient(Lists.newArrayList("no_place_like_home.com"));

Riak client handling

bootstrap.handler(new RiakChannelInitializer(this))
     .remoteAddress(new InetSocketAddress(remoteAddress, port));

InetSocketAddress handling

    public InetSocketAddress(String hostname, int port) {
        checkHost(hostname);
        InetAddress addr = null;
        String host = null;
        try {
            addr = InetAddress.getByName(hostname);
        } catch(UnknownHostException e) {
            host = hostname;
        }
        holder = new InetSocketAddressHolder(host, addr, checkPort(port));
    }

I was wondering if we could fix this behaviour or if there is any reason for that, like in a situation of many nodes and just one is not possible to resolve.

Version details:

$ java -version
java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
<dependency>
  <groupId>com.basho.riak</groupId>
  <artifactId>riak-client</artifactId>
  <version>2.0.0</version>
</dependency>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions