apache / apache/helix

NPE in canCompleteSwap if path doesn't exists

Open
#3,069 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
504
Forks
255
Avg merge
17d 47m
Merged PRs (30d)
2

Description

### Describe the bug
Currently when we call [baseAccessor.getChildNames](https://github.com/apache/helix/blob/62f0e9c814b7543cc26367f1c3841ca0d5db7ae5/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java#L552-L554) and if the path doesnt exists, swapOutResources is null, and we [iterate](https://github.com/apache/helix/blob/62f0e9c814b7543cc26367f1c3841ca0d5db7ae5/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java#L555) over this which results in NPE

```
"error" : "Cannot invoke \"java.util.List.iterator()\" because \"swapOutResources\" is null"
}
```

### To Reproduce
Hit canCompleteSwap Rest and manually corrupt the path.

### Expected behavior
NPEs should be handled, it should return true in this case as well.

### Additional context
Add any other context about the problem here.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.