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

commit b4fbe3c1d524d896eacc8a9f53e5ae8836788cb3
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Sat Oct 28 17:58:15 2023 +0200

    Remove NullArgumentException.
    https://issues.apache.org/jira/browse/SIS-562
---
 .../org/apache/sis/coverage/grid/GridGeometry.java |  5 +-
 .../org/apache/sis/coverage/grid/package-info.java |  2 +-
 .../apache/sis/feature/builder/TypeBuilder.java    |  7 +--
 .../apache/sis/feature/builder/package-info.java   |  2 +-
 .../sis/geometry/wrapper/GeometryWrapper.java      |  5 +-
 .../DefaultCoordinateOperationFactory.java         |  5 +-
 .../sis/referencing/operation/package-info.java    |  2 +-
 .../main/org/apache/sis/util/ArgumentChecks.java   | 54 ++++++++---------
 .../org/apache/sis/util/NullArgumentException.java | 67 ----------------------
 .../apache/sis/util/collection/CodeListSet.java    |  5 +-
 .../sis/util/collection/WeakValueHashMap.java      | 11 ++--
 .../apache/sis/util/collection/package-info.java   |  2 +-
 .../apache/sis/util/internal/CheckedArrayList.java |  3 +-
 .../apache/sis/util/internal/CheckedHashSet.java   |  3 +-
 .../main/org/apache/sis/util/package-info.java     |  2 +-
 .../org/apache/sis/util/ArgumentChecksTest.java    |  4 +-
 .../sis/util/internal/CheckedArrayListTest.java    |  5 +-
 17 files changed, 54 insertions(+), 130 deletions(-)

diff --git 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridGeometry.java
 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridGeometry.java
index 75c2397d38..b77e437c60 100644
--- 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridGeometry.java
+++ 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridGeometry.java
@@ -61,7 +61,6 @@ import org.apache.sis.referencing.util.TemporalAccessor;
 import org.apache.sis.referencing.util.AxisDirections;
 import org.apache.sis.metadata.internal.ReferencingServices;
 import org.apache.sis.feature.internal.Resources;
-import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.util.LenientComparable;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.ArgumentChecks;
@@ -132,7 +131,7 @@ import static org.apache.sis.referencing.CRS.findOperation;
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Johann Sorel (Geomatys)
- * @version 1.4
+ * @version 1.5
  * @since   1.0
  */
 public class GridGeometry implements LenientComparable, Serializable {
@@ -661,7 +660,7 @@ public class GridGeometry implements LenientComparable, 
Serializable {
         boolean nilEnvelope = true;
         if (target == null || ((nilEnvelope = target.isAllNaN()) && 
target.getCoordinateReferenceSystem() == null)) {
             if (target != null && nilEnvelope) {
-                throw new 
NullArgumentException(Errors.format(Errors.Keys.UnspecifiedCRS));
+                throw new 
NullPointerException(Errors.format(Errors.Keys.UnspecifiedCRS));
             }
             ArgumentChecks.ensureNonNull("extent", extent);
             this.envelope = null;
diff --git 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/package-info.java
 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/package-info.java
index cd3dd5c96c..1dc6010778 100644
--- 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/package-info.java
+++ 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/package-info.java
@@ -41,7 +41,7 @@
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Johann Sorel (Geomatys)
  * @author  Alexis Manin (Geomatys)
- * @version 1.4
+ * @version 1.5
  * @since   1.0
  */
 package org.apache.sis.coverage.grid;
diff --git 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/builder/TypeBuilder.java
 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/builder/TypeBuilder.java
index 36f9c77e75..91733ca9df 100644
--- 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/builder/TypeBuilder.java
+++ 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/builder/TypeBuilder.java
@@ -26,7 +26,6 @@ import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.apache.sis.feature.AbstractIdentifiedType;
 import org.apache.sis.feature.internal.Resources;
-import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.util.Deprecable;
 import org.apache.sis.util.Localized;
 import org.apache.sis.util.Classes;
@@ -74,7 +73,7 @@ import org.opengis.feature.PropertyNotFoundException;
  *
  * @author  Johann Sorel (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.5
  * @since   0.8
  */
 public abstract class TypeBuilder implements Localized {
@@ -498,7 +497,7 @@ public abstract class TypeBuilder implements Localized {
      */
     final void ensureNonNull(final String name, final Object value) {
         if (value == null) {
-            throw new 
NullArgumentException(errors().getString(Errors.Keys.NullArgument_1, name));
+            throw new 
NullPointerException(errors().getString(Errors.Keys.NullArgument_1, name));
         }
     }
 
@@ -524,7 +523,7 @@ public abstract class TypeBuilder implements Localized {
      */
     final void ensureNonEmpty(final String name, final CharSequence text) {
         if (text == null) {
-            throw new 
NullArgumentException(errors().getString(Errors.Keys.NullArgument_1, name));
+            throw new 
NullPointerException(errors().getString(Errors.Keys.NullArgument_1, name));
         }
         if (text.length() == 0) {
             throw new 
IllegalArgumentException(errors().getString(Errors.Keys.EmptyArgument_1, name));
diff --git 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/builder/package-info.java
 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/builder/package-info.java
index d023f771fe..9fd4e5c3ef 100644
--- 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/builder/package-info.java
+++ 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/feature/builder/package-info.java
@@ -54,7 +54,7 @@
  * @author  Johann Sorel (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Alexis Manin (Geomatys)
- * @version 1.1
+ * @version 1.5
  *
  * @see org.apache.sis.feature.DefaultFeatureType
  *
diff --git 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/geometry/wrapper/GeometryWrapper.java
 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/geometry/wrapper/GeometryWrapper.java
index 2ca785982d..9fd61eb854 100644
--- 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/geometry/wrapper/GeometryWrapper.java
+++ 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/geometry/wrapper/GeometryWrapper.java
@@ -33,7 +33,6 @@ import org.apache.sis.geometry.GeneralEnvelope;
 import org.apache.sis.filter.sqlmm.SQLMM;
 import org.apache.sis.referencing.util.ReferencingUtilities;
 import org.apache.sis.util.UnconvertibleObjectException;
-import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.Debug;
 import org.apache.sis.util.collection.BackingStoreException;
@@ -308,7 +307,7 @@ public abstract class GeometryWrapper extends 
AbstractGeometry implements Geomet
         assert operation.geometryCount() == 1 && operation.maxParamCount == 2 
: operation;
         if (argument == null && operation.minParamCount > 1) {
             // TODO: fetch argument name.
-            throw new 
NullArgumentException(Errors.format(Errors.Keys.NullArgument_1, "arg1"));
+            throw new 
NullPointerException(Errors.format(Errors.Keys.NullArgument_1, "arg1"));
         }
         final Object result = operationSameCRS(operation, null, argument);
         assert isInstance(operation, result) : result;
@@ -335,7 +334,7 @@ public abstract class GeometryWrapper extends 
AbstractGeometry implements Geomet
         assert operation.geometryCount() == 2 && operation.maxParamCount == 3 
: operation;
         if (argument == null && operation.minParamCount > 2) {
             // TODO: fetch argument name.
-            throw new 
NullArgumentException(Errors.format(Errors.Keys.NullArgument_1, "arg2"));
+            throw new 
NullPointerException(Errors.format(Errors.Keys.NullArgument_1, "arg2"));
         }
         final Object result = operationSameCRS(operation, toSameCRS(other), 
argument);
         assert isInstance(operation, result) : result;
diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
index ac24339e24..c31ec1a1ef 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
@@ -44,7 +44,6 @@ import 
org.apache.sis.referencing.util.ReferencingFactoryContainer;
 import org.apache.sis.referencing.util.ReferencingUtilities;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Classes;
-import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.Debug;
 import org.apache.sis.util.internal.Constants;
@@ -87,7 +86,7 @@ import org.apache.sis.util.resources.Errors;
  * This class is safe for multi-thread usage if all referenced factories are 
thread-safe.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 1.4
+ * @version 1.5
  * @since   0.6
  */
 public class DefaultCoordinateOperationFactory extends AbstractFactory 
implements CoordinateOperationFactory {
@@ -519,7 +518,7 @@ next:   for (int i=components.size(); --i >= 0;) {
             final ParameterValueGroup parameters = 
Containers.property(properties,
                     CoordinateOperations.PARAMETERS_KEY, 
ParameterValueGroup.class);
             if (parameters == null) {
-                throw new 
NullArgumentException(Errors.format(Errors.Keys.NullArgument_1, "transform"));
+                throw new 
NullPointerException(Errors.format(Errors.Keys.NullArgument_1, "transform"));
             }
             transform = 
ReferencingUtilities.createBaseToDerived(getMathTransformFactory(), sourceCRS, 
parameters, targetCRS);
         }
diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/package-info.java
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/package-info.java
index d0c563dffa..297e8b6de5 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/package-info.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/package-info.java
@@ -86,7 +86,7 @@
  * for example by specifying the area of interest.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 1.4
+ * @version 1.5
  * @since   0.6
  */
 @XmlSchema(location = 
"http://schemas.opengis.net/gml/3.2.1/coordinateOperations.xsd";,
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/ArgumentChecks.java 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/ArgumentChecks.java
index ff6ee7cd18..ed6eaadb12 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/ArgumentChecks.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/ArgumentChecks.java
@@ -42,7 +42,7 @@ import org.opengis.coverage.grid.GridEnvelope;
  *   <th>Exception</th>
  *   <th class="sep">Thrown by</th>
  * </tr><tr>
- *   <td>{@link NullArgumentException}</td>
+ *   <td>{@link NullPointerException}</td>
  *   <td class="sep">
  *     {@link #ensureNonNull(String, Object) ensureNonNull},
  *     {@link #ensureNonEmpty(String, CharSequence) ensureNonEmpty}.
@@ -88,7 +88,7 @@ import org.opengis.coverage.grid.GridEnvelope;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Alexis Manin (Geomatys)
- * @version 1.4
+ * @version 1.5
  * @since   0.3
  */
 public final class ArgumentChecks extends Static {
@@ -100,23 +100,23 @@ public final class ArgumentChecks extends Static {
 
     /**
      * Makes sure that an argument is non-null. If the given {@code object} is 
null, then a
-     * {@link NullArgumentException} is thrown with a localized message 
containing the given name.
+     * {@link NullPointerException} is thrown with a localized message 
containing the given name.
      *
      * @param  name    the name of the argument to be checked. Used only if an 
exception is thrown.
      * @param  object  the user argument to check against null value.
-     * @throws NullArgumentException if {@code object} is null.
+     * @throws NullPointerException if {@code object} is null.
      */
     public static void ensureNonNull(final String name, final Object object)
-            throws NullArgumentException
+            throws NullPointerException
     {
         if (object == null) {
-            throw new 
NullArgumentException(Errors.format(Errors.Keys.NullArgument_1, name));
+            throw new 
NullPointerException(Errors.format(Errors.Keys.NullArgument_1, name));
         }
     }
 
     /**
      * Makes sure that an array element is non-null. If {@code element} is 
null, then a
-     * {@link NullArgumentException} is thrown with a localized message 
containing the
+     * {@link NullPointerException} is thrown with a localized message 
containing the
      * given name and index. The name and index are formatted as below:
      *
      * <ul>
@@ -131,10 +131,10 @@ public final class ArgumentChecks extends Static {
      * @param  name     the name of the argument to be checked. Used only if 
an exception is thrown.
      * @param  index    the Index of the element to check in an array or a 
list. Used only if an exception is thrown.
      * @param  element  the array or list element to check against null value.
-     * @throws NullArgumentException if {@code element} is null.
+     * @throws NullPointerException if {@code element} is null.
      */
     public static void ensureNonNullElement(final String name, final int 
index, final Object element)
-            throws NullArgumentException
+            throws NullPointerException
     {
         if (element == null) {
             final StringBuilder buffer = new StringBuilder(name);
@@ -145,26 +145,26 @@ public final class ArgumentChecks extends Static {
             } else {
                 buffer.append('[').append(index).append(']');
             }
-            throw new 
NullArgumentException(Errors.format(Errors.Keys.NullArgument_1, 
buffer.toString()));
+            throw new 
NullPointerException(Errors.format(Errors.Keys.NullArgument_1, 
buffer.toString()));
         }
     }
 
     /**
      * Makes sure that a character sequence is non-null and non-empty. If the 
given {@code text} is
-     * null, then a {@link NullArgumentException} is thrown. Otherwise if the 
given {@code text} has
+     * null, then a {@link NullPointerException} is thrown. Otherwise if the 
given {@code text} has
      * a {@linkplain CharSequence#length() length} equals to 0, then an {@link 
IllegalArgumentException}
      * is thrown.
      *
      * @param  name  the name of the argument to be checked. Used only if an 
exception is thrown.
      * @param  text  the user argument to check against null value and empty 
sequences.
-     * @throws NullArgumentException if {@code text} is null.
+     * @throws NullPointerException if {@code text} is null.
      * @throws IllegalArgumentException if {@code text} is empty.
      */
     public static void ensureNonEmpty(final String name, final CharSequence 
text)
-            throws NullArgumentException, IllegalArgumentException
+            throws NullPointerException, IllegalArgumentException
     {
         if (text == null) {
-            throw new 
NullArgumentException(Errors.format(Errors.Keys.NullArgument_1, name));
+            throw new 
NullPointerException(Errors.format(Errors.Keys.NullArgument_1, name));
         }
         if (text.length() == 0) {
             throw new 
IllegalArgumentException(Errors.format(Errors.Keys.EmptyArgument_1, name));
@@ -173,21 +173,21 @@ public final class ArgumentChecks extends Static {
 
     /**
      * Makes sure that an array is non-null and non-empty. If the given {@code 
array} is null,
-     * then a {@link NullArgumentException} is thrown. Otherwise if the array 
length is equal
+     * then a {@link NullPointerException} is thrown. Otherwise if the array 
length is equal
      * to 0, then an {@link IllegalArgumentException} is thrown.
      *
      * @param  name   the name of the argument to be checked. Used only if an 
exception is thrown.
      * @param  array  the user argument to check against null value and empty 
array.
-     * @throws NullArgumentException if {@code array} is null.
+     * @throws NullPointerException if {@code array} is null.
      * @throws IllegalArgumentException if {@code array} is empty.
      *
      * @since 1.0
      */
     public static void ensureNonEmpty(final String name, final Object[] array)
-            throws NullArgumentException, IllegalArgumentException
+            throws NullPointerException, IllegalArgumentException
     {
         if (array == null) {
-            throw new 
NullArgumentException(Errors.format(Errors.Keys.NullArgument_1, name));
+            throw new 
NullPointerException(Errors.format(Errors.Keys.NullArgument_1, name));
         }
         if (array.length == 0) {
             throw new 
IllegalArgumentException(Errors.format(Errors.Keys.EmptyArgument_1, name));
@@ -196,19 +196,19 @@ public final class ArgumentChecks extends Static {
 
     /**
      * Makes sure that given collection is non-null and non-empty.
-     * If it is null, then a {@link NullArgumentException} is thrown.
+     * If it is null, then a {@link NullPointerException} is thrown.
      * Otherwise if it {@linkplain Collection#isEmpty() is empty}, then an 
{@link IllegalArgumentException} is thrown.
      *
      * @param  name     the name of the argument to be checked. Used only if 
an exception is thrown.
      * @param  toCheck  the user argument to check against null value and 
empty collection.
-     * @throws NullArgumentException if {@code toCheck} is null.
+     * @throws NullPointerException if {@code toCheck} is null.
      * @throws IllegalArgumentException if {@code toCheck} is empty.
      *
      * @since 1.1
      */
     public static void ensureNonEmpty(final String name, final Collection<?> 
toCheck) {
         if (toCheck == null) {
-            throw new 
NullArgumentException(Errors.format(Errors.Keys.NullArgument_1, name));
+            throw new 
NullPointerException(Errors.format(Errors.Keys.NullArgument_1, name));
         }
         if (toCheck.isEmpty()) {
             throw new 
IllegalArgumentException(Errors.format(Errors.Keys.EmptyArgument_1, name));
@@ -217,19 +217,19 @@ public final class ArgumentChecks extends Static {
 
     /**
      * Makes sure that given object is non-null and non-empty.
-     * If it is null, then a {@link NullArgumentException} is thrown.
+     * If it is null, then a {@link NullPointerException} is thrown.
      * Otherwise if it {@linkplain Emptiable#isEmpty() is empty}, then an 
{@link IllegalArgumentException} is thrown.
      *
      * @param  name     the name of the argument to be checked. Used only if 
an exception is thrown.
      * @param  toCheck  the user argument to check against null value and 
empty object.
-     * @throws NullArgumentException if {@code toCheck} is null.
+     * @throws NullPointerException if {@code toCheck} is null.
      * @throws IllegalArgumentException if {@code toCheck} is empty.
      *
      * @since 1.4
      */
     public static void ensureNonEmpty(final String name, final Emptiable 
toCheck) {
         if (toCheck == null) {
-            throw new 
NullArgumentException(Errors.format(Errors.Keys.NullArgument_1, name));
+            throw new 
NullPointerException(Errors.format(Errors.Keys.NullArgument_1, name));
         }
         if (toCheck.isEmpty()) {
             throw new 
IllegalArgumentException(Errors.format(Errors.Keys.EmptyArgument_1, name));
@@ -249,7 +249,7 @@ public final class ArgumentChecks extends Static {
      * @param  min       the minimal allowed value (inclusive), or {@link 
Integer#MIN_VALUE} if none.
      * @param  max       the maximal allowed value (inclusive), or {@link 
Integer#MAX_VALUE} if none.
      * @param  distinct  {@code true} if each value must be unique.
-     * @throws NullArgumentException if {@code values} is null.
+     * @throws NullPointerException if {@code values} is null.
      * @throws IllegalArgumentException if {@code values} is empty, contains a 
value lower than {@code min},
      *         contains a value greater than {@code max}, or contains 
duplicated values while {@code distinct} is {@code true}.
      *
@@ -276,7 +276,7 @@ public final class ArgumentChecks extends Static {
      * @param  min       the minimal allowed value (inclusive), or {@link 
Integer#MIN_VALUE} if none.
      * @param  max       the maximal allowed value (inclusive), or {@link 
Integer#MAX_VALUE} if none.
      * @param  values    integer values to validate.
-     * @throws NullArgumentException if {@code values} is null.
+     * @throws NullPointerException if {@code values} is null.
      * @throws IllegalArgumentException if {@code values} is empty, contains a 
value lower than {@code min},
      *         contains a value greater than {@code max}, or contains 
duplicated values while {@code distinct} is {@code true}.
      *
@@ -286,7 +286,7 @@ public final class ArgumentChecks extends Static {
             throws IllegalArgumentException
     {
         if (values == null) {
-            throw new 
NullArgumentException(Errors.format(Errors.Keys.NullArgument_1, name));
+            throw new 
NullPointerException(Errors.format(Errors.Keys.NullArgument_1, name));
         }
         if (values.length == 0) {
             throw new 
IllegalArgumentException(Errors.format(Errors.Keys.EmptyArgument_1, name));
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/NullArgumentException.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/NullArgumentException.java
deleted file mode 100644
index 0c81bf89b2..0000000000
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/NullArgumentException.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.util;
-
-
-/**
- * Thrown when a null argument has been given to a method that doesn't accept 
them.
- * This exception extends {@link NullPointerException} in order to stress out 
that
- * the error is an illegal argument rather than an unexpected usage of a null 
pointer
- * inside a method body.
- *
- * <div class="note"><b>API note:</b>
- * We could argue that this exception should extend {@link 
IllegalArgumentException}.
- * However, {@link NullPointerException} has become a more widely adopted 
practice and
- * is now the recommended one in the <cite>Effective Java</cite> book.</div>
- *
- * @author Martin Desruisseaux (Geomatys)
- * @version 0.3
- *
- * @see ArgumentChecks#ensureNonNull(String, Object)
- *
- * @since 0.3
- *
- * @deprecated This exception was introduced before Java introduced {@code 
Objects.requireNonNull(…)}.
- *             Usages of {@code ArgumentChecks.ensureNonNull(…)} may be 
progressively replaced in the
- *             future, which would cause {@code NullArgumentException} to not 
be thrown anymore.
- *             Use {@code NullPointerException} instead.
- *
- * @see <a href="https://issues.apache.org/jira/browse/SIS-562";>JIRA issue 
SIS-562</a>
- */
-@Deprecated(since = "1.4", forRemoval = true)
-public class NullArgumentException extends NullPointerException {
-    /**
-     * For cross-version compatibility.
-     */
-    private static final long serialVersionUID = 7924011726325288438L;
-
-    /**
-     * Constructs an exception with no detail message.
-     */
-    public NullArgumentException() {
-        super();
-    }
-
-    /**
-     * Constructs an exception with the specified detail message.
-     *
-     * @param message  the detail message.
-     */
-    public NullArgumentException(final String message) {
-        super(message);
-    }
-}
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/CodeListSet.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/CodeListSet.java
index 8e55cbae10..0af81243e9 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/CodeListSet.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/CodeListSet.java
@@ -24,7 +24,6 @@ import java.util.NoSuchElementException;
 import java.io.Serializable;
 import java.lang.reflect.Modifier;
 import org.opengis.util.CodeList;
-import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.util.internal.CodeLists;
 import org.apache.sis.util.internal.CheckedArrayList;
 import org.apache.sis.util.resources.Errors;
@@ -51,7 +50,7 @@ import org.apache.sis.util.resources.Errors;
  *   }
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.4
+ * @version 1.5
  *
  * @param <E>  the type of code list elements in the set.
  *
@@ -229,7 +228,7 @@ public class CodeListSet<E extends CodeList<E>> extends 
AbstractSet<E>
                  */
                 return false;
             }
-            throw new NullArgumentException(message);
+            throw new NullPointerException(message);
         }
         int ordinal = element.ordinal();
         if (ordinal < Long.SIZE) {
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/WeakValueHashMap.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/WeakValueHashMap.java
index 47d8ed02b4..e4410b9ddc 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/WeakValueHashMap.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/WeakValueHashMap.java
@@ -30,7 +30,6 @@ import java.lang.ref.WeakReference;
 import org.apache.sis.util.Debug;
 import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.Utilities;
-import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.util.resources.Errors;
 
 import static org.apache.sis.util.collection.WeakEntry.*;
@@ -75,7 +74,7 @@ import static org.apache.sis.util.collection.WeakEntry.*;
  * then the caller can synchronize on {@code this}.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 1.4
+ * @version 1.5
  *
  * @param <K>  the class of key elements.
  * @param <V>  the class of value elements.
@@ -543,7 +542,7 @@ public class WeakValueHashMap<K,V> extends AbstractMap<K,V> 
{
     @Override
     public V put(final K key, final V value) {
         if (key == null || value == null) {
-            throw new NullArgumentException(Errors.format(key == null
+            throw new NullPointerException(Errors.format(key == null
                     ? Errors.Keys.NullMapKey : Errors.Keys.NullMapValue));
         }
         return intern(key, value, null);
@@ -565,7 +564,7 @@ public class WeakValueHashMap<K,V> extends AbstractMap<K,V> 
{
     @Override
     public V putIfAbsent(final K key, final V value) {
         if (key == null || value == null) {
-            throw new NullArgumentException(Errors.format(key == null
+            throw new NullPointerException(Errors.format(key == null
                     ? Errors.Keys.NullMapKey : Errors.Keys.NullMapValue));
         }
         return intern(key, value, Wildcard.NO_VALUE);
@@ -584,7 +583,7 @@ public class WeakValueHashMap<K,V> extends AbstractMap<K,V> 
{
     @Override
     public V replace(final K key, final V value) {
         if (value == null) {
-            throw new 
NullArgumentException(Errors.format(Errors.Keys.NullMapValue));
+            throw new 
NullPointerException(Errors.format(Errors.Keys.NullMapValue));
         }
         if (key == null) return null;
         return intern(key, value, Wildcard.ANY_VALUE);
@@ -604,7 +603,7 @@ public class WeakValueHashMap<K,V> extends AbstractMap<K,V> 
{
     @Override
     public boolean replace(final K key, final V oldValue, final V newValue) {
         if (newValue == null) {
-            throw new 
NullArgumentException(Errors.format(Errors.Keys.NullMapValue));
+            throw new 
NullPointerException(Errors.format(Errors.Keys.NullMapValue));
         }
         return replaceOrRemove(key, oldValue, newValue);
     }
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/package-info.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/package-info.java
index ca469064b0..fae84cb6a0 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/package-info.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/package-info.java
@@ -51,7 +51,7 @@
  * </ul>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 1.4
+ * @version 1.5
  * @since   0.3
  */
 package org.apache.sis.util.collection;
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/CheckedArrayList.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/CheckedArrayList.java
index 2445bcc8f2..585a8cffc5 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/CheckedArrayList.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/CheckedArrayList.java
@@ -23,7 +23,6 @@ import java.util.Collection;
 import java.util.Collections;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.ArraysExt;
-import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.collection.CheckedContainer;
 
@@ -186,7 +185,7 @@ public final class CheckedArrayList<E> extends ArrayList<E> 
implements CheckedCo
             return false;
         }
         if (element == null) {
-            throw new NullArgumentException(message);
+            throw new NullPointerException(message);
         } else {
             throw new ClassCastException(message);
         }
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/CheckedHashSet.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/CheckedHashSet.java
index 7999a470ec..cd5ada2e2f 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/CheckedHashSet.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/internal/CheckedHashSet.java
@@ -19,7 +19,6 @@ package org.apache.sis.util.internal;
 import java.util.Set;
 import java.util.Collections;
 import java.util.LinkedHashSet;
-import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.util.collection.CheckedContainer;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -108,7 +107,7 @@ public final class CheckedHashSet<E> extends 
LinkedHashSet<E> implements Checked
             return false;
         }
         if (element == null) {
-            throw new NullArgumentException(message);
+            throw new NullPointerException(message);
         } else {
             throw new IllegalArgumentException(message);
         }
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/package-info.java 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/package-info.java
index 5364256b1e..8308c4f084 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/package-info.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/package-info.java
@@ -39,7 +39,7 @@
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Alexis Manin (Geomatys)
- * @version 1.4
+ * @version 1.5
  * @since   0.3
  */
 package org.apache.sis.util;
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/ArgumentChecksTest.java
 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/ArgumentChecksTest.java
index 30746c755c..35c097dccf 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/ArgumentChecksTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/ArgumentChecksTest.java
@@ -42,11 +42,11 @@ public final class ArgumentChecksTest extends TestCase {
      */
     @Test
     public void testEnsureNonNullElement() {
-        NullArgumentException e = assertThrows(NullArgumentException.class, () 
-> {
+        NullPointerException e = assertThrows(NullPointerException.class, () 
-> {
             ArgumentChecks.ensureNonNullElement("axes", 2, null);
         });
         assertTrue(e.getMessage().contains("axes[2]"));
-        e = assertThrows(NullArgumentException.class, () -> {
+        e = assertThrows(NullPointerException.class, () -> {
             ArgumentChecks.ensureNonNullElement("axes[#].unit", 2, null);
         });
         assertTrue(e.getMessage().contains("axes[2].unit"));
diff --git 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/CheckedArrayListTest.java
 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/CheckedArrayListTest.java
index 8e95e68b1b..383b094c5f 100644
--- 
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/CheckedArrayListTest.java
+++ 
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/internal/CheckedArrayListTest.java
@@ -20,7 +20,6 @@ import java.util.List;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import org.apache.sis.util.NullArgumentException;
 
 // Test dependencies
 import org.junit.Test;
@@ -73,7 +72,7 @@ public final class CheckedArrayListTest extends TestCase {
         final CheckedArrayList<String> list = new 
CheckedArrayList<>(String.class);
         try {
             list.add(null);
-        } catch (NullArgumentException e) {
+        } catch (NullPointerException e) {
             final String message = e.getMessage();
             assertTrue(message.contains("CheckedArrayList<String>"));
         }
@@ -88,7 +87,7 @@ public final class CheckedArrayListTest extends TestCase {
         final Collection<String> toAdd = Arrays.asList("One", null, "Three");
         try {
             list.addAll(toAdd);
-        } catch (NullArgumentException e) {
+        } catch (NullPointerException e) {
             final String message = e.getMessage();
             assertTrue(message.contains("CheckedArrayList<String>"));
         }


Reply via email to