Alternatively... should add(null, null) simply return null? Or throw NullPointerException?
On Sat, Jan 16, 2010 at 4:39 AM, <s...@apache.org> wrote: > Author: sebb > Date: Sat Jan 16 12:39:20 2010 > New Revision: 899929 > > URL: http://svn.apache.org/viewvc?rev=899929&view=rev > Log: > LANG-571 ArrayUtils.add(T[] array[, offset], T element) can create unexpected > ClassCastException > > Modified: > > commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java > > commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ArrayUtilsAddTest.java > commons/proper/lang/trunk/xdocs/changes.xml > > Modified: > commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java > URL: > http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java?rev=899929&r1=899928&r2=899929&view=diff > ============================================================================== > --- > commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java > (original) > +++ > commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ArrayUtils.java > Sat Jan 16 12:39:20 2010 > @@ -3280,13 +3280,21 @@ > * @param element the object to add, may be <code>null</code> > * @return A new array containing the existing elements plus the new > element > * The returned array type will be that of the input array (unless null), > - * in which case it will have the same type as the element (unless that > is also null) > - * in which case the returned type will be Object[]. > + * in which case it will have the same type as the element. > + * If both are null, an IllegalArgumentException is thrown > * @since 2.1 > + * @throws IllegalArgumentException if both arguments are null > */ --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org