nus-yam/ex-repair huggingface dataset:
Program: 70142
Project: 70142
Buggy source:
protected boolean isNullValue(CSSValue value){
  if (value == null) {
    return true;
  }
  String cssText=value.getCssText();
  return "String_Node_Str".equalsIgnoreCase(cssText) || "String_Node_Str".equalsIgnoreCase(cssText);
}

Fixed version (ground truth):
protected boolean isNullValue(CSSValue value){
  if (value == null) {
    return true;
  }
  if (value instanceof DataFormatValue) {
    return true;
  }
  String cssText=value.getCssText();
  return "String_Node_Str".equalsIgnoreCase(cssText) || "String_Node_Str".equalsIgnoreCase(cssText);
}
Program: 70143
Project: 70143
Buggy source:
public void setPosition(String pos){
  try {
    levelView.setAggregationHeaderLocation(pos);
  }
 catch (  SemanticException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void setPosition(String position){
  try {
    viewHandle.setGrandTotalLocation(position);
  }
 catch (  SemanticException e) {
  }
}
Program: 70144
Project: 70144
Buggy source:
public GrandTotalInfo copy(){
  GrandTotalInfo retValue=new GrandTotalInfo();
  retValue.setAggregationOn(isAggregationOn());
  retValue.setFunction(getFunction());
  retValue.setMeasureQualifiedName(getMeasureQualifiedName());
  retValue.setMeasureDisplayName(getMeasureDisplayName());
  retValue.setAssociation(isAssociation());
  retValue.setExpectedView(expectedView);
  return retValue;
}

Fixed version (ground truth):
public GrandTotalInfo copy(){
  GrandTotalInfo retValue=new GrandTotalInfo();
  retValue.setAggregationOn(isAggregationOn());
  retValue.setFunction(getFunction());
  retValue.setMeasureQualifiedName(getMeasureQualifiedName());
  retValue.setMeasureDisplayName(getMeasureDisplayName());
  retValue.setAssociation(isAssociation());
  retValue.setExpectedView(expectedView);
  retValue.setViewHandle(getViewHandle());
  retValue.setPosition(getPosition());
  return retValue;
}
Program: 70145
Project: 70145
Buggy source:
public String getPosition(){
  return levelView.getAggregationHeaderLocation();
}

Fixed version (ground truth):
public String getPosition(){
  return viewHandle.getGrandTotalLocation();
}
Program: 70146
Project: 70146
Buggy source:
public CellEditor[] getCellEditors(){
  if (cellEditor != null) {
    return cellEditor;
  }
  ComboBoxCellEditor comboCell=new ComboBoxCellEditor(viewer.getTable(),new String[0],SWT.READ_ONLY);
  cellEditor=new CellEditor[]{null,null,comboCell};
  return cellEditor;
}

Fixed version (ground truth):
public CellEditor[] getCellEditors(){
  if (cellEditor != null) {
    return cellEditor;
  }
  ComboBoxCellEditor comboCell=new ComboBoxCellEditor(viewer.getTable(),new String[0],SWT.READ_ONLY);
  ComboBoxCellEditor positionCell=new ComboBoxCellEditor(viewer.getTable(),positionItems,SWT.READ_ONLY);
  cellEditor=new CellEditor[]{null,null,comboCell,positionCell};
  return cellEditor;
}
Program: 70147
Project: 70147
Buggy source:
public boolean canModify(Object element,String property){
  if (Arrays.asList(columnNames).indexOf(property) == 2) {
    if (viewer instanceof CheckboxTableViewer) {
      return ((CheckboxTableViewer)viewer).getChecked(element);
    }
 else {
      return true;
    }
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean canModify(Object element,String property){
  if (Arrays.asList(columnNames).indexOf(property) == 2 || Arrays.asList(columnNames).indexOf(property) == 3) {
    if (viewer instanceof CheckboxTableViewer) {
      return ((CheckboxTableViewer)viewer).getChecked(element);
    }
 else {
      return true;
    }
  }
 else {
    return false;
  }
}
Program: 70148
Project: 70148
Buggy source:
public Object getValue(Object element,String property){
  if (element instanceof Item) {
    element=((Item)element).getData();
  }
  Object value=null;
  int index=Arrays.asList(columnNames).indexOf(property);
switch (index) {
case 1:
    break;
case 2:
  initializeItems((GrandTotalInfo)element);
((ComboBoxCellEditor)cellEditor[2]).setItems(comboItems);
String expectedView=((GrandTotalInfo)(element)).getExpectedView();
if (expectedView == null || expectedView.length() == 0) {
return Integer.valueOf(0);
}
int sel=Arrays.asList(viewNames).indexOf(expectedView);
value=sel <= 0 ? Integer.valueOf(0) : Integer.valueOf(sel);
break;
default :
}
return value;
}

Fixed version (ground truth):
public Object getValue(Object element,String property){
  if (element instanceof Item) {
    element=((Item)element).getData();
  }
  Object value=null;
  int index=Arrays.asList(columnNames).indexOf(property);
switch (index) {
case 1:
    break;
case 2:
  initializeItems((GrandTotalInfo)element);
((ComboBoxCellEditor)cellEditor[2]).setItems(comboItems);
String expectedView=((GrandTotalInfo)(element)).getExpectedView();
if (expectedView == null || expectedView.length() == 0) {
return Integer.valueOf(0);
}
int sel=Arrays.asList(viewNames).indexOf(expectedView);
value=sel <= 0 ? Integer.valueOf(0) : Integer.valueOf(sel);
break;
case 3:
String pos=((GrandTotalInfo)(element)).getPosition();
if (pos == null || pos.length() == 0) {
return Integer.valueOf(0);
}
int posIndex=Arrays.asList(positionValues).indexOf(pos);
value=posIndex <= 0 ? Integer.valueOf(0) : Integer.valueOf(posIndex);
break;
default :
}
return value;
}
Program: 70149
Project: 70149
Buggy source:
public void modify(Object element,String property,Object value){
  if (element instanceof Item) {
    element=((Item)element).getData();
  }
  int index=Arrays.asList(columnNames).indexOf(property);
switch (index) {
case 0:
    break;
case 1:
  break;
case 2:
int sel=((Integer)value).intValue();
if (sel == 0) {
((GrandTotalInfo)(element)).setExpectedView("String_Node_Str");
}
 else {
((GrandTotalInfo)element).setExpectedView(viewNames[sel]);
}
break;
default :
}
viewer.refresh();
}

Fixed version (ground truth):
public void modify(Object element,String property,Object value){
  if (element instanceof Item) {
    element=((Item)element).getData();
  }
  int index=Arrays.asList(columnNames).indexOf(property);
switch (index) {
case 0:
    break;
case 1:
  break;
case 2:
int sel=((Integer)value).intValue();
if (sel == 0) {
((GrandTotalInfo)(element)).setExpectedView("String_Node_Str");
}
 else {
((GrandTotalInfo)element).setExpectedView(viewNames[sel]);
}
break;
case 3:
int posIndex=((Integer)value).intValue();
((GrandTotalInfo)element).setPosition(positionValues[posIndex]);
break;
default :
}
viewer.refresh();
}
Program: 70150
Project: 70150
Buggy source:
public String getColumnText(Object element,int columnIndex){
  GrandTotalInfo info=(GrandTotalInfo)element;
switch (columnIndex) {
case 0:
    return "String_Node_Str";
case 1:
  return info.getMeasureDisplayName() == null ? "String_Node_Str" : info.getMeasureDisplayName();
case 2:
initializeItems(info);
((ComboBoxCellEditor)cellEditor[2]).setItems(comboItems);
String expectedView=info.getExpectedView();
if (expectedView == null) {
expectedView="String_Node_Str";
}
int index=Arrays.asList(viewNames).indexOf(expectedView);
if (index <= 0) {
index=0;
info.setExpectedView(viewNames[index]);
}
return comboItems[index];
default :
break;
}
return "String_Node_Str";
}

Fixed version (ground truth):
public String getColumnText(Object element,int columnIndex){
  GrandTotalInfo info=(GrandTotalInfo)element;
switch (columnIndex) {
case 0:
    return "String_Node_Str";
case 1:
  return info.getMeasureDisplayName() == null ? "String_Node_Str" : info.getMeasureDisplayName();
case 2:
initializeItems(info);
((ComboBoxCellEditor)cellEditor[2]).setItems(comboItems);
String expectedView=info.getExpectedView();
if (expectedView == null) {
expectedView="String_Node_Str";
}
int index=Arrays.asList(viewNames).indexOf(expectedView);
if (index <= 0) {
index=0;
info.setExpectedView(viewNames[index]);
}
return comboItems[index];
case 3:
String position=info.getPosition();
if (position == null) {
position="String_Node_Str";
}
int posIndex=Arrays.asList(positionValues).indexOf(position);
if (posIndex < 0) {
info.setPosition(positionValues[0]);
}
return positionItems[posIndex];
default :
break;
}
return "String_Node_Str";
}
Program: 70151
Project: 70151
Buggy source:
public int[] columnWidths(){
  return new int[]{20,210,120};
}

Fixed version (ground truth):
public int[] columnWidths(){
  return new int[]{20,210,120,120};
}
Program: 70152
Project: 70152
Buggy source:
private void replaceInfo(AggregationDialog.GrandTotalInfo info,List list){
  for (int i=0; i < list.size(); i++) {
    if (info.isSameInfo(list.get(i))) {
      AggregationDialog.GrandTotalInfo tempInfo=(AggregationDialog.GrandTotalInfo)list.get(i);
      tempInfo.setAggregationOn(true);
      tempInfo.setFunction(info.getFunction());
      tempInfo.setExpectedView(info.getExpectedView());
    }
  }
}

Fixed version (ground truth):
private void replaceInfo(AggregationDialog.GrandTotalInfo info,List list){
  for (int i=0; i < list.size(); i++) {
    if (info.isSameInfo(list.get(i))) {
      AggregationDialog.GrandTotalInfo tempInfo=(AggregationDialog.GrandTotalInfo)list.get(i);
      tempInfo.setAggregationOn(true);
      tempInfo.setFunction(info.getFunction());
      tempInfo.setExpectedView(info.getExpectedView());
      tempInfo.setViewHandle(info.getViewHandle());
      tempInfo.setPosition(info.getPosition());
    }
  }
}
Program: 70154
Project: 70154
Buggy source:
protected ImageArea createImageArea(IImageContent content){
  ImageArea area=new ImageArea();
switch (content.getImageSource()) {
case IImageContent.IMAGE_FILE:
case IImageContent.IMAGE_URL:
    area.setUrl(content.getURI());
  area.setExtension(content.getExtension());
area.setMIMEType(content.getMIMEType());
break;
case IImageContent.IMAGE_NAME:
case IImageContent.IMAGE_EXPRESSION:
area.setData(content.getData());
area.setExtension(content.getExtension());
area.setMIMEType(content.getMIMEType());
break;
}
return area;
}

Fixed version (ground truth):
protected ImageArea createImageArea(IImageContent content){
  ImageArea area=new ImageArea();
switch (content.getImageSource()) {
case IImageContent.IMAGE_FILE:
case IImageContent.IMAGE_URL:
    area.setUrl(content.getURI());
  area.setExtension(content.getExtension());
area.setMIMEType(content.getMIMEType());
break;
case IImageContent.IMAGE_NAME:
case IImageContent.IMAGE_EXPRESSION:
area.setData(content.getData());
area.setExtension(content.getExtension());
area.setMIMEType(content.getMIMEType());
break;
}
if (content instanceof ObjectContent) {
ObjectContent object=(ObjectContent)content;
area.setParameters(object.getParamters());
}
return area;
}
Program: 70156
Project: 70156
Buggy source:
public CubeQueryUtil(DataRequestSessionImpl session){
  this.session=session;
}

Fixed version (ground truth):
public CubeQueryUtil(DataRequestSessionImpl session){
  this.sessionImpl=session;
}
Program: 70157
Project: 70157
Buggy source:
/** 
 * @param hierHandle
 * @throws BirtException
 */
private void defineDataSourceAndDataSet(DataSetHandle dataSet) throws BirtException {
  IModelAdapter modelAdaptor=session.getModelAdaptor();
  DataSourceHandle dataSource=dataSet.getDataSource();
  if (dataSource != null) {
    session.defineDataSource(modelAdaptor.adaptDataSource(dataSource));
  }
  if (dataSet instanceof JointDataSetHandle) {
    JointDataSetHandle jointDataSet=(JointDataSetHandle)dataSet;
    Iterator iter=jointDataSet.dataSetsIterator();
    while (iter.hasNext()) {
      DataSetHandle childDataSet=(DataSetHandle)iter.next();
      if (childDataSet != null) {
        DataSourceHandle childDataSource=childDataSet.getDataSource();
        if (childDataSource != null) {
          session.defineDataSource(modelAdaptor.adaptDataSource(childDataSource));
        }
        defineDataSourceAndDataSet(childDataSet);
      }
    }
  }
  session.defineDataSet(modelAdaptor.adaptDataSet(dataSet));
}

Fixed version (ground truth):
/** 
 * @param hierHandle
 * @throws BirtException
 */
private void defineDataSourceAndDataSet(DataSetHandle dataSet) throws BirtException {
  IModelAdapter modelAdaptor=sessionImpl.getModelAdaptor();
  DataSourceHandle dataSource=dataSet.getDataSource();
  if (dataSource != null) {
    sessionImpl.defineDataSource(modelAdaptor.adaptDataSource(dataSource));
  }
  if (dataSet instanceof JointDataSetHandle) {
    JointDataSetHandle jointDataSet=(JointDataSetHandle)dataSet;
    Iterator iter=jointDataSet.dataSetsIterator();
    while (iter.hasNext()) {
      DataSetHandle childDataSet=(DataSetHandle)iter.next();
      if (childDataSet != null) {
        DataSourceHandle childDataSource=childDataSet.getDataSource();
        if (childDataSource != null) {
          sessionImpl.defineDataSource(modelAdaptor.adaptDataSource(childDataSource));
        }
        defineDataSourceAndDataSet(childDataSet);
      }
    }
  }
  sessionImpl.defineDataSet(modelAdaptor.adaptDataSet(dataSet));
}
Program: 70158
Project: 70158
Buggy source:
/** 
 * @param appContext
 * @param hierHandle
 * @return
 * @throws AdapterException
 * @throws BirtException
 */
private DataSetIterator createDataSetIterator(Map appContext,TabularHierarchyHandle hierHandle) throws AdapterException, BirtException {
  List<ColumnMeta> metaList=new ArrayList<ColumnMeta>();
  IQueryDefinition defn=DataRequestSessionImpl.createQuery(session,hierHandle,metaList);
  return new DataSetIterator(this.session,defn,metaList,appContext);
}

Fixed version (ground truth):
/** 
 * @param appContext
 * @param hierHandle
 * @return
 * @throws AdapterException
 * @throws BirtException
 */
private DataSetIterator createDataSetIterator(Map appContext,TabularHierarchyHandle hierHandle) throws AdapterException, BirtException {
  List<ColumnMeta> metaList=new ArrayList<ColumnMeta>();
  IQueryDefinition defn=sessionImpl.createQuery(sessionImpl,hierHandle,metaList);
  return new DataSetIterator(this.sessionImpl,defn,metaList,appContext);
}
Program: 70159
Project: 70159
Buggy source:
/** 
 * @param cubeHandle
 * @throws AdapterException
 * @throws DataException
 */
private void prepareForCubeGeneration(TabularCubeHandle cubeHandle,Map<ReportElementHandle,IQueryDefinition> queryMap,Map<ReportElementHandle,List<ColumnMeta>> metaMap) throws AdapterException, DataException {
  List<IQueryDefinition> queryDefns=new ArrayList<IQueryDefinition>();
  List<ColumnMeta> metaList=new ArrayList<ColumnMeta>();
  IQueryDefinition query=DataRequestSessionImpl.createQuery(this,cubeHandle,metaList);
  queryDefns.add(query);
  queryMap.put(cubeHandle,query);
  metaMap.put(cubeHandle,metaList);
  List<DimensionHandle> dimHandles=cubeHandle.getContents(CubeHandle.DIMENSIONS_PROP);
  for (  DimensionHandle dim : dimHandles) {
    List<TabularHierarchyHandle> hiers=dim.getContents(DimensionHandle.HIERARCHIES_PROP);
    for (    TabularHierarchyHandle hier : hiers) {
      metaList=new ArrayList<ColumnMeta>();
      query=DataRequestSessionImpl.createQuery(this,hier,metaList);
      queryDefns.add(query);
      queryMap.put(hier,query);
      metaMap.put(hier,metaList);
    }
  }
  this.dataEngine.registerQueries(queryDefns.toArray(new IDataQueryDefinition[0]));
}

Fixed version (ground truth):
/** 
 * @param cubeHandle
 * @throws BirtException 
 */
private void prepareForCubeGeneration(TabularCubeHandle cubeHandle,Map<ReportElementHandle,IQueryDefinition> queryMap,Map<ReportElementHandle,List<ColumnMeta>> metaMap) throws BirtException {
  List<IQueryDefinition> queryDefns=new ArrayList<IQueryDefinition>();
  List<ColumnMeta> metaList=new ArrayList<ColumnMeta>();
  IQueryDefinition query=createQuery(this,cubeHandle,metaList);
  queryDefns.add(query);
  queryMap.put(cubeHandle,query);
  metaMap.put(cubeHandle,metaList);
  List<DimensionHandle> dimHandles=cubeHandle.getContents(CubeHandle.DIMENSIONS_PROP);
  for (  DimensionHandle dim : dimHandles) {
    List<TabularHierarchyHandle> hiers=dim.getContents(DimensionHandle.HIERARCHIES_PROP);
    for (    TabularHierarchyHandle hier : hiers) {
      metaList=new ArrayList<ColumnMeta>();
      query=createQuery(this,hier,metaList);
      queryDefns.add(query);
      queryMap.put(hier,query);
      metaMap.put(hier,metaList);
    }
  }
  this.dataEngine.registerQueries(queryDefns.toArray(new IDataQueryDefinition[0]));
}
Program: 70161
Project: 70161
Buggy source:
/** 
 * Create a query definition for an Hierarchy.
 * @param session
 * @param hierHandle
 * @param metaList
 * @return
 * @throws AdapterException
 */
static QueryDefinition createQuery(DataRequestSessionImpl session,TabularHierarchyHandle hierHandle,List metaList) throws AdapterException {
}

Fixed version (ground truth):
/** 
 * Create a query definition for an Hierarchy.
 * @param session
 * @param hierHandle
 * @param metaList
 * @return
 * @throws BirtException 
 */
QueryDefinition createQuery(DataRequestSessionImpl session,TabularHierarchyHandle hierHandle,List metaList) throws BirtException {
}
Program: 70162
Project: 70162
Buggy source:
public IBaseQueryResults execute(IBasePreparedQuery query,IBaseQueryResults outerResults,Scriptable scope) throws AdapterException {
  try {
    if (query instanceof IPreparedQuery) {
      return ((IPreparedQuery)query).execute(outerResults,scope);
    }
 else     if (query instanceof IPreparedCubeQuery) {
      return ((IPreparedCubeQuery)query).execute(outerResults,scope);
    }
    return null;
  }
 catch (  BirtException e) {
    throw new AdapterException(ResourceConstants.EXCEPTION_ERROR,e);
  }
}

Fixed version (ground truth):
public IBaseQueryResults execute(IBasePreparedQuery query,IBaseQueryResults outerResults,Scriptable scope) throws AdapterException {
  try {
    if (query instanceof IPreparedQuery) {
      return ((IPreparedQuery)query).execute(outerResults,scope);
    }
 else     if (query instanceof IPreparedCubeQuery) {
      String queryName=((IPreparedCubeQuery)query).getCubeQueryDefinition().getName();
      if (this.cubeHandleMap.get(queryName) != null) {
        this.materializeCube((CubeHandle)this.cubeHandleMap.get(queryName),this.sessionContext.getAppContext());
        this.cubeHandleMap.remove(queryName);
      }
      return ((IPreparedCubeQuery)query).execute(outerResults,scope);
    }
    return null;
  }
 catch (  BirtException e) {
    throw new AdapterException(ResourceConstants.EXCEPTION_ERROR,e);
  }
}
Program: 70163
Project: 70163
Buggy source:
/** 
 * Get the default width.
 * @param colNumber The column number.
 * @return The default width.
 */
public int getDefaultWidth(int colNumber){
  Dimension size=getPreferredSize().shrink(getFigure().getInsets().getWidth(),getFigure().getInsets().getHeight());
  ;
  if (getRowCount() == 0) {
    return size.width;
  }
  int allNumbers=getColumnCount();
  if (allNumbers <= 0) {
    return size.width;
  }
  if (colNumber <= 0) {
    return size.width;
  }
  int width=size.width;
  int columnNumber=allNumbers;
  for (int i=1; i < columnNumber + 1; i++) {
    DimensionHandle dimHandle=getCrosstabHandleAdapter().getColumnWidth(colNumber);
    if (dimHandle != null && dimHandle.getMeasure() > 0) {
      allNumbers=allNumbers - 1;
      width=width - getColumnWidthValue(colNumber);
    }
 else     if (dimHandle == null) {
      ITableLayoutOwner.DimensionInfomation info=getColumnWidth(colNumber);
      if (DesignChoiceConstants.UNITS_PERCENTAGE.equals(info.getUnits())) {
        Dimension dim=getFigure().getParent().getClientArea().getSize();
        int containerWidth=dim.width;
        width=width - ((int)(info.getMeasure() * containerWidth / 100));
      }
    }
  }
  if (colNumber == allNumbers) {
    return width / allNumbers + width % allNumbers;
  }
  return (width / allNumbers);
}

Fixed version (ground truth):
/** 
 * Get the default width.
 * @param colNumber The column number.
 * @return The default width.
 */
public int getDefaultWidth(int colNumber){
  Dimension size=getPreferredSize().shrink(getFigure().getInsets().getWidth(),getFigure().getInsets().getHeight());
  ;
  if (getRowCount() == 0) {
    return size.width;
  }
  int allNumbers=getColumnCount();
  if (allNumbers <= 0) {
    return size.width;
  }
  if (colNumber <= 0) {
    return size.width;
  }
  int width=size.width;
  int columnNumber=allNumbers;
  for (int i=1; i < columnNumber + 1; i++) {
    DimensionHandle dimHandle=getCrosstabHandleAdapter().getColumnWidth(colNumber);
    boolean bool=isFixLayout() && dimHandle != null && DesignChoiceConstants.UNITS_PERCENTAGE.equals(dimHandle.getUnits());
    if (dimHandle != null && dimHandle.getMeasure() > 0 && !bool) {
      allNumbers=allNumbers - 1;
      width=width - getColumnWidthValue(colNumber);
    }
 else     if (dimHandle == null) {
      ITableLayoutOwner.DimensionInfomation info=getColumnWidth(colNumber);
      if (DesignChoiceConstants.UNITS_PERCENTAGE.equals(info.getUnits())) {
        Dimension dim=getFigure().getParent().getClientArea().getSize();
        int containerWidth=dim.width;
        width=width - ((int)(info.getMeasure() * containerWidth / 100));
      }
    }
  }
  if (colNumber == allNumbers) {
    return width / allNumbers + width % allNumbers;
  }
  return (width / allNumbers);
}
Program: 70164
Project: 70164
Buggy source:
protected void propertyChange(Map info){
  Set set=info.keySet();
  Iterator itor=set.iterator();
  while (itor.hasNext()) {
    Object obj=itor.next();
    if (ICrosstabReportItemConstants.MEASURE_DIRECTION_PROP.equals(obj) || ICrosstabReportItemConstants.PAGE_LAYOUT_PROP.equals(obj) || ILevelViewConstants.AGGREGATION_HEADER_LOCATION_PROP.equals(obj)|| ICrosstabReportItemConstants.HIDE_MEASURE_HEADER_PROP.equals(obj)) {
      refresh();
      return;
    }
  }
  super.propertyChange(info);
}

Fixed version (ground truth):
protected void propertyChange(Map info){
  Set set=info.keySet();
  Iterator itor=set.iterator();
  while (itor.hasNext()) {
    Object obj=itor.next();
    if (ICrosstabReportItemConstants.MEASURE_DIRECTION_PROP.equals(obj) || ICrosstabReportItemConstants.PAGE_LAYOUT_PROP.equals(obj) || ILevelViewConstants.AGGREGATION_HEADER_LOCATION_PROP.equals(obj)|| ICrosstabReportItemConstants.HIDE_MEASURE_HEADER_PROP.equals(obj)|| ICrosstabViewConstants.GRAND_TOTAL_LOCATIION_PROP.equals(obj)) {
      refresh();
      return;
    }
  }
  super.propertyChange(info);
}
Program: 70165
Project: 70165
Buggy source:
private void addTotalMeasureHeader(int axisType,LevelViewHandle levelView,MeasureViewHandle mv) throws SemanticException {
  if (mv == null) {
    return;
  }
  int targetAxis=MEASURE_DIRECTION_VERTICAL.equals(crosstab.getMeasureDirection()) ? ROW_AXIS_TYPE : COLUMN_AXIS_TYPE;
  if (targetAxis != axisType) {
    return;
  }
  if (levelView == null) {
    ExtendedItemHandle newHeader=CrosstabExtendedItemFactory.createCrosstabCell(mv.getModuleHandle());
    mv.getHeaderProperty().add(newHeader);
  }
 else {
    List<LevelViewHandle> levels=CrosstabModelUtil.getAllAggregationLevels(crosstab,targetAxis);
    Collections.reverse(levels);
    for (int i=0; i < levels.size(); i++) {
      if (levelView == levels.get(i)) {
        ExtendedItemHandle newHeader=CrosstabExtendedItemFactory.createCrosstabCell(mv.getModuleHandle());
        mv.getHeaderProperty().add(newHeader,i);
        break;
      }
    }
  }
}

Fixed version (ground truth):
private void addTotalMeasureHeader(int axisType,LevelViewHandle levelView,MeasureViewHandle mv) throws SemanticException {
  if (mv == null) {
    return;
  }
  int targetAxis=MEASURE_DIRECTION_VERTICAL.equals(crosstab.getMeasureDirection()) ? ROW_AXIS_TYPE : COLUMN_AXIS_TYPE;
  if (targetAxis != axisType) {
    return;
  }
  if (levelView == null) {
    ExtendedItemHandle newHeader=CrosstabExtendedItemFactory.createCrosstabCell(mv.getModuleHandle());
    mv.getHeaderProperty().add(newHeader);
    CrosstabModelUtil.notifyCreation(ICrosstabModelListener.MEASURE_HEADER,CrosstabUtil.getReportItem(newHeader));
  }
 else {
    List<LevelViewHandle> levels=CrosstabModelUtil.getAllAggregationLevels(crosstab,targetAxis);
    Collections.reverse(levels);
    for (int i=0; i < levels.size(); i++) {
      if (levelView == levels.get(i)) {
        ExtendedItemHandle newHeader=CrosstabExtendedItemFactory.createCrosstabCell(mv.getModuleHandle());
        mv.getHeaderProperty().add(newHeader,i);
        CrosstabModelUtil.notifyCreation(ICrosstabModelListener.MEASURE_HEADER,CrosstabUtil.getReportItem(newHeader));
        break;
      }
    }
  }
}
Program: 70166
Project: 70166
Buggy source:
private void validateSingleMeasureHeader(MeasureViewHandle measureView) throws SemanticException {
  if (measureView == null) {
    return;
  }
  int expectHeaders=CrosstabModelUtil.computeAllMeasureHeaderCount(crosstab,measureView);
  int availableHeaders=measureView.getHeaderCount();
  if (availableHeaders < expectHeaders) {
    PropertyHandle propHandle=measureView.getHeaderProperty();
    for (int i=0; i < expectHeaders - availableHeaders; i++) {
      ExtendedItemHandle headerCell=CrosstabExtendedItemFactory.createCrosstabCell(measureView.getModuleHandle());
      propHandle.add(headerCell);
    }
  }
 else   if (availableHeaders > expectHeaders) {
    PropertyHandle propHandle=measureView.getHeaderProperty();
    List contents=propHandle.getContents();
    for (int i=0; i < availableHeaders - expectHeaders; i++) {
      ((DesignElementHandle)contents.get(contents.size() - i - 1)).drop();
    }
  }
}

Fixed version (ground truth):
private void validateSingleMeasureHeader(MeasureViewHandle measureView) throws SemanticException {
  if (measureView == null) {
    return;
  }
  int expectHeaders=CrosstabModelUtil.computeAllMeasureHeaderCount(crosstab,measureView);
  int availableHeaders=measureView.getHeaderCount();
  if (availableHeaders < expectHeaders) {
    PropertyHandle propHandle=measureView.getHeaderProperty();
    for (int i=0; i < expectHeaders - availableHeaders; i++) {
      ExtendedItemHandle headerCell=CrosstabExtendedItemFactory.createCrosstabCell(measureView.getModuleHandle());
      propHandle.add(headerCell);
      CrosstabModelUtil.notifyCreation(ICrosstabModelListener.MEASURE_HEADER,CrosstabUtil.getReportItem(headerCell));
    }
  }
 else   if (availableHeaders > expectHeaders) {
    PropertyHandle propHandle=measureView.getHeaderProperty();
    List contents=propHandle.getContents();
    for (int i=0; i < availableHeaders - expectHeaders; i++) {
      ((DesignElementHandle)contents.get(contents.size() - i - 1)).drop();
    }
  }
}
Program: 70167
Project: 70167
Buggy source:
/** 
 * Adds header cell for current measure. If header cell already exists, this method just does nothing.
 * @throws SemanticException
 */
public void addHeader() throws SemanticException {
  PropertyHandle propHandle=focus.getHeaderProperty();
  int expectHeaders=CrosstabModelUtil.computeAllMeasureHeaderCount(crosstab,focus);
  int availableHeaders=propHandle.getContentCount();
  if (availableHeaders >= expectHeaders) {
    focus.getLogger().log(Level.INFO,"String_Node_Str");
    return;
  }
  CommandStack stack=focus.getCommandStack();
  stack.startTrans(Messages.getString("String_Node_Str"));
  try {
    for (int i=0; i < expectHeaders - availableHeaders; i++) {
      ExtendedItemHandle headerCell=CrosstabExtendedItemFactory.createCrosstabCell(focus.getModuleHandle());
      propHandle.add(headerCell);
    }
  }
 catch (  SemanticException e) {
    focus.getLogger().log(Level.WARNING,e.getMessage(),e);
    stack.rollback();
    throw e;
  }
  stack.commit();
}

Fixed version (ground truth):
/** 
 * Adds header cell for current measure. If header cell already exists, this method just does nothing.
 * @throws SemanticException
 */
public void addHeader() throws SemanticException {
  PropertyHandle propHandle=focus.getHeaderProperty();
  int expectHeaders=CrosstabModelUtil.computeAllMeasureHeaderCount(crosstab,focus);
  int availableHeaders=propHandle.getContentCount();
  if (availableHeaders >= expectHeaders) {
    focus.getLogger().log(Level.INFO,"String_Node_Str");
    return;
  }
  CommandStack stack=focus.getCommandStack();
  stack.startTrans(Messages.getString("String_Node_Str"));
  try {
    for (int i=0; i < expectHeaders - availableHeaders; i++) {
      ExtendedItemHandle headerCell=CrosstabExtendedItemFactory.createCrosstabCell(focus.getModuleHandle());
      propHandle.add(headerCell);
      CrosstabModelUtil.notifyCreation(ICrosstabModelListener.MEASURE_HEADER,CrosstabUtil.getReportItem(headerCell));
    }
  }
 catch (  SemanticException e) {
    focus.getLogger().log(Level.WARNING,e.getMessage(),e);
    stack.rollback();
    throw e;
  }
  stack.commit();
}
Program: 70168
Project: 70168
Buggy source:
public boolean next() throws DataException {
  if (this.streamsWrapper != null && currResultObj != null) {
    try {
      if (dataSetStream != null) {
        int colCount=this.currResultObj.getResultClass().getFieldCount();
        Set resultSetNameSet=ResultSetUtil.getRsColumnRequestMap(handler.getAllColumnBindings());
        IOUtil.writeLong(dataSetLenStream,offset);
        offset+=ResultSetUtil.writeResultObject(new DataOutputStream(dataSetStream),currResultObj,colCount,resultSetNameSet);
      }
    }
 catch (    IOException e) {
    }
  }
  this.currResultObj=this.rowResultSet.next(stopSign);
  if (this.currResultObj != null)   rowCount++;
  return this.currResultObj != null;
}

Fixed version (ground truth):
public boolean next() throws DataException {
  if (this.streamsWrapper != null && currResultObj != null) {
    try {
      if (dataSetStream != null) {
        int colCount=this.currResultObj.getResultClass().getFieldCount();
        IOUtil.writeLong(dataSetLenStream,offset);
        offset+=ResultSetUtil.writeResultObject(new DataOutputStream(dataSetStream),currResultObj,colCount,resultSetNameSet);
      }
    }
 catch (    IOException e) {
    }
  }
  this.currResultObj=this.rowResultSet.next(stopSign);
  if (this.currResultObj != null)   rowCount++;
  return this.currResultObj != null;
}
Program: 70169
Project: 70169
Buggy source:
/** 
 * @param dataSourceQuery
 * @param resultSet
 * @param resultClass
 * @param stopSign
 * @throws DataException
 */
public SimpleResultSet(DataSourceQuery dataSourceQuery,ResultSet resultSet,IResultClass resultClass,IEventHandler handler,StopSign stopSign) throws DataException {
  this.rowResultSet=new RowResultSet(new SmartCacheRequest(dataSourceQuery.getMaxRows(),dataSourceQuery.getFetchEvents(),new OdiAdapter(resultSet),resultClass,false));
  this.currResultObj=this.rowResultSet.next(stopSign);
  this.initialRowCount=(this.currResultObj != null) ? -1 : 0;
  this.rowCount=(this.currResultObj != null) ? 1 : 0;
  this.resultSet=resultSet;
  this.stopSign=stopSign;
  this.handler=handler;
}

Fixed version (ground truth):
/** 
 * @param dataSourceQuery
 * @param resultSet
 * @param resultClass
 * @param stopSign
 * @throws DataException
 */
public SimpleResultSet(DataSourceQuery dataSourceQuery,ResultSet resultSet,IResultClass resultClass,IEventHandler handler,StopSign stopSign) throws DataException {
  this.rowResultSet=new RowResultSet(new SmartCacheRequest(dataSourceQuery.getMaxRows(),dataSourceQuery.getFetchEvents(),new OdiAdapter(resultSet),resultClass,false));
  this.currResultObj=this.rowResultSet.next(stopSign);
  this.initialRowCount=(this.currResultObj != null) ? -1 : 0;
  this.rowCount=(this.currResultObj != null) ? 1 : 0;
  this.resultSet=resultSet;
  this.stopSign=stopSign;
  this.handler=handler;
  this.resultSetNameSet=ResultSetUtil.getRsColumnRequestMap(handler.getAllColumnBindings());
}
Program: 70170
Project: 70170
Buggy source:
private String calculateText(){
  if (blankLine) {
    return "String_Node_Str";
  }
 else {
    return text.substring(offset,offset + textLength);
  }
}

Fixed version (ground truth):
private String calculateText(){
  if (blankLine || text == null) {
    return "String_Node_Str";
  }
 else {
    return text.substring(offset,offset + textLength);
  }
}
Program: 70171
Project: 70171
Buggy source:
/** 
 * @return
 */
protected String[][] getAttributeNames(){
  String[][] result=new String[keyLevelIndex.length][];
  for (int i=0; i < keyLevelIndex.length; i++) {
    String[][] attributeNames=aggrResultSet.getAttributeNames();
    if (attributeNames != null && attributeNames.length > keyLevelIndex[i])     result[i]=attributeNames[keyLevelIndex[i]];
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @return
 */
protected String[][] getAttributeNames(){
  if (keyLevelIndex == null)   return null;
  String[][] result=new String[keyLevelIndex.length][];
  for (int i=0; i < keyLevelIndex.length; i++) {
    String[][] attributeNames=aggrResultSet.getAttributeNames();
    if (attributeNames != null && attributeNames.length > keyLevelIndex[i])     result[i]=attributeNames[keyLevelIndex[i]];
  }
  return result;
}
Program: 70172
Project: 70172
Buggy source:
/** 
 * @return
 */
protected String[][] getKeyNames(){
  String[][] result=new String[keyLevelIndex.length][];
  for (int i=0; i < keyLevelIndex.length; i++) {
    String[][] keyNames=aggrResultSet.getKeyNames();
    if (keyNames != null && keyNames.length > keyLevelIndex[i])     result[i]=keyNames[keyLevelIndex[i]];
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @return
 */
protected String[][] getKeyNames(){
  if (keyLevelIndex == null)   return null;
  String[][] result=new String[keyLevelIndex.length][];
  for (int i=0; i < keyLevelIndex.length; i++) {
    String[][] keyNames=aggrResultSet.getKeyNames();
    if (keyNames != null && keyNames.length > keyLevelIndex[i])     result[i]=keyNames[keyLevelIndex[i]];
  }
  return result;
}
Program: 70173
Project: 70173
Buggy source:
/** 
 * @param resultBindingList
 * @param bindingCollection
 * @throws DataException 
 */
protected static void addQueryBindings(List<IBinding> resultBindingList,Collection bindingCollection) throws DataException {
  Iterator bindingIterator=bindingCollection.iterator();
  while (bindingIterator.hasNext()) {
    IBinding binding=(IBinding)(bindingIterator.next());
    IBaseExpression expr=binding.getExpression();
    if (expr instanceof IScriptExpression && !ExpressionUtil.hasAggregation(((IScriptExpression)expr).getText())) {
      boolean exist=false;
      for (int i=0; i < resultBindingList.size(); i++) {
        if (resultBindingList.get(i) != null && resultBindingList.get(i).getBindingName().equals(binding.getBindingName())) {
          exist=true;
        }
      }
      if (!exist)       resultBindingList.add(binding);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param resultBindingList
 * @param bindingCollection
 * @throws DataException 
 */
protected static void addQueryBindings(List<IBinding> resultBindingList,Collection bindingCollection) throws DataException {
  Iterator bindingIterator=bindingCollection.iterator();
  while (bindingIterator.hasNext()) {
    IBinding binding=(IBinding)(bindingIterator.next());
    if (binding.getAggrFunction() != null)     continue;
    IBaseExpression expr=binding.getExpression();
    if (expr instanceof IScriptExpression && !ExpressionUtil.hasAggregation(((IScriptExpression)expr).getText())) {
      boolean exist=false;
      for (int i=0; i < resultBindingList.size(); i++) {
        if (resultBindingList.get(i) != null && resultBindingList.get(i).getBindingName().equals(binding.getBindingName())) {
          exist=true;
        }
      }
      if (!exist)       resultBindingList.add(binding);
    }
  }
}
Program: 70174
Project: 70174
Buggy source:
/** 
 * Get the computed column instance according to the group type.If group has interval, return GroupComputedColumn, otherwise return normal computed column.
 * @param cx
 * @param groupSpecs
 * @param i
 * @param src
 * @param expr
 * @param groupName
 * @param dest
 * @return
 * @throws DataException
 */
private IComputedColumn getComputedColumnInstance(Context cx,int interval,IGroupDefinition src,String expr,String groupName,IQuery.GroupSpec dest,int dataType) throws DataException {
  if (dest.getInterval() != IGroupDefinition.NO_INTERVAL) {
    return new GroupComputedColumn(groupName,expr,QueryExecutorUtil.getTempComputedColumnType(interval),GroupCalculatorFactory.getGroupCalculator(src.getInterval(),src.getIntervalStart(),src.getIntervalRange(),dataType));
  }
 else {
    return new ComputedColumn(groupName,expr,dataType);
  }
}

Fixed version (ground truth):
/** 
 * Get the computed column instance according to the group type.If group has interval, return GroupComputedColumn, otherwise return normal computed column.
 * @param cx
 * @param groupSpecs
 * @param i
 * @param src
 * @param expr
 * @param groupName
 * @param dest
 * @return
 * @throws DataException
 */
private IComputedColumn getComputedColumnInstance(Context cx,int interval,IGroupDefinition src,String expr,String groupName,IQuery.GroupSpec dest,int dataType) throws DataException {
  if (dest.getInterval() != IGroupDefinition.NO_INTERVAL) {
    return new GroupComputedColumn(groupName,expr,QueryExecutorUtil.getTempComputedColumnType(interval),GroupCalculatorFactory.getGroupCalculator(src.getInterval(),src.getIntervalStart(),src.getIntervalRange(),dataType,session.getEngineContext().getLocale()));
  }
 else {
    return new ComputedColumn(groupName,expr,dataType);
  }
}
Program: 70175
Project: 70175
Buggy source:
RunningFunctionCalculator(AggregationDefinition aggregation,IAggregationResultSet aggrResultSet) throws DataException, IOException {
  super(aggregation,aggrResultSet);
  keyLevelIndex=getKeyLevelIndexs(aggrResultSet.getAllLevels());
  facttableRow=new FacttableRow(getMeasureInfo());
  needMultiplePass=needMultiplePass(aggregation);
}

Fixed version (ground truth):
RunningFunctionCalculator(AggregationDefinition aggregation,IAggregationResultSet aggrResultSet) throws DataException, IOException {
  super(aggregation,aggrResultSet);
  if (aggrResultSet.getAllLevels() != null) {
    keyLevelIndex=getKeyLevelIndexs(aggrResultSet.getAllLevels());
  }
 else {
    keyLevelIndex=null;
  }
  facttableRow=new FacttableRow(getMeasureInfo());
  needMultiplePass=needMultiplePass(aggregation);
}
Program: 70176
Project: 70176
Buggy source:
public IAggregationResultSet execute(StopSign stopSign) throws IOException, DataException {
  AggregationResultRowComparator comparator=new AggregationResultRowComparator(getKeyLevelIndexs(aggregation.getLevels()));
  SortedAggregationRowArray sortedRows=new SortedAggregationRowArray(aggrResultSet,aggregation.getLevels());
  IDiskArray result=new BufferedStructureArray(AggregationResultRow.getCreator(),Constants.LIST_BUFFER_SIZE);
  if (aggrResultSet.length() <= 0) {
    return getAggregationResultSet(result);
  }
  IAggregationResultRow lastRow=sortedRows.get(0);
  IAggregationResultRow currentRow=null;
  int lastIndex=0;
  onRow(lastRow);
  if (!needMultiplePass) {
    addOneResultRow(result,lastRow);
  }
  for (int i=1; !stopSign.isStopped() && i < sortedRows.size(); i++) {
    currentRow=sortedRows.get(i);
    if (comparator.compare(currentRow,lastRow) != 0) {
      if (needMultiplePass) {
        secondPass(sortedRows,result,lastIndex,i);
        lastIndex=i;
      }
      createAccumulators();
    }
    onRow(currentRow);
    if (!needMultiplePass) {
      addOneResultRow(result,currentRow);
    }
    lastRow=currentRow;
  }
  if (needMultiplePass) {
    secondPass(sortedRows,result,lastIndex,sortedRows.size());
  }
  return getAggregationResultSet(result);
}

Fixed version (ground truth):
public IAggregationResultSet execute(StopSign stopSign) throws IOException, DataException {
  AggregationResultRowComparator comparator=null;
  if (aggregation.getLevels() != null) {
    comparator=new AggregationResultRowComparator(getKeyLevelIndexs(aggregation.getLevels()));
  }
  SortedAggregationRowArray sortedRows=new SortedAggregationRowArray(aggrResultSet,aggregation.getLevels());
  IDiskArray result=new BufferedStructureArray(AggregationResultRow.getCreator(),Constants.LIST_BUFFER_SIZE);
  if (aggrResultSet.length() <= 0) {
    return getAggregationResultSet(result);
  }
  IAggregationResultRow lastRow=sortedRows.get(0);
  IAggregationResultRow currentRow=null;
  int lastIndex=0;
  onRow(lastRow);
  if (!needMultiplePass) {
    addOneResultRow(result,lastRow);
  }
  for (int i=1; !stopSign.isStopped() && i < sortedRows.size(); i++) {
    currentRow=sortedRows.get(i);
    if (comparator != null && comparator.compare(currentRow,lastRow) != 0) {
      if (needMultiplePass) {
        secondPass(sortedRows,result,lastIndex,i);
        lastIndex=i;
      }
      createAccumulators();
    }
    onRow(currentRow);
    if (!needMultiplePass) {
      addOneResultRow(result,currentRow);
    }
    lastRow=currentRow;
  }
  if (needMultiplePass) {
    secondPass(sortedRows,result,lastIndex,sortedRows.size());
  }
  return getAggregationResultSet(result);
}
Program: 70177
Project: 70177
Buggy source:
SimpleFunctionCalculator(AggregationDefinition aggregation,IAggregationResultSet aggrResultSet) throws DataException, IOException {
  super(aggregation,aggrResultSet);
  keyLevelIndex=getKeyLevelIndexs(aggregation.getLevels());
  facttableRow=new FacttableRow(getMeasureInfo());
}

Fixed version (ground truth):
SimpleFunctionCalculator(AggregationDefinition aggregation,IAggregationResultSet aggrResultSet) throws DataException, IOException {
  super(aggregation,aggrResultSet);
  if (aggregation.getLevels() != null) {
    keyLevelIndex=getKeyLevelIndexs(aggregation.getLevels());
  }
 else {
    keyLevelIndex=null;
  }
  facttableRow=new FacttableRow(getMeasureInfo());
}
Program: 70179
Project: 70179
Buggy source:
public SortedAggregationRowArray(IAggregationResultSet aggregationResultSet,DimLevel[] keyLevels) throws IOException {
  this.aggregationResultSet=aggregationResultSet;
  if (needReSort(keyLevels)) {
    sort(keyLevels);
  }
}

Fixed version (ground truth):
public SortedAggregationRowArray(IAggregationResultSet aggregationResultSet,DimLevel[] keyLevels) throws IOException {
  this.aggregationResultSet=aggregationResultSet;
  if (keyLevels != null && needReSort(keyLevels)) {
    sort(keyLevels);
  }
}
Program: 70180
Project: 70180
Buggy source:
/** 
 * Adds the measreview handle to the CrosstabReportItemHandle.
 * @param reportHandle
 * @param measureHandle
 * @param position
 * @throws SemanticException
 */
public static void addMeasureHandle(CrosstabReportItemHandle reportHandle,MeasureHandle measureHandle,int position) throws SemanticException {
  MeasureViewHandle measureViewHandle=reportHandle.insertMeasure(measureHandle,position);
  measureViewHandle.addHeader();
  LabelHandle labelHandle=DesignElementFactory.getInstance().newLabel(null);
  labelHandle.setText(measureHandle.getName());
  measureViewHandle.getHeader().addContent(labelHandle);
}

Fixed version (ground truth):
/** 
 * Adds the measreview handle to the CrosstabReportItemHandle.
 * @param reportHandle
 * @param measureHandle
 * @param position
 * @throws SemanticException
 */
public static void addMeasureHandle(CrosstabReportItemHandle reportHandle,MeasureHandle measureHandle,int position) throws SemanticException {
  MeasureViewHandle measureViewHandle=reportHandle.insertMeasure(measureHandle,position);
  measureViewHandle.addHeader();
}
Program: 70181
Project: 70181
Buggy source:
private int addMesureHeader(List list,int baseColumn,int area,List measures){
  if (isVertical() && area == ICrosstabConstants.COLUMN_AXIS_TYPE) {
    return 0;
  }
 else   if (!isVertical() && area == ICrosstabConstants.ROW_AXIS_TYPE) {
    return 0;
  }
  int measureCount=measures.size();
  if (isHideHeader()) {
    return measureCount;
  }
  for (int k=0; k < measureCount; k++) {
    MeasureViewHandle preMmeasureHandle=(MeasureViewHandle)measures.get(k);
    CrosstabCellHandle preMeasureCellHandle=preMmeasureHandle.getHeader();
    CrosstabCellAdapter measureCellAdapt=factory.createCrosstabCellAdapter(ICrosstabCellAdapterFactory.CELL_MEASURE_HEADER,preMeasureCellHandle,1,-1,baseColumn + k + 1,-1,isVertical());
    list.add(measureCellAdapt);
  }
  return measureCount;
}

Fixed version (ground truth):
private int addMesureHeader(List list,int baseColumn,int area,List measures,LevelViewHandle levelHandle){
  if (isVertical() && area == ICrosstabConstants.COLUMN_AXIS_TYPE) {
    return 0;
  }
 else   if (!isVertical() && area == ICrosstabConstants.ROW_AXIS_TYPE) {
    return 0;
  }
  int measureCount=measures.size();
  if (isHideHeader()) {
    return measureCount;
  }
  for (int k=0; k < measureCount; k++) {
    MeasureViewHandle preMmeasureHandle=(MeasureViewHandle)measures.get(k);
    CrosstabCellHandle preMeasureCellHandle=preMmeasureHandle.getHeader(levelHandle);
    CrosstabCellAdapter measureCellAdapt=factory.createCrosstabCellAdapter(ICrosstabCellAdapterFactory.CELL_MEASURE_HEADER,preMeasureCellHandle,1,-1,baseColumn + k + 1,-1,isVertical());
    list.add(measureCellAdapt);
  }
  return measureCount;
}
Program: 70184
Project: 70184
Buggy source:
/** 
 * This method is called when the plug-in is stopped
 */
public void stop(BundleContext context) throws Exception {
  super.stop(context);
  plugin=null;
}

Fixed version (ground truth):
/** 
 * This method is called when the plug-in is stopped
 */
public void stop(BundleContext context) throws Exception {
  super.stop(context);
  plugin=null;
  CrosstabModelUtil.setCrosstabModelListener(null);
}
Program: 70185
Project: 70185
Buggy source:
/** 
 * This method is called upon plug-in activation
 */
public void start(BundleContext context) throws Exception {
  super.start(context);
  PreferenceFactory.getInstance().getPreferences(CrosstabPlugin.getDefault()).setDefault(PREFERENCE_FILTER_LIMIT,FILTER_LIMIT_DEFAULT);
  PreferenceFactory.getInstance().getPreferences(CrosstabPlugin.getDefault()).setDefault(PREFERENCE_AUTO_DEL_BINDINGS,AUTO_DEL_BINDING_DEFAULT);
  PreferenceFactory.getInstance().getPreferences(CrosstabPlugin.getDefault()).setDefault(CUBE_BUILDER_WARNING_PREFERENCE,MessageDialogWithToggle.PROMPT);
}

Fixed version (ground truth):
/** 
 * This method is called upon plug-in activation
 */
public void start(BundleContext context) throws Exception {
  super.start(context);
  PreferenceFactory.getInstance().getPreferences(CrosstabPlugin.getDefault()).setDefault(PREFERENCE_FILTER_LIMIT,FILTER_LIMIT_DEFAULT);
  PreferenceFactory.getInstance().getPreferences(CrosstabPlugin.getDefault()).setDefault(PREFERENCE_AUTO_DEL_BINDINGS,AUTO_DEL_BINDING_DEFAULT);
  PreferenceFactory.getInstance().getPreferences(CrosstabPlugin.getDefault()).setDefault(CUBE_BUILDER_WARNING_PREFERENCE,MessageDialogWithToggle.PROMPT);
  CrosstabModelUtil.setCrosstabModelListener(new ICrosstabModelListener(){
    public void onCreated(    int type,    Object model){
      if (type == ICrosstabModelListener.MEASURE_HEADER && model instanceof CrosstabCellHandle) {
        CrosstabCellHandle cellHandle=((CrosstabCellHandle)model);
        if (cellHandle.getContents().size() > 0) {
          return;
        }
        LabelHandle labelHandle=DesignElementFactory.getInstance().newLabel(null);
        try {
          labelHandle.setText(((MeasureViewHandle)cellHandle.getContainer()).getCubeMeasureName());
          cellHandle.addContent(labelHandle);
        }
 catch (        SemanticException e) {
          ExceptionHandler.handle(e);
        }
      }
    }
  }
);
}
Program: 70186
Project: 70186
Buggy source:
/** 
 * @param intervalStart
 * @param intervalRange
 * @throws BirtException
 */
public DateGroupCalculator(Object intervalStart,double intervalRange) throws BirtException {
  super(intervalStart,intervalRange);
  range=(int)Math.round(intervalRange);
  range=(range == 0 ? 1 : range);
  if (intervalStart != null)   this.intervalStart=DataTypeUtil.toDate(intervalStart);
}

Fixed version (ground truth):
/** 
 * @param intervalStart
 * @param intervalRange
 * @throws BirtException
 */
public DateGroupCalculator(Object intervalStart,double intervalRange,ULocale locale) throws BirtException {
  super(intervalStart,intervalRange);
  range=(int)Math.round(intervalRange);
  range=(range == 0 ? 1 : range);
  if (intervalStart != null)   this.intervalStart=DataTypeUtil.toDate(intervalStart);
  this.locale=locale == null ? ULocale.getDefault() : locale;
  Calendar c=Calendar.getInstance(this.locale);
  c.clear();
  c.set(1970,0,1);
  defaultStart=c.getTime();
  this.dateTimeUtil=new DateTimeUtil(this.locale);
}
Program: 70187
Project: 70187
Buggy source:
/** 
 * @param intervalStart
 * @param intervalRange
 * @throws BirtException
 */
public DayGroupCalculator(Object intervalStart,double intervalRange) throws BirtException {
  super(intervalStart,intervalRange);
}

Fixed version (ground truth):
/** 
 * @param intervalStart
 * @param intervalRange
 * @throws BirtException
 */
public DayGroupCalculator(Object intervalStart,double intervalRange,ULocale locale) throws BirtException {
  super(intervalStart,intervalRange,locale);
}