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 2022/12/09 18:27:05 UTC

[sis] 03/07: Fix an exception when parsing a WKT results in two or more identifiers on an object. This problem does not exist on the "geoapi-4.0" branch because the `ReferenceIdentifier` interface is specific to GeoAPI 3.x.

This is an automated email from the ASF dual-hosted git repository.

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

commit fee1fa85b1da7d217de996e017aeb41f8c22b69c
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Dec 9 18:59:55 2022 +0100

    Fix an exception when parsing a WKT results in two or more identifiers on an object.
    This problem does not exist on the "geoapi-4.0" branch because the `ReferenceIdentifier` interface is specific to GeoAPI 3.x.
---
 .../main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
index 4ae099d821..63b760f66d 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
@@ -90,6 +90,9 @@ import org.apache.sis.util.iso.Types;
 
 import static java.util.Collections.singletonMap;
 
+// Branch-dependent imports
+import org.opengis.referencing.ReferenceIdentifier;
+
 
 /**
  * Well Known Text (WKT) parser for referencing objects. This include, but is not limited too,
@@ -455,11 +458,11 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo
                     codeSpace, code, (version != null) ? version.toString() : null, null);
             final Object previous = properties.put(IdentifiedObject.IDENTIFIERS_KEY, id);
             if (previous != null) {
-                Identifier[] identifiers;
-                if (previous instanceof Identifier) {
-                    identifiers = new Identifier[] {(Identifier) previous, id};
+                ReferenceIdentifier[] identifiers;
+                if (previous instanceof ReferenceIdentifier) {
+                    identifiers = new ReferenceIdentifier[] {(ReferenceIdentifier) previous, id};
                 } else {
-                    identifiers = (Identifier[]) previous;
+                    identifiers = (ReferenceIdentifier[]) previous;
                     final int n = identifiers.length;
                     identifiers = Arrays.copyOf(identifiers, n + 1);
                     identifiers[n] = id;