com.sun.openpisces.Dasher throws java.lang.ArrayIndexOutOfBoundsException in method goTo

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 8
    • Affects Version/s: 7u15
    • Component/s: javafx
    • Environment:

      Mac OS 10.8.2

      com.sun.openpisces.Dasher can cause an ArrayIndexOutOfBoundsException to be thrown at line 159, during a call to System.arraycopy.

                     firstSegmentsBuffer =
                              Helpers.widenArray(firstSegmentsBuffer,
                                      firstSegidx, type - 2);
                      firstSegmentsBuffer[firstSegidx++] = type;
                      System.arraycopy(pts, off, firstSegmentsBuffer, firstSegidx, type - 2);

      Since firstSegidx is increased by 1 after firstSegmentsBuffer has been widened to make room for (type - 2) more elements, the arraycopy will fail if (firstSegidx + type - 2) is equal to (firstSegmentsBuffer.length).

      Changing the last argument in the call to Helpers.widenArray from (type -2) to (type -1) should solve the problem.

            Assignee:
            Jim Graham
            Reporter:
            J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: