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 c9abccd Fix `IndexOutOfBoundsException` which was thrown when `FeatureSet` has no geometry property. The fix is indirect, by making an `isEmpty` flag to become `true` when there is no geometry. This is an attempt to address the https://github.com/apache/sis/pull/22 pull request without discarding the whole feature (features without geometry should be legal). c9abccd is described below commit c9abccdfef31e050d214a5ba70c82ffe86c77020 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Thu Oct 14 23:03:58 2021 +0200 Fix `IndexOutOfBoundsException` which was thrown when `FeatureSet` has no geometry property. The fix is indirect, by making an `isEmpty` flag to become `true` when there is no geometry. This is an attempt to address the https://github.com/apache/sis/pull/22 pull request without discarding the whole feature (features without geometry should be legal). --- .../src/main/java/org/apache/sis/internal/netcdf/FeatureSet.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/FeatureSet.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/FeatureSet.java index cd7f4aa..4f37dde 100644 --- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/FeatureSet.java +++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/FeatureSet.java @@ -64,7 +64,7 @@ import org.opengis.feature.Attribute; * It may be inefficient unless the {@link Decoder} uses a {@code ChannelDataInput} backed by a direct buffer. * * @author Martin Desruisseaux (Geomatys) - * @version 1.1 + * @version 1.2 * @since 0.8 * @module */ @@ -141,6 +141,10 @@ final class FeatureSet extends DiscreteSampling { * <li>{@link GeometryType#LINEAR} with coordinates stored in {@link #dynamicProperties}.</li> * </ul> * + * If there is no coordinates ({@link #referencingDimension} = 0), then this field shall be {@code true}. + * This is a convenience for the way we compute an {@code isEmpty} flag in {@code tryAdvance(Consumer)}. + * This policy may change in any future version. + * * @see #TRAJECTORY * @see #getReferencingDimension(boolean) */ @@ -195,8 +199,8 @@ final class FeatureSet extends DiscreteSampling { this.properties = properties; this.dynamicProperties = dynamicProperties; this.referencingDimension = selectedAxes.size(); + this.isTrajectory = isTrajectory | (referencingDimension == 0); this.hasTime = hasTime; - this.isTrajectory = isTrajectory; /* * We will create a description of the features to be read with following properties: *