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


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 843e15d6d6 Fix the error message when a datum shift grid file has not 
been found. Opportunistic minor code formatting.
843e15d6d6 is described below

commit 843e15d6d6043fdc9a64c7ad7f796efda7dc60a1
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Thu Jul 17 16:08:53 2025 +0200

    Fix the error message when a datum shift grid file has not been found.
    Opportunistic minor code formatting.
---
 .../org/apache/sis/referencing/operation/gridded/GridFile.java |  8 +++++---
 .../referencing/operation/transform/AbstractMathTransform.java |  2 +-
 .../org/apache/sis/referencing/privy/AffineTransform2D.java    | 10 +++++-----
 .../operation/transform/InterpolatedTransformTest.java         |  2 +-
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/gridded/GridFile.java
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/gridded/GridFile.java
index 427c31ddcd..f09e562078 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/gridded/GridFile.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/gridded/GridFile.java
@@ -283,10 +283,12 @@ public final class GridFile {
                                        Resources.Keys.DatumChangesDirectory_1, 
directory));
             }
         }
-        if (cause instanceof NoSuchFileException || cause instanceof 
FileNotFoundException) {
-            return new 
MissingFactoryResourceException(Resources.format(Resources.Keys.FileNotFound_2),
 cause);
+        final boolean notFound = cause instanceof NoSuchFileException || cause 
instanceof FileNotFoundException;
+        String message = Resources.format(notFound ? 
Resources.Keys.FileNotFound_2 : Resources.Keys.FileNotReadable_2, format, 
parameter);
+        if (notFound) {
+            return new MissingFactoryResourceException(message, cause);
         } else {
-            return new 
FactoryDataException(Resources.format(Resources.Keys.FileNotReadable_2, format, 
parameter), cause);
+            return new FactoryDataException(message, cause);
         }
     }
 
diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
index 6882493c7a..1a123095d6 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
@@ -338,7 +338,7 @@ public abstract class AbstractMathTransform extends 
FormattableObject
              * Destination not set. We are going to create the destination 
here. Since we know that the
              * destination will be the SIS implementation, write directly into 
the `coordinates` array.
              */
-            final GeneralDirectPosition destination = new 
GeneralDirectPosition(dimTarget);
+            final var destination = new GeneralDirectPosition(dimTarget);
             final double[] source;
             if (dimSource <= dimTarget) {
                 source = destination.coordinates;
diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/privy/AffineTransform2D.java
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/privy/AffineTransform2D.java
index f13dd18427..5610890dbe 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/privy/AffineTransform2D.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/privy/AffineTransform2D.java
@@ -271,19 +271,19 @@ public class AffineTransform2D extends 
ImmutableAffineTransform
          */
         if (ptDst == ptSrc) {
             if (ptSrc instanceof Point2D) {
-                final Point2D point = (Point2D) ptSrc;
+                final var point = (Point2D) ptSrc;
                 super.transform(point, point);
                 return ptSrc;
             }
         } else {
             if (ptDst == null) {
-                final DirectPosition2D point = new 
DirectPosition2D(ptSrc.getCoordinate(0), ptSrc.getCoordinate(1));
+                final var point = new DirectPosition2D(ptSrc.getCoordinate(0), 
ptSrc.getCoordinate(1));
                 super.transform(point, point);
                 return point;
             }
             ArgumentChecks.ensureDimensionMatches("ptDst", DIMENSION, ptDst);
             if (ptDst instanceof Point2D) {
-                final Point2D point = (Point2D) ptDst;
+                final var point = (Point2D) ptDst;
                 point.setLocation(ptSrc.getCoordinate(0), 
ptSrc.getCoordinate(1));
                 super.transform(point, point);
                 return ptDst;
@@ -292,7 +292,7 @@ public class AffineTransform2D extends 
ImmutableAffineTransform
         /*
          * At this point, we have no choice to create a temporary Point2D.
          */
-        final Point2D.Double point = new 
Point2D.Double(ptSrc.getCoordinate(0), ptSrc.getCoordinate(1));
+        final var point = new Point2D.Double(ptSrc.getCoordinate(0), 
ptSrc.getCoordinate(1));
         super.transform(point, point);
         ptDst.setCoordinate(0, point.x);
         ptDst.setCoordinate(1, point.y);
@@ -479,7 +479,7 @@ public class AffineTransform2D extends 
ImmutableAffineTransform
      */
     @Override
     public String toWKT() {
-        final Formatter formatter = new Formatter();
+        final var formatter = new Formatter();
         formatter.append(this);
         return formatter.toWKT();
     }
diff --git 
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/InterpolatedTransformTest.java
 
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/InterpolatedTransformTest.java
index 74440e6d1e..4a5b833a9a 100644
--- 
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/InterpolatedTransformTest.java
+++ 
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/InterpolatedTransformTest.java
@@ -61,7 +61,7 @@ public final class InterpolatedTransformTest extends 
MathTransformTestCase {
      *         with source coordinates in the first array and target 
coordinates in the second array.
      */
     private double[][] createSinusoidal(final double rotation) throws 
TransformException {
-        final SinusoidalShiftGrid grid = new SinusoidalShiftGrid(rotation);
+        final var grid = new SinusoidalShiftGrid(rotation);
         transform = new InterpolatedTransform(grid);
         return grid.samplePoints();
     }

Reply via email to