Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8278188

unit test failed : ArrayIndexOutOfBoundsException

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 8
    • Fix Version/s: None
    • Component/s: core-libs

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Linux / jdk - 8

      A DESCRIPTION OF THE PROBLEM :
      We generate unit test cases by our tool automatically.
      And the unit test case failed.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      This is the unit test case:
      @Test
        public void test_shiftLeft_5_5(){

            long long1 = 9223372036854775807L;
            long long2 = 1L;
            long[] longArray3 = {-1L, 1L, -1L, 0L};
            BitVector bitVector0 = new BitVector(longArray3);
            bitVector0.shiftLeft(long1, long2);
        }

      ACTUAL -
      throw ArrayIndexOutOfBoundsException

      ---------- BEGIN SOURCE ----------
          public void shiftLeft(long shift, long length) {
              if (shift != 0L) {
                  int leftShift = (int)(shift & 63L);
                  int rightShift = 64 - leftShift;
                  int slotShift = (int)(shift >> 6);
                  int slotCount = this.bits.length - slotShift;
                  int slot;
                  int from;
                  if (leftShift == 0) {
                      slot = 0;

                      for(from = slotShift; slot < slotCount; ++from) {
                          this.bits[slot] = this.slot(from);
                          ++slot;
                      }
                  } else {
                      slot = 0;

                      for(from = slotShift; slot < slotCount; ++slot) {
                          long[] var10000 = this.bits;
                          long var10002 = this.slot(from) >>> leftShift;
                          ++from;
                          var10000[slot] = var10002 | this.slot(from) << rightShift;
                      }
                  }
              }

              this.resize(length);
          }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Maybe you should compare slot with the length of var10000

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: