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 @@ -525,7 +525,7 @@ private Mono<Set<EntityDependencyNode>> getPossibleEntityReferences(
// We want to be finding both type of references
final int entityTypes = EXECUTABLE_ENTITY_REFERENCES | WIDGET_ENTITY_REFERENCES;
return executableNameToExecutableMono
.zipWith(getPossibleEntityParentsMap(new ArrayList<>(bindings), entityTypes, evalVersion))
.zipWith(getPossibleEntityParentsMap(bindings, entityTypes, evalVersion))
.map(tuple -> {
Map<String, Executable> executableMap = tuple.getT1();
// For each binding, here we receive a set of possible references to global entities
Expand Down Expand Up @@ -585,7 +585,7 @@ private Mono<Set<EntityDependencyNode>> getPossibleEntityReferences(

private Mono<Map<String, Set<EntityDependencyNode>>> getPossibleEntityReferencesMap(
Mono<Map<String, Executable>> executableNameToExecutableMono,
List<String> bindings,
Set<String> bindings,
int evalVersion,
Set<EntityDependencyNode> bindingsInDsl) {
// We want to be finding both type of references
Expand Down Expand Up @@ -666,9 +666,9 @@ private Mono<Map<String, Set<EntityDependencyNode>>> getPossibleEntityReferences
* @return A mono of a map of each of the provided binding values to the possible set of EntityDependencyNodes found in the binding
*/
private Mono<Map<String, Set<EntityDependencyNode>>> getPossibleEntityParentsMap(
List<String> bindings, int types, int evalVersion) {
Set<String> bindings, int types, int evalVersion) {
Flux<Tuple2<String, Set<String>>> findingToReferencesFlux =
astService.getPossibleReferencesFromDynamicBinding(bindings, evalVersion);
astService.getPossibleReferencesFromDynamicBinding(new ArrayList<>(bindings), evalVersion);
return MustacheHelper.getPossibleEntityParentsMap(findingToReferencesFlux, types);
}

Expand Down Expand Up @@ -701,7 +701,7 @@ private Mono<Set<ExecutableDependencyEdge>> addDirectlyReferencedExecutablesToGr
int evalVersion) {

Map<String, Set<EntityDependencyNode>> bindingToWidgetNodesMap = new HashMap<>();
List<String> allBindings = new ArrayList<>();
Set<String> allBindings = new HashSet<>();

widgetDynamicBindingsMap.forEach((widgetName, bindingsInWidget) -> {
EntityDependencyNode widgetDependencyNode =
Expand Down Expand Up @@ -1220,7 +1220,7 @@ private Mono<Set<ExecutableDependencyEdge>> addWidgetRelationshipToGraph(
// This part will ensure that we are discovering widget to widget relationships.
return Flux.fromIterable(widgetBindingMap.entrySet())
.flatMap(widgetBindingEntries -> getPossibleEntityParentsMap(
new ArrayList<>(widgetBindingEntries.getValue()), entityTypes, evalVersion)
widgetBindingEntries.getValue(), entityTypes, evalVersion)
.map(possibleParentsMap -> {
possibleParentsMap.entrySet().stream().forEach(entry -> {
if (entry.getValue() == null || entry.getValue().isEmpty()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Prevent Potential NullPointerException

At line 1226, calling trim() on widgetBindingEntries.getKey() may result in a NullPointerException if the key is null. Ensure that the key is not null before trimming.

Consider adding a null check:

String widgetPath = widgetBindingEntries.getKey();
if (widgetPath != null) {
    widgetPath = widgetPath.trim();
}

Expand Down