Program: 58666
Project: 58666
Buggy source:
/** 
 * Function used for updating cursor position of level 2 in case of dragging
 * @param gl
 */
private void handleCursorDraggingLevel2(final GL gl){
  Point currentPoint=glMouseListener.getPickedPoint();
  float[] fArTargetWorldCoordinates=new float[3];
  int iselElement;
  int iNrSamples;
  fArTargetWorldCoordinates=GLCoordinateUtils.convertWindowCoordinatesToWorldCoordinates(gl,currentPoint.x,currentPoint.y);
  float fTextureHeight=viewFrustum.getHeight() - 0.6f;
  float fStep=fTextureHeight / iSamplesLevel2;
  float fYPosMouse=fArTargetWorldCoordinates[1] - 0.4f;
  if (iDraggedCursorLevel2 == 1) {
    if (fYPosMouse > fPosCursorLastElementLevel2 && fYPosMouse <= viewFrustum.getHeight() - 0.6f) {
      iselElement=(int)Math.floor((fTextureHeight - fYPosMouse) / fStep);
      iNrSamples=iLastSampleLevel2 - iselElement + 1;
      if (iNrSamples >= MIN_SAMPLES_PER_HEATMAP && iNrSamples < MAX_SAMPLES_PER_HEATMAP) {
        fPosCursorFirstElementLevel2=fYPosMouse;
        iFirstSampleLevel2=iselElement;
        iSamplesPerHeatmap=iLastSampleLevel2 - iFirstSampleLevel2 + 1;
      }
    }
  }
  if (iDraggedCursorLevel2 == 2) {
    if (fYPosMouse < fPosCursorFirstElementLevel2 && fYPosMouse >= 0.0f) {
      iselElement=(int)Math.floor((fTextureHeight - fYPosMouse) / fStep);
      iNrSamples=iselElement - iFirstSampleLevel2 + 1;
      if (iNrSamples >= MIN_SAMPLES_PER_HEATMAP && iNrSamples < MAX_SAMPLES_PER_HEATMAP) {
        fPosCursorLastElementLevel2=fYPosMouse;
        iLastSampleLevel2=iselElement;
        iSamplesPerHeatmap=iLastSampleLevel2 - iFirstSampleLevel2 + 1;
      }
    }
  }
  setDisplayListDirty();
  setEmbeddedHeatMapData();
  if (glMouseListener.wasMouseReleased()) {
    bIsDraggingActiveLevel2=false;
    bDisableBlockDraggingLevel2=false;
    bActivateDraggingLevel2=false;
  }
}

Fixed version (ground truth):
/** 
 * Function used for updating cursor position of level 2 in case of dragging
 * @param gl
 */
private void handleCursorDraggingLevel2(final GL gl){
  Point currentPoint=glMouseListener.getPickedPoint();
  float[] fArTargetWorldCoordinates=new float[3];
  int iselElement;
  int iNrSamples;
  fArTargetWorldCoordinates=GLCoordinateUtils.convertWindowCoordinatesToWorldCoordinates(gl,currentPoint.x,currentPoint.y);
  float fTextureHeight=viewFrustum.getHeight() - 0.6f;
  float fStep=fTextureHeight / iSamplesLevel2;
  float fYPosMouse=fArTargetWorldCoordinates[1] - 0.4f;
  if (iDraggedCursorLevel2 == 1) {
    if (fYPosMouse > fPosCursorLastElementLevel2 && fYPosMouse <= viewFrustum.getHeight() - 0.6f) {
      iselElement=(int)Math.floor((fTextureHeight - fYPosMouse) / fStep);
      iNrSamples=iLastSampleLevel2 - iselElement + 1;
      if (iNrSamples >= MIN_SAMPLES_PER_HEATMAP && iNrSamples < MAX_SAMPLES_PER_HEATMAP) {
        fPosCursorFirstElementLevel2=fYPosMouse;
        iFirstSampleLevel2=iselElement;
        iSamplesPerHeatmap=iLastSampleLevel2 - iFirstSampleLevel2 + 1;
      }
    }
  }
  if (iDraggedCursorLevel2 == 2) {
    if (fYPosMouse < fPosCursorFirstElementLevel2 && fYPosMouse >= 0.0f) {
      iselElement=(int)Math.floor((fTextureHeight - fYPosMouse) / fStep);
      iNrSamples=iselElement - iFirstSampleLevel2 + 1;
      if (iNrSamples >= MIN_SAMPLES_PER_HEATMAP && iNrSamples < MAX_SAMPLES_PER_HEATMAP) {
        fPosCursorLastElementLevel2=fYPosMouse;
        iLastSampleLevel2=iselElement;
        iSamplesPerHeatmap=iLastSampleLevel2 - iFirstSampleLevel2 + 1;
      }
    }
  }
  setDisplayListDirty();
  if (glMouseListener.wasMouseReleased()) {
    bIsDraggingActiveLevel2=false;
    bDisableBlockDraggingLevel2=false;
    bActivateDraggingLevel2=false;
  }
}