[midPoint-git] [Evolveum/prism] 487a0b: Apply filter definition on filter value
Andrej
noreply at github.com
Fri Jan 24 09:57:37 CET 2025
Branch: refs/heads/bugfix/10048
Home: https://github.com/Evolveum/prism
Commit: 487a0bac7b29df57718e29358a4b61266c1930eb
https://github.com/Evolveum/prism/commit/487a0bac7b29df57718e29358a4b61266c1930eb
Author: Andrej Zan <andrej.zan at evolveum.com>
Date: 2025-01-24 (Fri, 24 Jan 2025)
Changed paths:
M infra/prism-impl/src/main/java/com/evolveum/midpoint/prism/impl/PrismPropertyValueImpl.java
M infra/prism-impl/src/main/java/com/evolveum/midpoint/prism/impl/query/ValueFilterImpl.java
Log Message:
-----------
Apply filter definition on filter value
**What**
Apply filter definition (if any) to all filter values.
**Why**
It may happen (e.g. when defined by UI or script), that in time of
filter creation, the value passed to filter is not of the same type as
specified by the definition itself. For some types it is fine (e.g.
String value, PolyString in definition), because they can be converted.
In order to "force" this conversion, the definition is now applied to
the value on following circumstances:
- Filter is created with both value(s) and definition
- Definition is set to the filter after its creation (via setter)
- Value(s) is added to the filter after its creation (via setter)
The reason, why we want to convert the types using the definition is,
that value of this filter may be part of matching with value from
repository. Depending on the matcher and normalizer, it may happen that
during comparison of those two values, there will be thrown
`ClassCastException`, because the types are different and can't be
directly cast-ed.
**Note**
The application of definition to value may fail (e.g. when types are not
"convertible"). We decided to ignore this event (`SchemaException`) and
silently "swallow" it. The reason for this unfortunate thing is that (at
this moment) we don't want to change API contract and break backward
compatibility, because these filters can be used directly via user's
scripts.
**Fixes**: MID-10048
To unsubscribe from these emails, change your notification settings at https://github.com/Evolveum/prism/settings/notifications
More information about the midPoint-svn
mailing list