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

dead cycle in java.desktop

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 17
    • client-libs

      A DESCRIPTION OF THE PROBLEM :
      We generated a unit test automatically and it failed with dead cycle.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      @Test
        public void test_addCharString_1_1(){

            short short1 = 0;
            byte byte2 = 0;
            com.sun.imageio.plugins.common.LZWStringTable lZWStringTable0 = new com.sun.imageio.plugins.common.LZWStringTable();
            lZWStringTable0.addCharString(short1, byte2);

        }

      ACTUAL -
      dead cycle in LZWStringTable.java:88.
      The reason is that ' strHsh[i] != HASH_FREE ' is always true.

      ---------- BEGIN SOURCE ----------
      public int addCharString(short index, byte b) {
              int hshidx;

              if (numStrings >= MAXSTR) { // if used up all codes
                  return 0xFFFF;
              }

              hshidx = hash(index, b);
              while (strHsh[hshidx] != HASH_FREE) {
                  hshidx = (hshidx + HASHSTEP) % HASHSIZE;
              }

              strHsh[hshidx] = numStrings;
              strChr[numStrings] = b;
              if (index == HASH_FREE) {
                  strNxt[numStrings] = NEXT_FIRST;
                  strLen[numStrings] = 1;
              } else {
                  strNxt[numStrings] = index;
                  strLen[numStrings] = strLen[index] + 1;
              }

              return numStrings++; // return the code and inc for next code
          }
      ---------- END SOURCE ----------

      FREQUENCY : occasionally


            pnarayanaswa Praveen Narayanaswamy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: