You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2020/08/06 17:29:01 UTC
[sis] branch master updated: Fix a NullPointerException when transforming coordinates with SpecializableTransform.transform(…) methods working on arrays and the last coordinates are inside a sub-grid. (Cherry-pick from d92bcd3d94d6ebcd54d7703a41785b5bdef7023a)
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 1a2b75e Fix a NullPointerException when transforming coordinates with SpecializableTransform.transform(…) methods working on arrays and the last coordinates are inside a sub-grid. (Cherry-pick from d92bcd3d94d6ebcd54d7703a41785b5bdef7023a)
1a2b75e is described below
commit 1a2b75ed009f9512b10bda82b974ed28b5c962ed
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Thu Aug 6 19:25:19 2020 +0200
Fix a NullPointerException when transforming coordinates with SpecializableTransform.transform(…) methods working on arrays and the last coordinates are inside a sub-grid.
(Cherry-pick from d92bcd3d94d6ebcd54d7703a41785b5bdef7023a)
---
.../operation/transform/SpecializableTransform.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
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 d86fa95..9ebc610 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
@@ -648,24 +648,24 @@ class SpecializableTransform extends AbstractMathTransform implements Serializab
while (numPts > 0) {
SubArea domain = forward.locate(dst);
if (domain == null) {
- dst.offset += dstInc;
+ dst.offset += dstInc; // Skip point for which there is no specialized transform.
numPts--;
continue;
}
do {
- RTreeNode next = domain; // Contains the specialized transform to use.
- int num = (dst.offset - dstOff) / dstInc; // Number of points that are not retransformeD.
- srcOff += num * srcInc; // Skip the source coordinates that are not retransformed.
+ RTreeNode next = domain; // The specialized transform to use in next iteration.
+ int num = (dst.offset - dstOff) / dstInc; // Number of points skipped before this loop.
+ srcOff += num * srcInc; // Make source offset synchronized with target offset.
dstOff = dst.offset; // Destination index of the first coordinate to retransform.
do {
dst.offset += dstInc; // Destination index after the last coordinate to transform.
if (--numPts <= 0) {
- domain = null;
+ next = null; // For telling the second `while` condition to stop.
break;
}
next = RTreeNode.locate(domain, dst);
- } while (next == domain);
- num = (dst.offset - dstOff) / dstInc; // Number of points to retransform.
+ } while (next == domain); // Continue until we find a change of specialized transform.
+ num = (dst.offset - dstOff) / dstInc; // Number of points to transform.
transform.apply(domain.inverse, srcOff, dstOff, num);
domain = (SubArea) next;
srcOff += srcInc * num;