IBM Support

IV77747: JAVA.UTIL.ARRAYLIST.ADDALL LEADS TO JAVA.LANG.ARRAYINDEXOUTOFBOU NDSEXCEPTION IN CERTAIN SCENARIO

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

APAR status

  • Closed as program error.

Error description

  • Error Message: Exception in thread "main"
    java.lang.ArrayIndexOutOfBoundsException: Array index out of
    range: 12
        at java.util.ArrayList.addAll(ArrayList.java:254)
        at
    ArrayIndexOutOfBoundsExample.main(ArrayIndexOutOfBoundsExample.j
    ava:15)
    .
    Stack Trace: N/A
    .
    Exception occurs only with Java 6.0.0 and 6.1.0 with following
    scenario
    final List<Integer> nums = new ArrayList<Integer>();
    nums.addAll(0, Collections.<Integer> emptyList());
    nums.addAll(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
    12));
    

Local fix

Problem summary

  • Inserting empty collection to empty java.util.ArrayList instance
    at 0th index modifies the metadata of List incorrectly. At this
    state, addition of elements from collection of size greater than
    capacity of java.util.ArrayList result in
    java.lang.ArrayIndexOutOfBoundsException.
    

Problem conclusion

  • java.util.ArrayList has been modified to handle the case of
    adding empty collection at 0th index properly and avoid
    incorrect modification of metadata.
    .
    This APAR will be fixed in the following Java Releases:
       6 R1 SR8 FP20  (6.1.8.20)
       6    SR16 FP20 (6.0.16.20)
    .
    Contact your IBM Product's Service Team for these Service
    Refreshes and Fix Packs.
    For those running stand-alone, information about the available
    Service Refreshes and Fix Packs can be found at:
               https://www.ibm.com/developerworks/java/jdk/
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV77747

  • Reported component name

    JAVA CLASS LIBS

  • Reported component ID

    620700130

  • Reported release

    600

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2015-10-06

  • Closed date

    2015-11-04

  • Last modified date

    2015-12-01

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    JAVA CLASS LIBS

  • Fixed component ID

    620700130

Applicable component levels

  • R600 PSY

       UP

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSCVQ3Y","label":"Java Class Libraries"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"6.0","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
01 December 2015