This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 5984d02b905d924261b7713415fc5482d1e555c6 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Thu Feb 3 09:55:42 2022 +0100 More efficient and silent handling of `PropertyValue` when the given name is not a property of the feature. --- .../main/java/org/apache/sis/filter/PropertyValue.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/core/sis-feature/src/main/java/org/apache/sis/filter/PropertyValue.java b/core/sis-feature/src/main/java/org/apache/sis/filter/PropertyValue.java index 80e5bc7..066e65a 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/filter/PropertyValue.java +++ b/core/sis-feature/src/main/java/org/apache/sis/filter/PropertyValue.java @@ -221,13 +221,7 @@ split: if (path != null) { */ @Override public Object apply(final Feature instance) { - if (instance != null) try { - return instance.getPropertyValue(name); - } catch (PropertyNotFoundException e) { - warning(e, true); - // Null will be returned below. - } - return null; + return (instance != null) ? instance.getValueOrFallback(name, null) : null; } /** @@ -289,10 +283,7 @@ split: if (path != null) { @Override public V apply(final Feature instance) { if (instance != null) try { - return ObjectConverters.convert(instance.getPropertyValue(name), type); - } catch (PropertyNotFoundException e) { - warning(e, true); - // Null will be returned below. + return ObjectConverters.convert(instance.getValueOrFallback(name, null), type); } catch (UnconvertibleObjectException e) { warning(e, false); } @@ -436,9 +427,7 @@ split: if (path != null) { @Override public V apply(final Feature instance) { if (instance != null) try { - return converter.apply(source.cast(instance.getPropertyValue(name))); - } catch (PropertyNotFoundException e) { - warning(e, true); + return converter.apply(source.cast(instance.getValueOrFallback(name, null))); } catch (ClassCastException | UnconvertibleObjectException e) { warning(e, false); }