universAAL / middleware

The core software that uses semantic matchmaking for brokering messages among participants of an open distributed system.
10 stars 3 forks source link

Cannot parse a ContextEvent with invovledHumanUser #507

Closed Alfiva closed 4 years ago

Alfiva commented 5 years ago

When parsing (deserializing) a ContextEvent that includes the involvedHumanUser property, this property is not parsed and is not present in the resulting ContextEvent.

This apparently happens because parsing uses the generic setProperty method of ContextEvent to set the parsed properties. The way I see it, this setProperty method cannot logically deal with invovledHumanUser, even though it seems to check it. This is in ContextEvent:640

} else if (propURI.equals(PROP_INVOLVED_HUMAN_USER)) {
            if (value instanceof Resource)
                return setInvolvedUser((Resource) value);

However, BEFORE reaching there, there is this, which essentially turns the above code unreachable. ContextEvent:618

} else if (value instanceof Resource) {
            if (propURI.equals(PROP_RDF_SUBJECT))
                return setRDFSubject((Resource) value);
            else if (propURI.equals(PROP_RDF_PREDICATE))
                return setRDFPredicate(((Resource) value).getURI());
}

Am I getting this right? Can I just rearrange the if clauses to fix this? This bug only affects involvedHumanUser, which for whatever reason is the only property being checked with the predicate first and the object type second.

Alfiva commented 4 years ago

This was originally Context # 484, but should have been here in Middleware. It is fixed in 24ab45f19b37b8ad7409cb23a85d6cfa27412b46