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

asf-gitbox-commits 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 e6d143773b chore(Geometry): remove TWKB flavor, found no usage of it 
outside postgis and format is experimental
e6d143773b is described below

commit e6d143773b01cc54df514e60cb1f49ae3010a792
Author: jsorel <[email protected]>
AuthorDate: Wed Sep 16 16:28:40 2026 +0200

    chore(Geometry): remove TWKB flavor, found no usage of it outside postgis 
and format is experimental
---
 .../sis/geometries/adapter/WellKnownBinary.java    | 22 +---------------------
 .../geometries/adapter/WellKnownBinaryTest.java    | 13 ++++---------
 2 files changed, 5 insertions(+), 30 deletions(-)

diff --git 
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/WellKnownBinary.java
 
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/WellKnownBinary.java
index c07baf3adb..d604d5d123 100644
--- 
a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/WellKnownBinary.java
+++ 
b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/geometries/adapter/WellKnownBinary.java
@@ -164,14 +164,7 @@ public final class WellKnownBinary {
          * are still understood, so a plain Well-Known Binary decodes 
unchanged. The converse does
          * not hold — the {@code OGC} dialect rejects the high order bits.</p>
          */
-        EWKB,
-
-        /**
-         * The <cite>Tiny Well-Known Binary</cite> of TWKB 1.0.
-         * Not implemented yet: {@link #encode encode(…)} and {@link #decode 
decode(…)} throw
-         * an {@link UnsupportedOperationException} for this flavor.
-         */
-        TWKB
+        EWKB
     }
 
     /**
@@ -288,17 +281,6 @@ public final class WellKnownBinary {
         return flavor;
     }
 
-    /**
-     * Verifies that the dialect of this codec is implemented.
-     *
-     * @throws UnsupportedOperationException if it is not.
-     */
-    private void ensureImplemented() {
-        if (flavor == Flavor.TWKB) {
-            throw new UnsupportedOperationException("The " + flavor + " flavor 
is not implemented yet.");
-        }
-    }
-
     /**
      * Returns the Well-Known Binary of the given geometry.
      *
@@ -310,7 +292,6 @@ public final class WellKnownBinary {
      */
     public byte[] encode(final Geometry geom) {
         ArgumentChecks.ensureNonNull("geom", geom);
-        ensureImplemented();
         final Output out = new Output(byteOrder);
         if (flavor == Flavor.EWKB) {
             out.setSrid(Srid.of(geom.getCoordinateReferenceSystem()));
@@ -349,7 +330,6 @@ public final class WellKnownBinary {
      */
     public Geometry decode(final byte[] geom, final CoordinateReferenceSystem 
crs) {
         ArgumentChecks.ensureNonNull("geom", geom);
-        ensureImplemented();
         return new WellKnownBinaryParser(geom, crs, flavor).parse();
     }
 
diff --git 
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/adapter/WellKnownBinaryTest.java
 
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/adapter/WellKnownBinaryTest.java
index b1d865ef13..211297657c 100644
--- 
a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/adapter/WellKnownBinaryTest.java
+++ 
b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/geometries/adapter/WellKnownBinaryTest.java
@@ -532,18 +532,13 @@ public final class WellKnownBinaryTest {
     }
 
     /**
-     * Verifies that the dialect which is not implemented yet says so instead 
of writing
-     * something else.
+     * Verifies that a dialect and a byte order are required when one is asked 
for.
      */
     @Test
-    public void testUnimplementedFlavor() {
-        final WellKnownBinary twkb = new 
WellKnownBinary(WellKnownBinary.Flavor.TWKB);
-        assertEquals(WellKnownBinary.Flavor.TWKB, twkb.getFlavor());
-        final Geometry geometry = wkt.decode("POINT (1 2)");
-        final byte[] bytes = wkb.encode(geometry);
-        assertThrows(UnsupportedOperationException.class, () -> 
twkb.encode(geometry));
-        assertThrows(UnsupportedOperationException.class, () -> 
twkb.decode(bytes));
+    public void testNullFlavor() {
         assertThrows(NullPointerException.class, () -> new 
WellKnownBinary((WellKnownBinary.Flavor) null));
+        assertThrows(NullPointerException.class, () -> new 
WellKnownBinary(null, ByteOrder.BIG_ENDIAN));
+        assertThrows(NullPointerException.class, () -> new 
WellKnownBinary(WellKnownBinary.Flavor.OGC, null));
     }
 
     /**

Reply via email to