Skip to content
Closed
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 @@ -29,7 +29,6 @@

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -71,15 +70,16 @@ public List<String> list() {
}

public List<Map<String, Object>> listProfile(String prefix) {
String profilePath = joinPath(this.path(), "profile");
Map<String, Object> params = new LinkedHashMap<>();
params.put("prefix", prefix);
RestResult result = this.client.get(profilePath, params);
List<Map> results = result.readList(Map.class);
List<String> names = this.list();
List<Map<String, Object>> profiles = new ArrayList<>();
for (Object entry : results) {
profiles.add(JsonUtil.fromJson(JsonUtil.toJson(entry), Map.class));
for (String name : names) {
if (name.startsWith(prefix)) {
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The prefix parameter can be null (as seen in GraphSpaceManager.listProfile() which calls this method with null), but this code calls name.startsWith(prefix) without checking if prefix is null first. This will cause a NullPointerException. Consider using StringUtils.isEmpty(prefix) to handle null/empty prefix cases - when prefix is null or empty, all names should be included in the result.

Suggested change
if (name.startsWith(prefix)) {
if (StringUtils.isEmpty(prefix) || name.startsWith(prefix)) {

Copilot uses AI. Check for mistakes.
GraphSpace space = this.get(name);
Map<String, Object> profileMap = JsonUtil.fromJson(JsonUtil.toJson(space), Map.class);
profiles.add(profileMap);
}
}

return profiles;
Comment on lines 72 to 83
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The new implementation performs N+1 API calls (one list() call plus one get() call for each matching graph space), which could impact performance when there are many graph spaces. While this is necessary due to the removal of the /profile endpoint in server 1.7.0, consider documenting this performance characteristic in a code comment to inform future developers, especially if this method is called frequently or with many graph spaces.

Copilot uses AI. Check for mistakes.
}

Expand Down
Loading