Skip to content

Commit

Permalink
fixed files form Lang #37
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 2b7653a commit 87bf1f3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions projects/Lang/37/org/apache/commons/lang3/ArrayUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2959,8 +2959,16 @@ public static <T> T[] addAll(T[] array1, T... array2) {
final Class<?> type1 = array1.getClass().getComponentType();
T[] joinedArray = (T[]) Array.newInstance(type1, array1.length + array2.length);
System.arraycopy(array1, 0, joinedArray, 0, array1.length);
try {
System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);
} catch (ArrayStoreException ase) {
// Check if problem is incompatible types
final Class<?> type2 = array2.getClass().getComponentType();
if (!type1.isAssignableFrom(type2)){
throw new IllegalArgumentException("Cannot store "+type2.getName()+" in an array of "+type1.getName());
}
throw ase; // No, so rethrow original
}
return joinedArray;
}

Expand Down

0 comments on commit 87bf1f3

Please sign in to comment.