You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by am...@apache.org on 2021/07/30 16:49:43 UTC
[sis] 07/07: fix(Feature): delegates expression value type
conversion if needed.
This is an automated email from the ASF dual-hosted git repository.
amanin pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 7943c4e53d54979cd817798e373fcf34d6655332
Author: Alexis Manin <al...@geomatys.com>
AuthorDate: Fri Jul 30 18:38:23 2021 +0200
fix(Feature): delegates expression value type conversion if needed.
---
.../main/java/org/apache/sis/filter/LeafExpression.java | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/core/sis-feature/src/main/java/org/apache/sis/filter/LeafExpression.java b/core/sis-feature/src/main/java/org/apache/sis/filter/LeafExpression.java
index 900c892..2ce4390 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/filter/LeafExpression.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/filter/LeafExpression.java
@@ -192,5 +192,19 @@ abstract class LeafExpression<R,V> extends Node implements FeatureExpression<R,V
public Expression<? super R, ? extends V> optimize(final Optimization optimization) {
return new Literal<>(getValue());
}
+
+ @Override
+ public <N> Expression<R, N> toValueType(Class<N> type) {
+ try {
+ return super.toValueType(type);
+ } catch (RuntimeException e) {
+ try {
+ return original.toValueType(type);
+ } catch (RuntimeException bis) {
+ e.addSuppressed(bis);
+ throw e;
+ }
+ }
+ }
}
}