Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public boolean isAvailableServer(final String ip) {

private boolean hasOnlineInstances(final String ip) {
for (String each : jobNodeStorage.getJobNodeChildrenKeys(InstanceNode.ROOT)) {
Copy link

Copilot AI Sep 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code assumes the instance identifier always contains '@-@' delimiter, but if it doesn't, split() will return the original string. This could cause issues if the instance format is different. Consider adding validation or using a more robust parsing approach.

Suggested change
for (String each : jobNodeStorage.getJobNodeChildrenKeys(InstanceNode.ROOT)) {
for (String each : jobNodeStorage.getJobNodeChildrenKeys(InstanceNode.ROOT)) {
if (!each.contains("@-@")) {
// Skip malformed instance identifier
continue;
}

Copilot uses AI. Check for mistakes.
if (each.startsWith(ip)) {
String eachIp = each.split("@-@")[0];
if (eachIp.equals(ip)) {
Comment on lines +84 to +85
Copy link

Copilot AI Sep 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the ip parameter is null, this will cause a NullPointerException. Consider using Objects.equals(eachIp, ip) or add null check for the ip parameter.

Copilot uses AI. Check for mistakes.
return true;
}
}
Expand Down