sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 01/02: Fix a ClassCastException reported on mailing list.
Date Tue, 18 Feb 2020 23:38:26 GMT
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 6f54acf4ba79f884fb5a010ee27d8d28236bb0a9
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Tue Feb 18 23:56:26 2020 +0100

    Fix a ClassCastException reported on mailing list.
---
 .../operation/transform/SpecializableTransform.java            | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
index 1d9e306..d86fa95 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
@@ -254,7 +254,15 @@ class SpecializableTransform extends AbstractMathTransform implements
Serializab
      * we do not know what was the last search result.
      */
     private SubArea locate(final DirectPosition pos) {
-        return (SubArea) RTreeNode.locate(domains, pos);
+        /*
+         * All nodes should be SubArea instances, except in some circumstances the root node.
+         * That root node may returned by `RTreeNode.locate(…)` if given position is inside
+         * the union of all bounding boxes, but not in the bounding box of any specific grid.
+         * In such case the caller will fallback on `DatumShiftGridGroup.interpolateInCell(…)`
+         * which perform a more extensive search for the nearest grid.
+         */
+        final RTreeNode node = RTreeNode.locate(domains, pos);
+        return (node instanceof SubArea) ? (SubArea) node : null;
     }
 
     /**


Mime
View raw message