sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ama...@apache.org
Subject [sis] 07/07: fix(Feature): delegates expression value type conversion if needed.
Date Fri, 30 Jul 2021 16:49:43 GMT
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 <alexis.manin@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;
+                }
+            }
+        }
     }
 }

Mime
View raw message