Skip to content

Commit

Permalink
HDFS-17449. Fix ill-formed decommission host name and port pair trigg…
Browse files Browse the repository at this point in the history
…ers IndexOutOfBound error (apache#6691). Contributed by ConfX

Signed-off-by: Ayush Saxena <[email protected]>
  • Loading branch information
teamconfx authored Apr 6, 2024
1 parent a1ae35e commit 73e6931
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ public void initOutOfServiceHosts(List<String> decommissionHostNameAndPorts,
for (String hostNameAndPort : decommissionHostNameAndPorts) {
DatanodeAdminProperties dn = new DatanodeAdminProperties();
String[] hostAndPort = hostNameAndPort.split(":");
if (hostAndPort.length != 2) {
throw new IllegalArgumentException("The decommision host name and port format is "
+ "invalid. The format should be in <host>:<port>, not " + hostNameAndPort);
}
dn.setHostName(hostAndPort[0]);
dn.setPort(Integer.parseInt(hostAndPort[1]));
dn.setAdminState(AdminStates.DECOMMISSIONED);
Expand Down

0 comments on commit 73e6931

Please sign in to comment.