Program: 76109
Project: 76109
Buggy source:
/** 
 * Advance until find next executor or till the end.
 */
private void advance(){
  try {
    while (walker.hasNext()) {
      ColumnEvent ev=walker.next();
switch (currentChangeType) {
case ColumnEvent.ROW_EDGE_CHANGE:
case ColumnEvent.MEASURE_HEADER_CHANGE:
        if (blankStarted && ev.type != ColumnEvent.ROW_EDGE_CHANGE && ev.type != ColumnEvent.MEASURE_HEADER_CHANGE) {
          nextExecutor=new CrosstabCellExecutor(this,null,rowSpan,colSpan,currentColIndex - colSpan + 1);
          blankStarted=false;
          hasLast=false;
        }
      break;
case ColumnEvent.COLUMN_EDGE_CHANGE:
case ColumnEvent.COLUMN_TOTAL_CHANGE:
    if (edgeStarted && isMeetEdgeEnd(ev)) {
      nextExecutor=new CrosstabCellExecutor(this,levelView.getCell(),rowSpan,colSpan,currentColIndex - colSpan + 1);
      ((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
      ((CrosstabCellExecutor)nextExecutor).setForceEmpty(isForceEmpty());
      edgeStarted=false;
      hasLast=false;
    }
 else     if (subTotalStarted && (ev.type != currentChangeType || ev.dimensionIndex != subTotalDimensionIndex || ev.levelIndex != subTotalLevelIndex)) {
      nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getDimension(COLUMN_AXIS_TYPE,subTotalDimensionIndex).getLevel(subTotalLevelIndex).getAggregationHeader(),rowSpan,colSpan,currentColIndex - colSpan + 1);
      ((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
      subTotalStarted=false;
      hasLast=false;
    }
  break;
case ColumnEvent.GRAND_TOTAL_CHANGE:
if (grandTotalStarted && ev.type != currentChangeType) {
  nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getGrandTotal(COLUMN_AXIS_TYPE),rowSpan,colSpan,currentColIndex - colSpan + 1);
  ((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
  grandTotalStarted=false;
  hasLast=false;
}
break;
}
if (isSubTotalNeedStart(ev)) {
subTotalStarted=true;
rowSpan=GroupUtil.computeGroupSpan(columnGroups,subTotalDimensionIndex,subTotalLevelIndex);
if (isLayoutDownThenOver) {
rowSpan++;
}
colSpan=0;
hasLast=true;
}
 else if (isGrandTotalNeedStart(ev)) {
grandTotalStarted=true;
rowSpan=GroupUtil.computeGroupSpan(columnGroups,currentDimensionIndex,currentLevelIndex) + 1;
colSpan=0;
hasLast=true;
}
 else if (isEdgeNeedStart(ev)) {
edgeStarted=true;
rowSpan=1;
colSpan=0;
hasLast=true;
}
 else if (isBlankNeedStart(ev)) {
blankStarted=true;
rowSpan=GroupUtil.computeGroupSpan(columnGroups,currentDimensionIndex,currentLevelIndex) + 1;
if (hasMeasureHeader(COLUMN_AXIS_TYPE)) {
rowSpan++;
}
hasLast=true;
}
currentEdgePosition=ev.dataPosition;
currentChangeType=ev.type;
colSpan++;
currentColIndex++;
if (nextExecutor != null) {
return;
}
}
}
 catch (OLAPException e) {
logger.log(Level.SEVERE,Messages.getString("String_Node_Str"),e);
}
if (hasLast) {
hasLast=false;
if (blankStarted) {
nextExecutor=new CrosstabCellExecutor(this,null,rowSpan,colSpan,currentColIndex - colSpan + 1);
}
 else if (edgeStarted) {
nextExecutor=new CrosstabCellExecutor(this,levelView.getCell(),rowSpan,colSpan,currentColIndex - colSpan + 1);
((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
((CrosstabCellExecutor)nextExecutor).setForceEmpty(isForceEmpty());
edgeStarted=false;
}
 else if (subTotalStarted) {
nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getDimension(COLUMN_AXIS_TYPE,subTotalDimensionIndex).getLevel(subTotalLevelIndex).getAggregationHeader(),rowSpan,colSpan,currentColIndex);
((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
subTotalStarted=false;
}
 else if (grandTotalStarted) {
nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getGrandTotal(COLUMN_AXIS_TYPE),rowSpan,colSpan,currentColIndex - colSpan + 1);
((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
grandTotalStarted=false;
}
}
}

Fixed version (ground truth):
/** 
 * Advance until find next executor or till the end.
 */
private void advance(){
  try {
    while (walker.hasNext()) {
      ColumnEvent ev=walker.next();
switch (currentChangeType) {
case ColumnEvent.ROW_EDGE_CHANGE:
case ColumnEvent.MEASURE_HEADER_CHANGE:
        if (blankStarted && ev.type != ColumnEvent.ROW_EDGE_CHANGE && ev.type != ColumnEvent.MEASURE_HEADER_CHANGE) {
          nextExecutor=new CrosstabCellExecutor(this,null,rowSpan,colSpan,currentColIndex - colSpan + 1);
          blankStarted=false;
          hasLast=false;
        }
      break;
case ColumnEvent.COLUMN_EDGE_CHANGE:
case ColumnEvent.COLUMN_TOTAL_CHANGE:
    if (edgeStarted && isMeetEdgeEnd(ev)) {
      nextExecutor=new CrosstabCellExecutor(this,levelView.getCell(),rowSpan,colSpan,currentColIndex - colSpan + 1);
      ((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
      ((CrosstabCellExecutor)nextExecutor).setForceEmpty(isForceEmpty());
      edgeStarted=false;
      hasLast=false;
    }
 else     if (subTotalStarted && (ev.type != currentChangeType || ev.dimensionIndex != subTotalDimensionIndex || ev.levelIndex != subTotalLevelIndex)) {
      nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getDimension(COLUMN_AXIS_TYPE,subTotalDimensionIndex).getLevel(subTotalLevelIndex).getAggregationHeader(),rowSpan,colSpan,currentColIndex - colSpan + 1);
      ((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
      subTotalStarted=false;
      hasLast=false;
    }
  break;
case ColumnEvent.GRAND_TOTAL_CHANGE:
if (grandTotalStarted && ev.type != currentChangeType) {
  nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getGrandTotal(COLUMN_AXIS_TYPE),rowSpan,colSpan,currentColIndex - colSpan + 1);
  ((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
  grandTotalStarted=false;
  hasLast=false;
}
break;
}
if (isSubTotalNeedStart(ev)) {
subTotalStarted=true;
rowSpan=GroupUtil.computeGroupSpan(columnGroups,subTotalDimensionIndex,subTotalLevelIndex);
if (isLayoutDownThenOver) {
rowSpan++;
}
colSpan=0;
hasLast=true;
}
 else if (isGrandTotalNeedStart(ev)) {
grandTotalStarted=true;
rowSpan=GroupUtil.computeGroupSpan(columnGroups,currentDimensionIndex,currentLevelIndex) + 1;
colSpan=0;
hasLast=true;
}
 else if (isEdgeNeedStart(ev)) {
edgeStarted=true;
rowSpan=1;
colSpan=0;
hasLast=true;
}
 else if (isBlankNeedStart(ev)) {
blankStarted=true;
rowSpan=GroupUtil.computeGroupSpan(columnGroups,currentDimensionIndex,currentLevelIndex) + 1;
if (GroupUtil.hasMeasureHeader(crosstabItem,COLUMN_AXIS_TYPE)) {
rowSpan++;
}
hasLast=true;
}
currentEdgePosition=ev.dataPosition;
currentChangeType=ev.type;
colSpan++;
currentColIndex++;
if (nextExecutor != null) {
return;
}
}
}
 catch (OLAPException e) {
logger.log(Level.SEVERE,Messages.getString("String_Node_Str"),e);
}
if (hasLast) {
hasLast=false;
if (blankStarted) {
nextExecutor=new CrosstabCellExecutor(this,null,rowSpan,colSpan,currentColIndex - colSpan + 1);
}
 else if (edgeStarted) {
nextExecutor=new CrosstabCellExecutor(this,levelView.getCell(),rowSpan,colSpan,currentColIndex - colSpan + 1);
((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
((CrosstabCellExecutor)nextExecutor).setForceEmpty(isForceEmpty());
edgeStarted=false;
}
 else if (subTotalStarted) {
nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getDimension(COLUMN_AXIS_TYPE,subTotalDimensionIndex).getLevel(subTotalLevelIndex).getAggregationHeader(),rowSpan,colSpan,currentColIndex);
((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
subTotalStarted=false;
}
 else if (grandTotalStarted) {
nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getGrandTotal(COLUMN_AXIS_TYPE),rowSpan,colSpan,currentColIndex - colSpan + 1);
((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
grandTotalStarted=false;
}
}
}