Skip to content

Commit

Permalink
fix: remove unused parentPermission field that caused stack overflow …
Browse files Browse the repository at this point in the history
…exceptions (#4155)
  • Loading branch information
ndr-brt authored May 3, 2024
1 parent a4e6018 commit 0843fe4
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ Duty applyScope(Duty duty, String scope) {
return Duty.Builder.newInstance()
.action(duty.getAction())
.constraints(filteredConstraints)
.parentPermission(duty.getParentPermission())
.consequences(filteredConsequences)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -33,25 +32,12 @@
@JsonTypeName("dataspaceconnector:duty")
public class Duty extends Rule {

private Permission parentPermission;
private final List<Duty> consequences = new ArrayList<>();

/**
* If this duty is part of a permission, returns the parent permission; otherwise returns null.
*/
@Nullable
public Permission getParentPermission() {
return parentPermission;
}

public List<Duty> getConsequences() {
return consequences;
}

void setParentPermission(Permission permission) {
parentPermission = permission;
}

@Override
public <R> R accept(Visitor<R> visitor) {
return visitor.visitDuty(this);
Expand All @@ -74,11 +60,6 @@ public static Builder newInstance() {
return new Builder();
}

public Builder parentPermission(Permission parentPermission) {
rule.parentPermission = parentPermission;
return this;
}

public Builder consequence(Duty consequence) {
rule.consequences.add(consequence);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,11 @@ public static Builder newInstance() {
}

public Builder duty(Duty duty) {
duty.setParentPermission(rule);
rule.duties.add(duty);
return this;
}

public Builder duties(List<Duty> duties) {
for (var duty : duties) {
duty.setParentPermission(rule);
}
rule.duties.addAll(duties);
return this;
}
Expand Down

0 comments on commit 0843fe4

Please sign in to comment.