sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch master updated: Fix a ClassCastException reported on mailing list.
Date Tue, 18 Feb 2020 22:58:46 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sis.git


The following commit(s) were added to refs/heads/master by this push:
     new 0535125  Fix a ClassCastException reported on mailing list.
0535125 is described below

commit 05351257e4f5b8e75ac2686318827020c3ac4145
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