This is an automated email from the ASF dual-hosted git repository. ayushsaxena pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push: new 73e6931ed05e HDFS-17449. Fix ill-formed decommission host name and port pair triggers IndexOutOfBound error (#6691). Contributed by ConfX 73e6931ed05e is described below commit 73e6931ed05e25a91ee0854fe2dab7dc9a288746 Author: ConfX <114765570+teamco...@users.noreply.github.com> AuthorDate: Sat Apr 6 16:08:09 2024 +0800 HDFS-17449. Fix ill-formed decommission host name and port pair triggers IndexOutOfBound error (#6691). Contributed by ConfX Signed-off-by: Ayush Saxena <ayushsax...@apache.org> --- .../src/test/java/org/apache/hadoop/hdfs/util/HostsFileWriter.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/util/HostsFileWriter.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/util/HostsFileWriter.java index e171e2bbdc6f..9dd788d166a8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/util/HostsFileWriter.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/util/HostsFileWriter.java @@ -106,6 +106,10 @@ public class HostsFileWriter { 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); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org