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 200ed9511a0c569d4c55282bcdb58f4fe314b2be
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Sat Sep 23 13:36:15 2023 +0200

    Deprecate for removal `NullArgumentException`.
    
    https://issues.apache.org/jira/browse/SIS-562
---
 .../sis/coverage/grid/GridCoverageBuilder.java     |   2 +-
 .../apache/sis/coverage/grid/ImageRenderer.java    |   7 +-
 .../apache/sis/feature/builder/TypeBuilder.java    |   4 +-
 .../org/apache/sis/portrayal/CanvasFollower.java   |   3 +-
 .../sis/referencing/cs/CoordinateSystems.java      |   3 +-
 .../apache/sis/storage/landsat/LandsatStore.java   |   2 +-
 .../apache/sis/storage/geotiff/GeoTiffStore.java   |   2 +-
 .../org/apache/sis/storage/netcdf/NetcdfStore.java |   2 +-
 .../org/apache/sis/storage/netcdf/base/Grid.java   |   3 +-
 .../main/org/apache/sis/storage/sql/SQLStore.java  |   2 +-
 .../main/org/apache/sis/util/ArraysExt.java        | 172 ++++++++-------------
 .../main/org/apache/sis/util/CharSequences.java    |   4 +-
 .../org/apache/sis/util/NullArgumentException.java |   8 +
 .../main/org/apache/sis/util/StringBuilders.java   |  10 +-
 .../apache/sis/util/collection/WeakHashSet.java    |   5 +-
 .../sis/util/collection/WeakValueHashMap.java      |   8 +-
 16 files changed, 95 insertions(+), 142 deletions(-)

diff --git 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridCoverageBuilder.java
 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridCoverageBuilder.java
index 86c2ec2574..d02a7a0130 100644
--- 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridCoverageBuilder.java
+++ 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridCoverageBuilder.java
@@ -442,7 +442,7 @@ public class GridCoverageBuilder {
      *         {@linkplain GridGeometry#getExtent() grid extent} not matching 
image size or
      *         {@linkplain #setRanges(SampleDimension...) number of sample 
dimensions} not matching
      *         the number of bands. This exception often wraps an {@link 
IllegalGridGeometryException},
-     *         {@link IllegalArgumentException} or {@link 
org.apache.sis.util.NullArgumentException}.
+     *         {@link IllegalArgumentException} or {@link 
NullPointerException}.
      */
     public GridCoverage build() throws IllegalStateException {
         GridGeometry grid = domain;                                 // May be 
replaced by an instance with extent.
diff --git 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/ImageRenderer.java
 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/ImageRenderer.java
index bdda955ad8..dc419b87d4 100644
--- 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/ImageRenderer.java
+++ 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/ImageRenderer.java
@@ -47,7 +47,6 @@ import org.apache.sis.coverage.grid.j2d.ObservableImage;
 import org.apache.sis.coverage.grid.j2d.TiledImage;
 import org.apache.sis.coverage.grid.j2d.WritableTiledImage;
 import org.apache.sis.feature.internal.Resources;
-import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.ArraysExt;
@@ -538,7 +537,7 @@ public class ImageRenderer {
      * getExtent()}.{@linkplain GridExtent#getLow(int) getLow()}</code>, as 
specified in class javadoc.
      *
      * @param  data  the Java2D buffer containing data for all bands.
-     * @throws NullArgumentException if {@code data} is null.
+     * @throws NullPointerException if {@code data} is null.
      * @throws MismatchedCoverageRangeException if the given data buffer does 
not have the expected amount of banks.
      */
     public void setData(final DataBuffer data) {
@@ -563,7 +562,7 @@ public class ImageRenderer {
      *
      * @param  dataType  type of data.
      * @param  data  the buffers wrapping arrays of primitive type.
-     * @throws NullArgumentException if {@code data} is null or one of {@code 
data} element is null.
+     * @throws NullPointerException if {@code data} is null or one of {@code 
data} element is null.
      * @throws MismatchedCoverageRangeException if the number of specified 
buffers is not equal to the number of bands.
      * @throws UnsupportedOperationException if a buffer is not backed by an 
accessible array or is read-only.
      * @throws ArrayStoreException if a buffer type is incompatible with 
{@code dataType}.
@@ -589,7 +588,7 @@ public class ImageRenderer {
      * which can be overridden by subclasses if desired.</p>
      *
      * @param  data  the vectors wrapping arrays of primitive type.
-     * @throws NullArgumentException if {@code data} is null or one of {@code 
data} element is null.
+     * @throws NullPointerException if {@code data} is null or one of {@code 
data} element is null.
      * @throws MismatchedCoverageRangeException if the number of specified 
vectors is not equal to the number of bands.
      * @throws UnsupportedOperationException if a vector is not backed by an 
accessible array or is read-only.
      * @throws RasterFormatException if vectors do not have the same size.
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 db15562fcb..36f9c77e75 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
@@ -494,7 +494,7 @@ public abstract class TypeBuilder implements Localized {
      *
      * @param  name   the name of the argument to be checked. Used only if an 
exception is thrown.
      * @param  value  the user argument to check against null value.
-     * @throws NullArgumentException if {@code object} is null.
+     * @throws NullPointerException if {@code object} is null.
      */
     final void ensureNonNull(final String name, final Object value) {
         if (value == null) {
@@ -519,7 +519,7 @@ public abstract class TypeBuilder implements Localized {
      *
      * @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.
      */
     final void ensureNonEmpty(final String name, final CharSequence text) {
diff --git 
a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/CanvasFollower.java
 
b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/CanvasFollower.java
index 694b4d4d83..9200b6457d 100644
--- 
a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/CanvasFollower.java
+++ 
b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/CanvasFollower.java
@@ -32,7 +32,6 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.apache.sis.referencing.CRS;
 import org.apache.sis.util.Disposable;
 import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.geometry.DirectPosition2D;
 import org.apache.sis.referencing.util.j2d.AffineTransform2D;
@@ -373,7 +372,7 @@ public class CanvasFollower implements 
PropertyChangeListener, Disposable {
                             }
                             transformObjectiveCoordinates(te, before);
                             return;
-                        } catch (NullArgumentException | TransformException | 
NoninvertibleTransformException e) {
+                        } catch (NullPointerException | TransformException | 
NoninvertibleTransformException e) {
                             canNotCompute("propertyChange", e);
                         }
                     }
diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/CoordinateSystems.java
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/CoordinateSystems.java
index a349b0e1c4..60503e213e 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/CoordinateSystems.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/CoordinateSystems.java
@@ -40,7 +40,6 @@ import org.apache.sis.measure.Units;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.internal.DoubleDouble;
 import org.apache.sis.referencing.util.AxisDirections;
@@ -564,7 +563,7 @@ next:   for (final CoordinateSystem cs : targets) {
      *
      * @param  cs  the coordinate system.
      * @return the axis directions for the specified coordinate system.
-     * @throws NullArgumentException if {@code cs} is null, or one of its axes 
is null,
+     * @throws NullPointerException if {@code cs} is null, or one of its axes 
is null,
      *         or a value returned by {@link 
CoordinateSystemAxis#getDirection()} is null.
      *
      * @since 0.8
diff --git 
a/endorsed/src/org.apache.sis.storage.earthobservation/main/org/apache/sis/storage/landsat/LandsatStore.java
 
b/endorsed/src/org.apache.sis.storage.earthobservation/main/org/apache/sis/storage/landsat/LandsatStore.java
index 1d9e897e17..fa0ccaa9b6 100644
--- 
a/endorsed/src/org.apache.sis.storage.earthobservation/main/org/apache/sis/storage/landsat/LandsatStore.java
+++ 
b/endorsed/src/org.apache.sis.storage.earthobservation/main/org/apache/sis/storage/landsat/LandsatStore.java
@@ -285,7 +285,7 @@ public class LandsatStore extends DataStore implements 
Aggregate {
      */
     @Override
     public <T extends StoreEvent> void addListener(Class<T> eventType, 
StoreListener<? super T> listener) {
-        // If an argument is null, we let the parent class throws (indirectly) 
NullArgumentException.
+        // If an argument is null, we let the parent class throws (indirectly) 
NullPointerException.
         if (listener == null || eventType == null || 
eventType.isAssignableFrom(WarningEvent.class)) {
             super.addListener(eventType, listener);
         }
diff --git 
a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/GeoTiffStore.java
 
b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/GeoTiffStore.java
index ea8243f57e..192a7a4bf2 100644
--- 
a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/GeoTiffStore.java
+++ 
b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/GeoTiffStore.java
@@ -531,7 +531,7 @@ public class GeoTiffStore extends DataStore implements 
Aggregate {
      */
     @Override
     public <T extends StoreEvent> void addListener(Class<T> eventType, 
StoreListener<? super T> listener) {
-        // If an argument is null, we let the parent class throws (indirectly) 
NullArgumentException.
+        // If an argument is null, we let the parent class throws (indirectly) 
NullPointerException.
         if (listener == null || eventType == null || 
eventType.isAssignableFrom(WarningEvent.class)) {
             super.addListener(eventType, listener);
         }
diff --git 
a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStore.java
 
b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStore.java
index 2b1a5a784b..79581f2013 100644
--- 
a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStore.java
+++ 
b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/NetcdfStore.java
@@ -253,7 +253,7 @@ public class NetcdfStore extends DataStore implements 
Aggregate {
      */
     @Override
     public <T extends StoreEvent> void addListener(Class<T> eventType, 
StoreListener<? super T> listener) {
-        // If an argument is null, we let the parent class throws (indirectly) 
NullArgumentException.
+        // If an argument is null, we let the parent class throws (indirectly) 
NullPointerException.
         if (listener == null || eventType == null || 
eventType.isAssignableFrom(WarningEvent.class)) {
             super.addListener(eventType, listener);
         }
diff --git 
a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/Grid.java
 
b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/Grid.java
index 4acc9b5cf1..692914e3b8 100644
--- 
a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/Grid.java
+++ 
b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/Grid.java
@@ -36,7 +36,6 @@ import org.apache.sis.coverage.grid.GridGeometry;
 import org.apache.sis.coverage.grid.IllegalGridGeometryException;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.storage.netcdf.internal.Resources;
-import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.ArraysExt;
 
@@ -307,7 +306,7 @@ public abstract class Grid extends NamedElement {
             final CoordinateReferenceSystem result = 
CRSBuilder.assemble(decoder, this, linearizations, reorderGridToCRS);
             if (useCache) crs = result;
             return result;
-        } catch (FactoryException | NullArgumentException ex) {
+        } catch (FactoryException | NullPointerException ex) {
             if (isNewWarning(ex, warnings)) {
                 canNotCreate(decoder, "getCoordinateReferenceSystem", 
Resources.Keys.CanNotCreateCRS_3, ex);
             }
diff --git 
a/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/SQLStore.java
 
b/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/SQLStore.java
index 1b79bb327c..38e3e9d24f 100644
--- 
a/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/SQLStore.java
+++ 
b/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/SQLStore.java
@@ -318,7 +318,7 @@ public class SQLStore extends DataStore implements 
Aggregate {
      */
     @Override
     public <T extends StoreEvent> void addListener(Class<T> eventType, 
StoreListener<? super T> listener) {
-        // If an argument is null, we let the parent class throws (indirectly) 
NullArgumentException.
+        // If an argument is null, we let the parent class throws (indirectly) 
NullPointerException.
         if (listener == null || eventType == null || 
eventType.isAssignableFrom(WarningEvent.class)) {
             super.addListener(eventType, listener);
         }
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/ArraysExt.java 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/ArraysExt.java
index 0575e37b2d..e6baf24db0 100644
--- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/ArraysExt.java
+++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/ArraysExt.java
@@ -160,7 +160,7 @@ public final class ArraysExt extends Static {
      *
      * @see Arrays#copyOf(Object[], int)
      */
-    public static <E> E[] resize(final E[] array, final int length) throws 
NegativeArraySizeException {
+    public static <E> E[] resize(final E[] array, final int length) {
         return (array == null || array.length == length) ? array : 
Arrays.copyOf(array, length);
     }
 
@@ -178,7 +178,7 @@ public final class ArraysExt extends Static {
      *
      * @see Arrays#copyOf(double[], int)
      */
-    public static double[] resize(final double[] array, final int length) 
throws NegativeArraySizeException {
+    public static double[] resize(final double[] array, final int length) {
         if (array != null) {
             if (length == 0) {
                 return EMPTY_DOUBLE;
@@ -204,7 +204,7 @@ public final class ArraysExt extends Static {
      *
      * @see Arrays#copyOf(float[], int)
      */
-    public static float[] resize(final float[] array, final int length) throws 
NegativeArraySizeException {
+    public static float[] resize(final float[] array, final int length) {
         if (array != null) {
             if (length == 0) {
                 return EMPTY_FLOAT;
@@ -230,7 +230,7 @@ public final class ArraysExt extends Static {
      *
      * @see Arrays#copyOf(long[], int)
      */
-    public static long[] resize(final long[] array, final int length) throws 
NegativeArraySizeException {
+    public static long[] resize(final long[] array, final int length) {
         if (array != null) {
             if (length == 0) {
                 return EMPTY_LONG;
@@ -256,7 +256,7 @@ public final class ArraysExt extends Static {
      *
      * @see Arrays#copyOf(int[], int)
      */
-    public static int[] resize(final int[] array, final int length) throws 
NegativeArraySizeException {
+    public static int[] resize(final int[] array, final int length) {
         if (array != null) {
             if (length == 0) {
                 return EMPTY_INT;
@@ -282,7 +282,7 @@ public final class ArraysExt extends Static {
      *
      * @see Arrays#copyOf(short[], int)
      */
-    public static short[] resize(final short[] array, final int length) throws 
NegativeArraySizeException {
+    public static short[] resize(final short[] array, final int length) {
         if (array != null) {
             if (length == 0) {
                 return EMPTY_SHORT;
@@ -308,7 +308,7 @@ public final class ArraysExt extends Static {
      *
      * @see Arrays#copyOf(byte[], int)
      */
-    public static byte[] resize(final byte[] array, final int length) throws 
NegativeArraySizeException {
+    public static byte[] resize(final byte[] array, final int length) {
         if (array != null) {
             if (length == 0) {
                 return EMPTY_BYTE;
@@ -334,7 +334,7 @@ public final class ArraysExt extends Static {
      *
      * @see Arrays#copyOf(char[], int)
      */
-    public static char[] resize(final char[] array, final int length) throws 
NegativeArraySizeException {
+    public static char[] resize(final char[] array, final int length) {
         if (array != null) {
             if (length == 0) {
                 return EMPTY_CHAR;
@@ -360,7 +360,7 @@ public final class ArraysExt extends Static {
      *
      * @see Arrays#copyOf(boolean[], int)
      */
-    public static boolean[] resize(final boolean[] array, final int length) 
throws NegativeArraySizeException {
+    public static boolean[] resize(final boolean[] array, final int length) {
         if (array != null) {
             if (length == 0) {
                 return EMPTY_BOOLEAN;
@@ -383,14 +383,12 @@ public final class ArraysExt extends Static {
      * @param  length  number of elements to remove.
      * @return array with the same elements than the given {@code array} 
except for the removed elements,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      */
     @SuppressWarnings("SuspiciousSystemArraycopy")
-    private static <T> T doRemove(final T array, final int first, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    private static <T> T doRemove(final T array, final int first, final int 
length) {
         if (length == 0) {
             return array;               // May be null
         }
@@ -415,15 +413,13 @@ public final class ArraysExt extends Static {
      * @param  length  number of elements to remove.
      * @return array with the same elements than the given {@code array} 
except for the removed elements,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(Object[], int, int)
      */
-    public static <E> E[] remove(final E[] array, final int first, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static <E> E[] remove(final E[] array, final int first, final int 
length) {
         return doRemove(array, first, length);
     }
 
@@ -438,15 +434,13 @@ public final class ArraysExt extends Static {
      * @param  length  number of elements to remove.
      * @return array with the same elements than the given {@code array} 
except for the removed elements,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(double[], int, int)
      */
-    public static double[] remove(final double[] array, final int first, final 
int length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static double[] remove(final double[] array, final int first, final 
int length) {
         return (first == 0 && array != null && length == array.length)
                 ? EMPTY_DOUBLE : doRemove(array, first, length);
     }
@@ -462,15 +456,13 @@ public final class ArraysExt extends Static {
      * @param  length  number of elements to remove.
      * @return array with the same elements than the given {@code array} 
except for the removed elements,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(float[], int, int)
      */
-    public static float[] remove(final float[] array, final int first, final 
int length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static float[] remove(final float[] array, final int first, final 
int length) {
         return (first == 0 && array != null && length == array.length)
                 ? EMPTY_FLOAT : doRemove(array, first, length);
     }
@@ -486,15 +478,13 @@ public final class ArraysExt extends Static {
      * @param  length  number of elements to remove.
      * @return array with the same elements than the given {@code array} 
except for the removed elements,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(long[], int, int)
      */
-    public static long[] remove(final long[] array, final int first, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static long[] remove(final long[] array, final int first, final int 
length) {
         return (first == 0 && array != null && length == array.length)
                 ? EMPTY_LONG : doRemove(array, first, length);
     }
@@ -510,15 +500,13 @@ public final class ArraysExt extends Static {
      * @param  length  number of elements to remove.
      * @return array with the same elements than the given {@code array} 
except for the removed elements,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(int[], int, int)
      */
-    public static int[] remove(final int[] array, final int first, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static int[] remove(final int[] array, final int first, final int 
length) {
         return (first == 0 && array != null && length == array.length)
                 ? EMPTY_INT : doRemove(array, first, length);
     }
@@ -534,15 +522,13 @@ public final class ArraysExt extends Static {
      * @param  length  number of elements to remove.
      * @return array with the same elements than the given {@code array} 
except for the removed elements,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(short[], int, int)
      */
-    public static short[] remove(final short[] array, final int first, final 
int length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static short[] remove(final short[] array, final int first, final 
int length) {
         return (first == 0 && array != null && length == array.length) ?
                 EMPTY_SHORT : doRemove(array, first, length);
     }
@@ -558,15 +544,13 @@ public final class ArraysExt extends Static {
      * @param  length  number of elements to remove.
      * @return array with the same elements than the given {@code array} 
except for the removed elements,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(byte[], int, int)
      */
-    public static byte[] remove(final byte[] array, final int first, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static byte[] remove(final byte[] array, final int first, final int 
length) {
         return (first == 0 && array != null && length == array.length)
                 ? EMPTY_BYTE : doRemove(array, first, length);
     }
@@ -582,15 +566,13 @@ public final class ArraysExt extends Static {
      * @param  length  number of elements to remove.
      * @return array with the same elements than the given {@code array} 
except for the removed elements,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(char[], int, int)
      */
-    public static char[] remove(final char[] array, final int first, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static char[] remove(final char[] array, final int first, final int 
length) {
         return (first == 0 && array != null && length == array.length)
                 ? EMPTY_CHAR : doRemove(array, first, length);
     }
@@ -606,15 +588,13 @@ public final class ArraysExt extends Static {
      * @param  length  number of elements to remove.
      * @return array with the same elements than the given {@code array} 
except for the removed elements,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(boolean[], int, int)
      */
-    public static boolean[] remove(final boolean[] array, final int first, 
final int length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static boolean[] remove(final boolean[] array, final int first, 
final int length) {
         return (first == 0 && array != null && length == array.length)
                 ? EMPTY_BOOLEAN : doRemove(array, first, length);
     }
@@ -633,14 +613,12 @@ public final class ArraysExt extends Static {
      * @param  length  number of spaces to insert.
      * @return array containing the {@code array} elements with the additional 
space inserted,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      */
     @SuppressWarnings("SuspiciousSystemArraycopy")
-    private static <T> T doInsert(final T array, final int first, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    private static <T> T doInsert(final T array, final int first, final int 
length) {
         if (length == 0) {
             return array;               // May be null
         }
@@ -669,16 +647,14 @@ public final class ArraysExt extends Static {
      * @param  length  number of spaces to insert.
      * @return array containing the {@code array} elements with the additional 
space inserted,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(Object[], int, Object[], int, int)
      * @see #remove(Object[], int, int)
      */
-    public static <E> E[] insert(final E[] array, final int first, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static <E> E[] insert(final E[] array, final int first, final int 
length) {
         return doInsert(array, first, length);
     }
 
@@ -695,16 +671,14 @@ public final class ArraysExt extends Static {
      * @param  length  number of spaces to insert.
      * @return array containing the {@code array} elements with the additional 
space inserted,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(double[], int, double[], int, int)
      * @see #remove(double[], int, int)
      */
-    public static double[] insert(final double[] array, final int first, final 
int length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static double[] insert(final double[] array, final int first, final 
int length) {
         return doInsert(array, first, length);
     }
 
@@ -721,16 +695,14 @@ public final class ArraysExt extends Static {
      * @param  length  number of spaces to insert.
      * @return array containing the {@code array} elements with the additional 
space inserted,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(float[], int, float[], int, int)
      * @see #remove(float[], int, int)
      */
-    public static float[] insert(final float[] array, final int first, final 
int length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static float[] insert(final float[] array, final int first, final 
int length) {
         return doInsert(array, first, length);
     }
 
@@ -747,16 +719,14 @@ public final class ArraysExt extends Static {
      * @param  length  number of spaces to insert.
      * @return array containing the {@code array} elements with the additional 
space inserted,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(long[], int, long[], int, int)
      * @see #remove(long[], int, int)
      */
-    public static long[] insert(final long[] array, final int first, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static long[] insert(final long[] array, final int first, final int 
length) {
         return doInsert(array, first, length);
     }
 
@@ -773,16 +743,14 @@ public final class ArraysExt extends Static {
      * @param  length  number of spaces to insert.
      * @return array containing the {@code array} elements with the additional 
space inserted,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(int[], int, int[], int, int)
      * @see #remove(int[], int, int)
      */
-    public static int[] insert(final int[] array, final int first, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static int[] insert(final int[] array, final int first, final int 
length) {
         return doInsert(array, first, length);
     }
 
@@ -798,16 +766,14 @@ public final class ArraysExt extends Static {
      * @param  length  number of spaces to insert.
      * @return array containing the {@code array} elements with the additional 
space inserted,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(short[], int, short[], int, int)
      * @see #remove(short[], int, int)
      */
-    public static short[] insert(final short[] array, final int first, final 
int length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static short[] insert(final short[] array, final int first, final 
int length) {
         return doInsert(array, first, length);
     }
 
@@ -824,16 +790,14 @@ public final class ArraysExt extends Static {
      * @param  length  number of spaces to insert.
      * @return array containing the {@code array} elements with the additional 
space inserted,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(byte[], int, byte[], int, int)
      * @see #remove(byte[], int, int)
      */
-    public static byte[] insert(final byte[] array, final int first, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static byte[] insert(final byte[] array, final int first, final int 
length) {
         return doInsert(array, first, length);
     }
 
@@ -850,16 +814,14 @@ public final class ArraysExt extends Static {
      * @param  length  number of spaces to insert.
      * @return array containing the {@code array} elements with the additional 
space inserted,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(char[], int, char[], int, int)
      * @see #remove(char[], int, int)
      */
-    public static char[] insert(final char[] array, final int first, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static char[] insert(final char[] array, final int first, final int 
length) {
         return doInsert(array, first, length);
     }
 
@@ -876,16 +838,14 @@ public final class ArraysExt extends Static {
      * @param  length  number of spaces to insert.
      * @return array containing the {@code array} elements with the additional 
space inserted,
      *         or {@code array} (which may be null) if {@code length} is 0.
-     * @throws NullArgumentException if {@code array} is null and {@code 
length} is different than 0.
+     * @throws NullPointerException if {@code array} is null and {@code 
length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code first} or {@code 
first+length} is out of array bounds.
      *
      * @see #insert(boolean[], int, boolean[], int, int)
      * @see #remove(boolean[], int, int)
      */
-    public static boolean[] insert(final boolean[] array, final int first, 
final int length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
-    {
+    public static boolean[] insert(final boolean[] array, final int first, 
final int length) {
         return doInsert(array, first, length);
     }
 
@@ -905,14 +865,13 @@ public final class ArraysExt extends Static {
      * @param  length  number of {@code src} elements to insert.
      * @return array which contains the merge of {@code src} and {@code dst}.
      *         This method returns directly {@code dst} when {@code length} is 
zero, but never return {@code src}.
-     * @throws NullArgumentException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
+     * @throws NullPointerException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code srcOff}, {@code 
srcOff+length} or {@code dstOff} is out of array bounds.
      */
     @SuppressWarnings("SuspiciousSystemArraycopy")
     private static <T> T doInsert(final T src, final int srcOff,
                                   final T dst, final int dstOff, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
     {
         if (length == 0) {
             return dst;             // May be null
@@ -945,13 +904,12 @@ public final class ArraysExt extends Static {
      * @param  length  number of {@code src} elements to insert.
      * @return array which contains the merge of {@code src} and {@code dst}.
      *         This method returns directly {@code dst} when {@code length} is 
zero, but never return {@code src}.
-     * @throws NullArgumentException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
+     * @throws NullPointerException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code srcOff}, {@code 
srcOff+length} or {@code dstOff} is out of array bounds.
      */
     public static <E> E[] insert(final E[] src, final int srcOff,
                                  final E[] dst, final int dstOff, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
     {
         return doInsert(src, srcOff, dst, dstOff, length);
     }
@@ -971,13 +929,12 @@ public final class ArraysExt extends Static {
      * @param  length  number of {@code src} elements to insert.
      * @return array which contains the merge of {@code src} and {@code dst}.
      *         This method returns directly {@code dst} when {@code length} is 
zero, but never return {@code src}.
-     * @throws NullArgumentException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
+     * @throws NullPointerException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code srcOff}, {@code 
srcOff+length} or {@code dstOff} is out of array bounds.
      */
     public static double[] insert(final double[] src, final int srcOff,
                                   final double[] dst, final int dstOff, final 
int length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
     {
         return doInsert(src, srcOff, dst, dstOff, length);
     }
@@ -997,13 +954,12 @@ public final class ArraysExt extends Static {
      * @param  length  number of {@code src} elements to insert.
      * @return array which contains the merge of {@code src} and {@code dst}.
      *         This method returns directly {@code dst} when {@code length} is 
zero, but never return {@code src}.
-     * @throws NullArgumentException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
+     * @throws NullPointerException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code srcOff}, {@code 
srcOff+length} or {@code dstOff} is out of array bounds.
      */
     public static float[] insert(final float[] src, final int srcOff,
                                  final float[] dst, final int dstOff, final 
int length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
     {
         return doInsert(src, srcOff, dst, dstOff, length);
     }
@@ -1023,13 +979,12 @@ public final class ArraysExt extends Static {
      * @param  length  number of {@code src} elements to insert.
      * @return array which contains the merge of {@code src} and {@code dst}.
      *         This method returns directly {@code dst} when {@code length} is 
zero, but never return {@code src}.
-     * @throws NullArgumentException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
+     * @throws NullPointerException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code srcOff}, {@code 
srcOff+length} or {@code dstOff} is out of array bounds.
      */
     public static long[] insert(final long[] src, final int srcOff,
                                 final long[] dst, final int dstOff, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
     {
         return doInsert(src, srcOff, dst, dstOff, length);
     }
@@ -1049,13 +1004,12 @@ public final class ArraysExt extends Static {
      * @param  length  number of {@code src} elements to insert.
      * @return array which contains the merge of {@code src} and {@code dst}.
      *         This method returns directly {@code dst} when {@code length} is 
zero, but never return {@code src}.
-     * @throws NullArgumentException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
+     * @throws NullPointerException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code srcOff}, {@code 
srcOff+length} or {@code dstOff} is out of array bounds.
      */
     public static int[] insert(final int[] src, final int srcOff,
                                final int[] dst, final int dstOff, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
     {
         return doInsert(src, srcOff, dst, dstOff, length);
     }
@@ -1075,13 +1029,12 @@ public final class ArraysExt extends Static {
      * @param  length  number of {@code src} elements to insert.
      * @return array which contains the merge of {@code src} and {@code dst}.
      *         This method returns directly {@code dst} when {@code length} is 
zero, but never return {@code src}.
-     * @throws NullArgumentException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
+     * @throws NullPointerException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code srcOff}, {@code 
srcOff+length} or {@code dstOff} is out of array bounds.
      */
     public static short[] insert(final short[] src, final int srcOff,
                                  final short[] dst, final int dstOff, final 
int length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
     {
         return doInsert(src, srcOff, dst, dstOff, length);
     }
@@ -1101,13 +1054,12 @@ public final class ArraysExt extends Static {
      * @param  length  number of {@code src} elements to insert.
      * @return array which contains the merge of {@code src} and {@code dst}.
      *         This method returns directly {@code dst} when {@code length} is 
zero, but never return {@code src}.
-     * @throws NullArgumentException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
+     * @throws NullPointerException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code srcOff}, {@code 
srcOff+length} or {@code dstOff} is out of array bounds.
      */
     public static byte[] insert(final byte[] src, final int srcOff,
                                 final byte[] dst, final int dstOff, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
     {
         return doInsert(src, srcOff, dst, dstOff, length);
     }
@@ -1127,13 +1079,12 @@ public final class ArraysExt extends Static {
      * @param  length  number of {@code src} elements to insert.
      * @return array which contains the merge of {@code src} and {@code dst}.
      *         This method returns directly {@code dst} when {@code length} is 
zero, but never return {@code src}.
-     * @throws NullArgumentException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
+     * @throws NullPointerException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code srcOff}, {@code 
srcOff+length} or {@code dstOff} is out of array bounds.
      */
     public static char[] insert(final char[] src, final int srcOff,
                                 final char[] dst, final int dstOff, final int 
length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
     {
         return doInsert(src, srcOff, dst, dstOff, length);
     }
@@ -1153,13 +1104,12 @@ public final class ArraysExt extends Static {
      * @param  length  number of {@code src} elements to insert.
      * @return array which contains the merge of {@code src} and {@code dst}.
      *         This method returns directly {@code dst} when {@code length} is 
zero, but never return {@code src}.
-     * @throws NullArgumentException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
+     * @throws NullPointerException if {@code src} or {@code dst} is null 
while {@code length} is different than 0.
      * @throws IllegalArgumentException if {@code length} is negative.
      * @throws IndexOutOfBoundsException if {@code srcOff}, {@code 
srcOff+length} or {@code dstOff} is out of array bounds.
      */
     public static boolean[] insert(final boolean[] src, final int srcOff,
                                    final boolean[] dst, final int dstOff, 
final int length)
-            throws NullArgumentException, IllegalArgumentException, 
IndexOutOfBoundsException
     {
         return doInsert(src, srcOff, dst, dstOff, length);
     }
@@ -1173,11 +1123,11 @@ public final class ArraysExt extends Static {
      * @param  array    the array to copy with a new element. The original 
array will not be modified.
      * @param  element  the element to add (can be null).
      * @return a copy of the given array with the given element appended at 
the end.
-     * @throws NullArgumentException if the given array is null.
+     * @throws NullPointerException if the given array is null.
      *
      * @see #concatenate(Object[][])
      */
-    public static <T> T[] append(final T[] array, final T element) throws 
NullArgumentException{
+    public static <T> T[] append(final T[] array, final T element) {
         ArgumentChecks.ensureNonNull("array", array);
         final T[] copy = Arrays.copyOf(array, array.length + 1);
         copy[array.length] = element;
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/CharSequences.java 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/CharSequences.java
index e153d9d486..aa2baf7227 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/CharSequences.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/CharSequences.java
@@ -232,7 +232,7 @@ public final class CharSequences extends Static {
      *                   It shall contain at least one character.
      * @return the number of occurrences of {@code toSearch} in {@code text},
      *         or 0 if {@code text} was null or empty.
-     * @throws NullArgumentException if the {@code toSearch} argument is null.
+     * @throws NullPointerException if the {@code toSearch} argument is null.
      * @throws IllegalArgumentException if the {@code toSearch} argument is 
empty.
      */
     public static int count(final CharSequence text, final String toSearch) {
@@ -301,7 +301,7 @@ public final class CharSequences extends Static {
      * @param  toIndex    the index after the last character where to perform 
the search.
      * @return the index within the text of the first occurrence of the 
specified part, starting at the specified index,
      *         or -1 if no occurrence has been found or if the {@code text} 
argument is null.
-     * @throws NullArgumentException if the {@code toSearch} argument is null.
+     * @throws NullPointerException if the {@code toSearch} argument is null.
      * @throws IllegalArgumentException if the {@code toSearch} argument is 
empty.
      *
      * @see String#indexOf(String, int)
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
index 1c4bfa8283..0c81bf89b2 100644
--- 
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
@@ -34,7 +34,15 @@ package org.apache.sis.util;
  * @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.
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/StringBuilders.java 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/StringBuilders.java
index bf69588883..4fcbd39b26 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/StringBuilders.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/StringBuilders.java
@@ -62,7 +62,7 @@ public final class StringBuilders extends Static {
      * @param  buffer     the string in which to perform the replacements.
      * @param  toSearch   the character to replace.
      * @param  replaceBy  the replacement for the searched character.
-     * @throws NullArgumentException if the {@code buffer} arguments is null.
+     * @throws NullPointerException if the {@code buffer} arguments is null.
      *
      * @see String#replace(char, char)
      */
@@ -85,7 +85,7 @@ public final class StringBuilders extends Static {
      * @param  buffer     the string in which to perform the replacements.
      * @param  toSearch   the string to replace.
      * @param  replaceBy  the replacement for the searched string.
-     * @throws NullArgumentException if any of the arguments is null.
+     * @throws NullPointerException if any of the arguments is null.
      * @throws IllegalArgumentException if the {@code toSearch} argument is 
empty.
      *
      * @see String#replace(char, char)
@@ -115,7 +115,7 @@ public final class StringBuilders extends Static {
      * @param  start   the beginning index in the {@code buffer}, inclusive.
      * @param  end     the ending index in the {@code buffer}, exclusive.
      * @param  chars   the array that will replace previous contents.
-     * @throws NullArgumentException if the {@code buffer} or {@code chars} 
argument is null.
+     * @throws NullPointerException if the {@code buffer} or {@code chars} 
argument is null.
      *
      * @see StringBuilder#replace(int, int, String)
      */
@@ -266,7 +266,7 @@ public final class StringBuilders extends Static {
      * been appended to the buffer}, in order to make it appears like an 
integer when possible.
      *
      * @param  buffer  the buffer to trim if possible.
-     * @throws NullArgumentException if the given {@code buffer} is null.
+     * @throws NullPointerException if the given {@code buffer} is null.
      *
      * @see CharSequences#trimFractionalPart(CharSequence)
      */
@@ -290,7 +290,7 @@ public final class StringBuilders extends Static {
      * by the corresponding sequences of characters.
      *
      * @param  buffer  the text to scan for Unicode characters to replace by 
ASCII characters.
-     * @throws NullArgumentException if the given {@code buffer} is null.
+     * @throws NullPointerException if the given {@code buffer} is null.
      *
      * @see CharSequences#toASCII(CharSequence)
      * @see Normalizer#normalize(CharSequence, Normalizer.Form)
diff --git 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/WeakHashSet.java
 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/WeakHashSet.java
index 738b4aa922..0549124ccb 100644
--- 
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/WeakHashSet.java
+++ 
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/collection/WeakHashSet.java
@@ -25,7 +25,6 @@ import org.apache.sis.util.Debug;
 import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.util.NullArgumentException;
 
 import static org.apache.sis.util.collection.WeakEntry.*;
 
@@ -210,10 +209,10 @@ public class WeakHashSet<E> extends AbstractSet<E> 
implements CheckedContainer<E
      *
      * @param  element  element to be added to this set.
      * @return {@code true} if this set did not already contain the specified 
element.
-     * @throws NullArgumentException if the given object is {@code null}.
+     * @throws NullPointerException if the given object is {@code null}.
      */
     @Override
-    public synchronized boolean add(final E element) throws 
NullArgumentException {
+    public synchronized boolean add(final E element) {
         ArgumentChecks.ensureNonNull("element", element);
         return intern(element, ADD) == null;
     }
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 5ffff63ca2..fd461a7449 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
@@ -538,7 +538,7 @@ public class WeakValueHashMap<K,V> extends AbstractMap<K,V> 
{
      * @param  key    key with which the specified value is to be associated.
      * @param  value  value to be associated with the specified key.
      * @return the previous value associated with specified key, or {@code 
null} if there was no mapping for the key.
-     * @throws NullArgumentException if the key or the value is {@code null}.
+     * @throws NullPointerException if the key or the value is {@code null}.
      */
     @Override
     public V put(final K key, final V value) {
@@ -558,7 +558,7 @@ public class WeakValueHashMap<K,V> extends AbstractMap<K,V> 
{
      * @param  key    key with which the specified value is to be associated.
      * @param  value  value to be associated with the specified key.
      * @return the current value associated with specified key, or {@code 
null} if there was no mapping for the key.
-     * @throws NullArgumentException if the key or the value is {@code null}.
+     * @throws NullPointerException if the key or the value is {@code null}.
      *
      * @since 0.7
      */
@@ -577,7 +577,7 @@ public class WeakValueHashMap<K,V> extends AbstractMap<K,V> 
{
      * @param  key    key with which the specified value is to be associated.
      * @param  value  value to be associated with the specified key.
      * @return the previous value associated with specified key, or {@code 
null} if there was no mapping for the key.
-     * @throws NullArgumentException if the value is {@code null}.
+     * @throws NullPointerException if the value is {@code null}.
      *
      * @since 1.2
      */
@@ -597,7 +597,7 @@ public class WeakValueHashMap<K,V> extends AbstractMap<K,V> 
{
      * @param  oldValue  value expected to be associated with the specified 
key.
      * @param  newValue  value to be associated with the specified key.
      * @return {@code true} if the value was replaced.
-     * @throws NullArgumentException if the new value is {@code null}.
+     * @throws NullPointerException if the new value is {@code null}.
      *
      * @since 1.2
      */

Reply via email to