Program: 76112
Project: 76112
Buggy source:
private void advance(){
  int mx;
  try {
    while (walker.hasNext()) {
      ColumnEvent ev=walker.next();
switch (currentChangeType) {
case ColumnEvent.ROW_EDGE_CHANGE:
        if (rowEdgeStarted) {
          nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getDimension(ROW_AXIS_TYPE,lastDimensionIndex).getLevel(lastLevelIndex).getCell(),rowSpan,colSpan,currentColIndex - colSpan + 1);
          ((CrosstabCellExecutor)nextExecutor).setForceEmpty(isForceEmpty());
          rowEdgeStarted=false;
          hasLast=false;
        }
      break;
case ColumnEvent.MEASURE_HEADER_CHANGE:
    nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getMeasure(rowIndex).getHeader(),rowSpan,colSpan,currentColIndex - colSpan + 1);
  hasLast=false;
break;
case ColumnEvent.MEASURE_CHANGE:
case ColumnEvent.COLUMN_EDGE_CHANGE:
mx=lastMeasureIndex < 0 ? rowIndex : lastMeasureIndex;
nextExecutor=new CrosstabCellExecutor(this,totalMeasureCount > 0 ? crosstabItem.getMeasure(mx).getCell() : null,rowSpan,colSpan,currentColIndex - colSpan + 1);
((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
hasLast=false;
break;
case ColumnEvent.COLUMN_TOTAL_CHANGE:
case ColumnEvent.GRAND_TOTAL_CHANGE:
mx=lastMeasureIndex < 0 ? rowIndex : lastMeasureIndex;
nextExecutor=new CrosstabCellExecutor(this,getRowSubTotalCell(lastDimensionIndex,lastLevelIndex,mx),rowSpan,colSpan,currentColIndex - colSpan + 1);
((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
hasLast=false;
break;
}
if (isRowEdgeNeedStart(ev)) {
rowEdgeStarted=true;
rowSpan=GroupUtil.computeRowSpan(crosstabItem,rowGroups,ev.dimensionIndex,ev.levelIndex,getRowEdgeCursor(),isLayoutDownThenOver) * factor;
colSpan=0;
lastDimensionIndex=ev.dimensionIndex;
lastLevelIndex=ev.levelIndex;
hasLast=true;
}
 else if (ev.type == ColumnEvent.MEASURE_CHANGE || ev.type == ColumnEvent.COLUMN_TOTAL_CHANGE || ev.type == ColumnEvent.COLUMN_EDGE_CHANGE || ev.type == ColumnEvent.GRAND_TOTAL_CHANGE) {
rowSpan=1;
colSpan=0;
lastMeasureIndex=ev.measureIndex;
lastDimensionIndex=ev.dimensionIndex;
lastLevelIndex=ev.levelIndex;
hasLast=true;
}
 else if (ev.type == ColumnEvent.MEASURE_HEADER_CHANGE) {
rowSpan=1;
colSpan=0;
hasLast=true;
}
currentChangeType=ev.type;
currentEdgePosition=ev.dataPosition;
colSpan++;
currentColIndex++;
if (nextExecutor != null) {
return;
}
}
}
 catch (OLAPException e) {
logger.log(Level.SEVERE,Messages.getString("String_Node_Str"),e);
}
if (hasLast) {
hasLast=false;
switch (currentChangeType) {
case ColumnEvent.ROW_EDGE_CHANGE:
if (rowEdgeStarted) {
nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getDimension(ROW_AXIS_TYPE,lastDimensionIndex).getLevel(lastLevelIndex).getCell(),rowSpan,colSpan,currentColIndex - colSpan + 1);
((CrosstabCellExecutor)nextExecutor).setForceEmpty(isForceEmpty());
rowEdgeStarted=false;
}
break;
case ColumnEvent.MEASURE_HEADER_CHANGE:
nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getMeasure(rowIndex).getHeader(),rowSpan,colSpan,currentColIndex - colSpan + 1);
break;
case ColumnEvent.MEASURE_CHANGE:
case ColumnEvent.COLUMN_EDGE_CHANGE:
mx=lastMeasureIndex < 0 ? rowIndex : lastMeasureIndex;
nextExecutor=new CrosstabCellExecutor(this,totalMeasureCount > 0 ? crosstabItem.getMeasure(mx).getCell() : null,rowSpan,colSpan,currentColIndex - colSpan + 1);
((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
break;
case ColumnEvent.COLUMN_TOTAL_CHANGE:
case ColumnEvent.GRAND_TOTAL_CHANGE:
mx=lastMeasureIndex < 0 ? rowIndex : lastMeasureIndex;
nextExecutor=new CrosstabCellExecutor(this,getRowSubTotalCell(lastDimensionIndex,lastLevelIndex,mx),rowSpan,colSpan,currentColIndex - colSpan + 1);
((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
break;
}
}
}

Fixed version (ground truth):
private void advance(){
  int mx;
  try {
    while (walker.hasNext()) {
      ColumnEvent ev=walker.next();
switch (currentChangeType) {
case ColumnEvent.ROW_EDGE_CHANGE:
        if (rowEdgeStarted) {
          nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getDimension(ROW_AXIS_TYPE,lastDimensionIndex).getLevel(lastLevelIndex).getCell(),rowSpan,colSpan,currentColIndex - colSpan + 1);
          ((CrosstabCellExecutor)nextExecutor).setForceEmpty(isForceEmpty());
          rowEdgeStarted=false;
          hasLast=false;
        }
      break;
case ColumnEvent.MEASURE_HEADER_CHANGE:
    nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getMeasure(rowIndex).getHeader(),rowSpan,colSpan,currentColIndex - colSpan + 1);
  hasLast=false;
break;
case ColumnEvent.MEASURE_CHANGE:
case ColumnEvent.COLUMN_EDGE_CHANGE:
mx=lastMeasureIndex < 0 ? rowIndex : lastMeasureIndex;
nextExecutor=new CrosstabCellExecutor(this,totalMeasureCount > 0 ? crosstabItem.getMeasure(mx).getCell() : null,rowSpan,colSpan,currentColIndex - colSpan + 1);
((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
hasLast=false;
break;
case ColumnEvent.COLUMN_TOTAL_CHANGE:
case ColumnEvent.GRAND_TOTAL_CHANGE:
mx=lastMeasureIndex < 0 ? rowIndex : lastMeasureIndex;
nextExecutor=new CrosstabCellExecutor(this,getRowSubTotalCell(lastDimensionIndex,lastLevelIndex,mx),rowSpan,colSpan,currentColIndex - colSpan + 1);
((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
hasLast=false;
break;
}
if (isRowEdgeNeedStart(ev)) {
rowEdgeStarted=true;
rowSpan=GroupUtil.computeRowSpan(crosstabItem,rowGroups,ev.dimensionIndex,ev.levelIndex,getRowEdgeCursor(),isLayoutDownThenOver);
colSpan=0;
lastDimensionIndex=ev.dimensionIndex;
lastLevelIndex=ev.levelIndex;
hasLast=true;
}
 else if (ev.type == ColumnEvent.MEASURE_CHANGE || ev.type == ColumnEvent.COLUMN_TOTAL_CHANGE || ev.type == ColumnEvent.COLUMN_EDGE_CHANGE || ev.type == ColumnEvent.GRAND_TOTAL_CHANGE) {
rowSpan=1;
colSpan=0;
lastMeasureIndex=ev.measureIndex;
lastDimensionIndex=ev.dimensionIndex;
lastLevelIndex=ev.levelIndex;
hasLast=true;
}
 else if (ev.type == ColumnEvent.MEASURE_HEADER_CHANGE) {
rowSpan=1;
colSpan=0;
hasLast=true;
}
currentChangeType=ev.type;
currentEdgePosition=ev.dataPosition;
colSpan++;
currentColIndex++;
if (nextExecutor != null) {
return;
}
}
}
 catch (OLAPException e) {
logger.log(Level.SEVERE,Messages.getString("String_Node_Str"),e);
}
if (hasLast) {
hasLast=false;
switch (currentChangeType) {
case ColumnEvent.ROW_EDGE_CHANGE:
if (rowEdgeStarted) {
nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getDimension(ROW_AXIS_TYPE,lastDimensionIndex).getLevel(lastLevelIndex).getCell(),rowSpan,colSpan,currentColIndex - colSpan + 1);
((CrosstabCellExecutor)nextExecutor).setForceEmpty(isForceEmpty());
rowEdgeStarted=false;
}
break;
case ColumnEvent.MEASURE_HEADER_CHANGE:
nextExecutor=new CrosstabCellExecutor(this,crosstabItem.getMeasure(rowIndex).getHeader(),rowSpan,colSpan,currentColIndex - colSpan + 1);
break;
case ColumnEvent.MEASURE_CHANGE:
case ColumnEvent.COLUMN_EDGE_CHANGE:
mx=lastMeasureIndex < 0 ? rowIndex : lastMeasureIndex;
nextExecutor=new CrosstabCellExecutor(this,totalMeasureCount > 0 ? crosstabItem.getMeasure(mx).getCell() : null,rowSpan,colSpan,currentColIndex - colSpan + 1);
((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
break;
case ColumnEvent.COLUMN_TOTAL_CHANGE:
case ColumnEvent.GRAND_TOTAL_CHANGE:
mx=lastMeasureIndex < 0 ? rowIndex : lastMeasureIndex;
nextExecutor=new CrosstabCellExecutor(this,getRowSubTotalCell(lastDimensionIndex,lastLevelIndex,mx),rowSpan,colSpan,currentColIndex - colSpan + 1);
((CrosstabCellExecutor)nextExecutor).setPosition(currentEdgePosition);
break;
}
}
}