diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/LensUtil.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/LensUtil.java index 6f15b2ed1d4..6cbca97de07 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/LensUtil.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/LensUtil.java @@ -376,7 +376,8 @@ public void visit(I pvwo) { continue; } if (filterExistingValues && !hasValue(itemExisting, value, valueMatcher, comparator)) { - LOGGER.trace("Value {} NOT deleted to delta for item {} the item does not have that value in {}", + // temporarily changed from .trace to .info in order to assist with problems like MID-2368 + LOGGER.info("Value {} NOT deleted to delta for item {} the item does not have that value in {}", new Object[]{value, itemPath, contextDescription}); continue; } diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ConsolidationProcessor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ConsolidationProcessor.java index c104b71468d..42b4bb48dc9 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ConsolidationProcessor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ConsolidationProcessor.java @@ -76,7 +76,7 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowAssociationType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; -import org.apache.commons.lang.Validate; +import org.apache.commons.lang.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -331,8 +331,13 @@ public int compare(PrismContainerValue o1, PrismReference ref1 = o1.findReference(ShadowAssociationType.F_SHADOW_REF); PrismReference ref2 = o2.findReference(ShadowAssociationType.F_SHADOW_REF); - - if (ref1.equals(ref2)){ + + // We do not want to compare references in details. Comparing OIDs suffices. + // Otherwise we get into problems, as one of the references might be e.g. without type, + // causing unpredictable behavior (MID-2368) + String oid1 = ref1 != null ? ref1.getOid() : null; + String oid2 = ref2 != null ? ref2.getOid() : null; + if (ObjectUtils.equals(oid1, oid2)) { return 0; }