Skip to content

Commit

Permalink
fix(contract-check): fixed bug with contract filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Brunkow Moser committed May 12, 2024
1 parent 9000e7a commit a34cc1e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,22 +167,7 @@ static public Set build(Object rawPolicy){

// Check if its null
if(permission == null || prohibition == null || obligation == null){
if (permission != null) {
LogUtil.printMessage("DEBUG: Permission: "+ permission.toPrettyString());
}else{
LogUtil.printMessage("DEBUG: Permission is null!");
}
if (prohibition != null) {
LogUtil.printMessage("DEBUG: Prohibition: "+ prohibition.toPrettyString());
}else{
LogUtil.printMessage("DEBUG: Prohibition is null!");
}
if (obligation != null) {
LogUtil.printMessage("DEBUG: Obligation: "+ obligation.toPrettyString());
}else{
LogUtil.printMessage("DEBUG: Obligation is null!");
}
throw new ModelException(Set.class.getName(), "One of the mandatory fields where not found!");
throw new ModelException(Set.class.getName(), "One of the mandatory fields where not found! This is not a valid policy set!");
}
// Check if all them are array then parse as default
if(permission.isArray() && prohibition.isArray() && obligation.isArray()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ public NegotiationRequest buildRequest(Dataset dataset, String endpoint, String
*
*/
public Set selectPolicyByIndex(Object policies, Integer defaultIndex){
Set policy = null;
if(policies instanceof LinkedHashMap){
return Set.build(policies);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public Map<String, Dataset> filterValidContracts(Map<String, Dataset> contracts,
*/
public Boolean isContractValid(Dataset contract, PolicyCheckConfig policyConfig){
try {
return policyUtil.getValidPoliciesByConstraints(contract, policyConfig).size() > 0; // If any policy is found the contract is valid
return policyUtil.getValidPoliciesByConstraints(contract.getPolicy(), policyConfig).size() > 0; // If any policy is found the contract is valid
} catch (Exception e) {
throw new UtilException(EdcUtil.class, e, "It was not possible to check if contract is valid");
}
Expand Down

0 comments on commit a34cc1e

Please sign in to comment.