-
Bug
-
Resolution: Fixed
-
P4
-
7u15
-
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.
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.