Skip to content

Commit d4f9eb1

Browse files
committed
fix npe check.
1 parent 263a5ca commit d4f9eb1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataSetLockManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ private String generateLockName(LockLevel level, String... resources) {
9595
}
9696
return resources[0] + resources[1];
9797
} else if (resources.length == 3 && level == LockLevel.DIR) {
98+
if (resources[0] == null || resources[1] == null || resources[2] == null) {
99+
throw new IllegalArgumentException("acquire a null dataset lock : "
100+
+ resources[0] + ",volume lock :" + resources[1]
101+
+ ",subdir lock :" + resources[2]);
102+
}
98103
return resources[0] + resources[1] + resources[2];
99104
} else {
100105
throw new IllegalArgumentException("lock level do not match resource");

0 commit comments

Comments
 (0)