diff --git a/projects/Lang/35/org/apache/commons/lang3/ArrayUtils.java b/projects/Lang/35/org/apache/commons/lang3/ArrayUtils.java index ac22f8f..3a543ce 100644 --- a/projects/Lang/35/org/apache/commons/lang3/ArrayUtils.java +++ b/projects/Lang/35/org/apache/commons/lang3/ArrayUtils.java @@ -3292,7 +3292,7 @@ public static T[] add(T[] array, T element) { } else if (element != null) { type = element.getClass(); } else { - type = Object.class; + throw new IllegalArgumentException("Arguments cannot both be null"); } @SuppressWarnings("unchecked") // type must be T T[] newArray = (T[]) copyArrayGrow1(array, type); @@ -3571,7 +3571,7 @@ public static T[] add(T[] array, int index, T element) { } else if (element != null) { clss = element.getClass(); } else { - return (T[]) new Object[] { null }; + throw new IllegalArgumentException("Array and element cannot both be null"); } @SuppressWarnings("unchecked") // the add method creates an array of type clss, which is type T final T[] newArray = (T[]) add(array, index, element, clss);