diff --git a/CHANGELOG.md b/CHANGELOG.md index 0748c2797..2c8ed723f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,16 +8,17 @@ _**For better traceability add the corresponding GitHub issue number in each cha ## [Unreleased] -### Added -- Added api key authentication for edc notification requests - -### Changed +### Changed +- Resolve Null pointer exception while registering the company #888 - Added the discovery type configurable, with a default value of bpnl in (ConnectorEndpointsService) (#12) ### Removed - Removed subjectId from AssetAdministrationShellDescriptor object +### Added +- Added api key authentication for edc notification requests + ## [5.4.1] - 2024-08-19 ### Fixed diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/policy/ConstraintCheckerService.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/policy/ConstraintCheckerService.java index 3a13d6816..04294584e 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/policy/ConstraintCheckerService.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/policy/ConstraintCheckerService.java @@ -23,11 +23,10 @@ ********************************************************************************/ package org.eclipse.tractusx.irs.edc.client.policy; -import java.util.Collections; import java.util.List; -import java.util.Optional; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.ListUtils; import org.eclipse.edc.policy.model.AndConstraint; import org.eclipse.edc.policy.model.AtomicConstraint; import org.eclipse.edc.policy.model.Constraint; @@ -60,8 +59,8 @@ private boolean isValidOnList(final Constraint constraint, final List isSameAs(atomicConstraint, p)) - || acceptedConstraints.getAnd().stream().anyMatch(p -> isSameAs(atomicConstraint, p)); + return ListUtils.emptyIfNull(acceptedConstraints.getOr()).stream().anyMatch(p -> isSameAs(atomicConstraint, p)) + || ListUtils.emptyIfNull(acceptedConstraints.getAnd()).stream().anyMatch(p -> isSameAs(atomicConstraint, p)); } if (constraint instanceof AndConstraint andConstraint) { @@ -74,15 +73,15 @@ private boolean isSameAs(final Constraint constraint, final Constraints accepted return andConstraint.getConstraints() .stream() - .allMatch(constr -> isInList(constr, Optional.ofNullable(acceptedConstraints.getAnd()) - .orElse(Collections.emptyList()))); + .allMatch(constr -> isInList(constr, + ListUtils.emptyIfNull(acceptedConstraints.getAnd()))); } if (constraint instanceof OrConstraint orConstraint) { return orConstraint.getConstraints() .stream() - .anyMatch(constr -> isInList(constr, Optional.ofNullable(acceptedConstraints.getOr()) - .orElse(Collections.emptyList()))); + .anyMatch(constr -> isInList(constr, + ListUtils.emptyIfNull(acceptedConstraints.getOr()))); } return false; @@ -108,5 +107,4 @@ private boolean isSameAs(final AtomicConstraint atomicConstraint, .build() .isValid(); } - }