added MPE checks in the mergeOAFDataInfo method

This commit is contained in:
Claudio Atzori 2022-03-25 15:05:17 +01:00
parent b073935a64
commit ffa6bbf392
1 changed files with 8 additions and 3 deletions

View File

@ -70,9 +70,14 @@ public abstract class Oaf implements Serializable {
}
public void mergeOAFDataInfo(Oaf o) {
if (o.getDataInfo() != null && (compareTrust(this, o) < 0 || this.getDataInfo().getInvisible()))
dataInfo = o.getDataInfo();
Optional.ofNullable(o)
.ifPresent(other -> Optional.ofNullable(other.getDataInfo())
.ifPresent(otherDataInfo -> Optional.ofNullable(this.getDataInfo())
.ifPresent(thisDataInfo -> {
if (compareTrust(this, other) < 0 || thisDataInfo.getInvisible()) {
setDataInfo(otherDataInfo);
}
})));
}
protected String extractTrust(Oaf e) {