Details
-
Bug
-
Status: Open
-
Normal
-
Resolution: Unresolved
-
None
-
Correctness - API / Semantic Implementation
-
Normal
-
Normal
-
User Report
-
All
-
None
Description
When hosts are unknown, StorageService throws two types of exceptions. The following methods throw RuntimeException:
public String getNativeaddress(InetAddressAndPort endpoint, boolean withPort){ ... try{ InetAddressAndPort address = InetAddressAndPort.getByName(Gossiper.instance.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.NATIVE_ADDRESS_AND_PORT).value); return address.getHostAddress(withPort); }catch (UnknownHostException e) { throw new RuntimeException(e); } }
public void onChange(InetAddressAndPort endpoint, ApplicationState state, VersionedValue value){ ... try { InetAddressAndPort address = InetAddressAndPort.getByName(value.value); SystemKeyspace.updatePeerNativeAddress(endpoint, address); } catch (UnknownHostException e) { throw new RuntimeException(e); } ... }
A method throws IllegalArgumentException
public void rebuild(String sourceDc, String keyspace, String tokens, String specificSources, boolean excludeLocalDatacenterNodes){ ... try { InetAddressAndPort endpoint = InetAddressAndPort.getByName(stringHost); if (FBUtilities.getBroadcastAddressAndPort().equals(endpoint)) { throw new IllegalArgumentException("This host was specified as a source for rebuilding. Sources for a rebuild can only be other nodes in the cluster."); } sources.add(endpoint); } catch (UnknownHostException ex) { throw new IllegalArgumentException("Unknown host specified " + stringHost, ex); } }
A method throws no exceptions:
private void handleStateBootreplacing(InetAddressAndPort newNode, String[] pieces){ ... try { oldNode = InetAddressAndPort.getByName(pieces[1]); } catch (Exception e) { logger.error("Node {} tried to replace malformed endpoint {}.", newNode, pieces[1], e); return; } ... }
A method does not rethrow exceptions and throws
UnknownHostException
public List<String> getTokens(String endpoint) throws UnknownHostException { return getTokens(InetAddressAndPort.getByName(endpoint)); }
The treatments look random.