Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-567

ArrayUtils.addAll(T[] array1, T... array2) does not handle mixed types very well

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.5
    • lang.*
    • None

    Description

      ArrayUtils.addAll(T[] array1, T... array2) does not handle mixed array types very well.

      The stack trace for

      Number[] st = ArrayUtils.addAll(new Integer[]

      {1}

      , new Long[]

      {2L}

      );

      starts:

      java.lang.ArrayStoreException
      at java.lang.System.arraycopy(Native Method)
      at org.apache.commons.lang3.ArrayUtils.addAll(ArrayUtils.java:2962)

      which is not all that obvious.

      It would be a lot clearer if the method threw an IlegalArgumentException or similar.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: