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 363c87b822 Adjustment in warning or error messages produced by the 
GIMI reader.
363c87b822 is described below

commit 363c87b8226a138269f627deea9efbb169c77a6d
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Wed Dec 10 16:49:21 2025 +0100

    Adjustment in warning or error messages produced by the GIMI reader.
---
 .../org/apache/sis/storage/isobmff/Reader.java     |  6 ++---
 .../apache/sis/storage/isobmff/gimi/ModelCRS.java  | 28 +++++++++++++++-------
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git 
a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/Reader.java
 
b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/Reader.java
index 49102adb12..aa19fdaf51 100644
--- 
a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/Reader.java
+++ 
b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/Reader.java
@@ -202,7 +202,7 @@ public final class Reader implements Cloneable {
         } catch (DataStoreException cause) {
             box = null;
             if (isNewWarning(type, Classes.getClass(cause))) {
-                var record = new LogRecord(Level.WARNING, "Cannot read the \"" 
+ Box.formatFourCC(type) + "\" box.");
+                var record = new LogRecord(Level.WARNING, "Cannot read the “" 
+ Box.formatFourCC(type) + "” box.");
                 record.setThrown(cause);
                 listeners.warning(record);
             }
@@ -339,7 +339,7 @@ public final class Reader implements Cloneable {
             if (type instanceof Integer fourCC) {
                 type = Box.formatFourCC(fourCC);
             }
-            var record = new LogRecord(Level.FINE, "The \"" + type + "\" type 
of box is unrecognized.");
+            var record = new LogRecord(Level.WARNING, "The “" + type + "” type 
of box is unrecognized.");
             listeners.warning(record);
         }
     }
@@ -355,7 +355,7 @@ public final class Reader implements Cloneable {
     public final void unexpectedChildType(final int container, final int 
child) {
         if (isNewWarning(container, child)) {
             final var message = new StringBuilder("Container box 
“").append(Box.formatFourCC(container))
-                    .append("” cannot contain children of type 
“").append(Box.formatFourCC(child)).append("\".");
+                    .append("” cannot contain children of type 
“").append(Box.formatFourCC(child)).append("”.");
             listeners.warning(message.toString());
         }
     }
diff --git 
a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelCRS.java
 
b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelCRS.java
index 51331dcf54..2bf9c93b78 100644
--- 
a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelCRS.java
+++ 
b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelCRS.java
@@ -17,6 +17,8 @@
 package org.apache.sis.storage.isobmff.gimi;
 
 import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
 import java.io.IOException;
 import org.opengis.util.FactoryException;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -125,15 +127,25 @@ public final class ModelCRS extends FullBox {
      * @return the coordinate reference system parsed from the Well Known 
Text, or {@code null} if none or unparsable.
      */
     public CoordinateReferenceSystem toCRS(final StoreListeners listeners) {
-        if (crs != null) try {
-            switch (crsEncoding) {
-                case CURI: // Fall through.
-                case CRSU: return CRS.forCode(crs);
-                case WKT2: return CRS.fromWKT(crs);
-                default: listeners.warning("Unknown CRS encoding: " + 
formatFourCC(crsEncoding));
+        if (crs != null) {
+            LogRecord warning;
+            try {
+                switch (crsEncoding) {
+                    case CURI: // Fall through.
+                    case CRSU: return CRS.forCode(crs);
+                    case WKT2: return CRS.fromWKT(crs);
+                    default: {
+                        warning = new LogRecord(Level.WARNING, "Unknown CRS 
encoding: “" + formatFourCC(crsEncoding) + "”.");
+                        break;
+                    }
+                }
+            } catch (FactoryException e) {
+                warning = new LogRecord(Level.WARNING, "Cannot decode the 
CRS.");
+                warning.setThrown(e);
             }
-        } catch (FactoryException e) {
-            listeners.warning(e);
+            warning.setSourceClassName(ModelCRS.class.getName());
+            warning.setSourceMethodName("toCRS");
+            listeners.warning(warning);
         }
         return null;
     }

Reply via email to