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

unit test fail: NegativeArraySizeException

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Linux / jdk -8

      A DESCRIPTION OF THE PROBLEM :
      The unit test case we generated automatically failed.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      The unit test case is :
        @Test
        public void test_resize_1_1() {
            long long2 = 4537745743783926328L;
            long long3 = -1L;
            BitVector bitVector0 = new BitVector(long3);
            bitVector0.resize(long2);
        }

      ACTUAL -
      java.lang.NegativeArraySizeException
      at java.util.Arrays.copyOf(Arrays.java:3308)
      at jdk.nashorn.internal.runtime.BitVector.resize(BitVector.java:117)
      at nashorn.internal.runtime.BitVector_Test.test_resize_1_1(BitVector_Test.java:37)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
      at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
      at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
      at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
      at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
      at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
      at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
      at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
      at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

      ---------- BEGIN SOURCE ----------
      public void resize(long length) {
              int need = (int)growthNeeded(length);
              if (this.bits.length != need) {
                  this.bits = Arrays.copyOf(this.bits, need);
              }

              int shift = (int)(length & 63L);
              int slot = (int)(length >> 6);
              if (shift != 0) {
                  long[] var10000 = this.bits;
                  var10000[slot] &= (1L << shift) - 1L;
                  ++slot;
              }

              while(slot < this.bits.length) {
                  this.bits[slot] = 0L;
                  ++slot;
              }

          }
      ---------- END SOURCE ----------

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

              Created:
              Updated:
              Resolved: