NPE in canCompleteSwap if path doesn't exists

Open
#3,069 0 comments 0 reactions 0 assignees View on GitHub

@waterWang is already working on this.

Since Jul 28, 2026.

  • #3162 by @waterWang — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
50/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
java
Domain
api, backend

Research direction

Start in helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java at lines 552-555 and trace the canCompleteSwap REST entry point. Reproduce the case with a corrupted or missing path, then verify that the operation returns true without an NPE.

Written by the indexing model from the issue text.

Description

bug
Describe the bug

Currently when we call baseAccessor.getChildNames and if the path doesnt exists, swapOutResources is null, and we iterate 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.

Dominant language
Java
Stars
505
Forks
258
Avg merge
4d 20h
Merged PRs (30d)
3

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/helix

All issues in apache/helix

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.