This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-3.1 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 3790759e6474cada3fdc9d075f765d7cd3aa93e7 Author: Martin Desruisseaux <[email protected]> AuthorDate: Thu May 16 18:51:26 2024 +0200 Reintroduce `MismatchedReferenceSystemException` as a deprecated class for transition between the `main` and the `geoapi-3.1` branches. --- .../main/org/apache/sis/portrayal/Canvas.java | 4 +- .../sis/geometry/AbstractDirectPosition.java | 2 +- .../org/apache/sis/geometry/AbstractEnvelope.java | 2 +- .../MismatchedReferenceSystemException.java | 66 ++++++++++++++++++++++ .../apache/sis/referencing/internal/RTreeNode.java | 6 +- 5 files changed, 73 insertions(+), 7 deletions(-) diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/Canvas.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/Canvas.java index 418a5c2842..fc4961c748 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/Canvas.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/Canvas.java @@ -58,7 +58,7 @@ import org.apache.sis.coverage.grid.GridGeometry; import org.apache.sis.coverage.grid.GridExtent; // Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.coordinate.MismatchedCoordinateMetadataException; +import org.apache.sis.geometry.MismatchedReferenceSystemException; import org.opengis.coverage.CannotEvaluateException; @@ -796,7 +796,7 @@ public class Canvas extends Observable implements Localized { ArgumentChecks.ensureNonNull(DISPLAY_BOUNDS_PROPERTY, newValue); final CoordinateReferenceSystem crs = newValue.getCoordinateReferenceSystem(); if (crs != null && !Utilities.equalsIgnoreMetadata(getDisplayCRS(), crs)) { - throw new MismatchedCoordinateMetadataException(errors().getString( + throw new MismatchedReferenceSystemException(errors().getString( Errors.Keys.IllegalCoordinateSystem_1, IdentifiedObjects.getDisplayName(crs, getLocale()))); } final GeneralEnvelope oldValue = new GeneralEnvelope(displayBounds); diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractDirectPosition.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractDirectPosition.java index c802d204d7..105700399d 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractDirectPosition.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractDirectPosition.java @@ -138,7 +138,7 @@ public abstract class AbstractDirectPosition extends FormattableObject implement if (crs != null) { final CoordinateReferenceSystem other = position.getCoordinateReferenceSystem(); if (other != null && !Utilities.equalsIgnoreMetadata(crs, other)) { - throw new MismatchedCoordinateMetadataException(Errors.format(Errors.Keys.MismatchedCRS)); + throw new MismatchedReferenceSystemException(Errors.format(Errors.Keys.MismatchedCRS)); } } for (int i=0; i<dimension; i++) { diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractEnvelope.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractEnvelope.java index 4bd1071ed9..89f1a85b42 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractEnvelope.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractEnvelope.java @@ -197,7 +197,7 @@ public abstract class AbstractEnvelope extends FormattableObject implements Enve return crs2; } else { if (crs2 != null && !crs1.equals(crs2)) { - throw new MismatchedCoordinateMetadataException(Errors.format(Errors.Keys.MismatchedCRS)); + throw new MismatchedReferenceSystemException(Errors.format(Errors.Keys.MismatchedCRS)); } return crs1; } diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/MismatchedReferenceSystemException.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/MismatchedReferenceSystemException.java new file mode 100644 index 0000000000..e8c12a6908 --- /dev/null +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/MismatchedReferenceSystemException.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sis.geometry; + +import org.opengis.coordinate.MismatchedCoordinateMetadataException; + + +/** + * Indicates that an object cannot be constructed because of a mismatch in the + * reference systems of components. + * + * @author Martin Desruisseaux (IRD) + * @since 0.3 + * @version 0.3 + * + * @deprecated Replaced by {@link MismatchedCoordinateMetadataException}. + */ +@Deprecated(since = "2.0") // Temporary version number until this branch is released. +public class MismatchedReferenceSystemException extends MismatchedCoordinateMetadataException { + /** + * Serial number for inter-operability with different versions. + */ + private static final long serialVersionUID = 6222334569692693273L; + + /** + * Creates an exception with no message. + */ + public MismatchedReferenceSystemException() { + super(); + } + + /** + * Creates an exception with the specified message. + * + * @param message The detail message. The detail message is saved for + * later retrieval by the {@link #getMessage()} method. + */ + public MismatchedReferenceSystemException(final String message) { + super(message); + } + + /** + * Creates an exception with the specified message and cause. + * + * @param message The detail message. The detail message is saved for + * later retrieval by the {@link #getMessage()} method. + * @param cause The cause. + */ + public MismatchedReferenceSystemException(final String message, final Throwable cause) { + super(message, cause); + } +} diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/RTreeNode.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/RTreeNode.java index 6233155598..6b699e66f1 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/RTreeNode.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/RTreeNode.java @@ -30,8 +30,8 @@ import org.apache.sis.util.collection.TreeTable; import org.apache.sis.util.collection.TableColumn; import org.apache.sis.util.collection.DefaultTreeTable; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.coordinate.MismatchedCoordinateMetadataException; +// Specific to the main and geoapi-3.1 branches: +import org.apache.sis.geometry.MismatchedReferenceSystemException; /** @@ -251,7 +251,7 @@ detach: for (RTreeNode next; node != null; node = next) { if (common == null) { common = crs; } else if (crs != null && !Utilities.equalsIgnoreMetadata(common, crs)) { - throw new MismatchedCoordinateMetadataException(Errors.format(Errors.Keys.MismatchedCRS)); + throw new MismatchedReferenceSystemException(Errors.format(Errors.Keys.MismatchedCRS)); } } }
