nus-yam/ex-repair huggingface dataset:
Program: 76434
Project: 76434
Buggy source:
private boolean matchType(ResultSetColumnHandle column){
  if (style.equals(DesignChoiceConstants.PARAM_TYPE_STRING) || DesignChoiceConstants.COLUMN_DATA_TYPE_ANY.equals(column.getDataType())) {
    return true;
  }
  if (DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME.equals(column.getDataType())) {
    return style.equals(DesignChoiceConstants.PARAM_TYPE_DATETIME);
  }
 else   if (DesignChoiceConstants.COLUMN_DATA_TYPE_DECIMAL.equals(column.getDataType())) {
    return style.equals(DesignChoiceConstants.PARAM_TYPE_DECIMAL) || style.equals(DesignChoiceConstants.PARAM_TYPE_INTEGER);
  }
 else   if (DesignChoiceConstants.COLUMN_DATA_TYPE_FLOAT.equals(column.getDataType())) {
    return style.equals(DesignChoiceConstants.PARAM_TYPE_FLOAT);
  }
 else   if (DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER.equals(column.getDataType())) {
    return style.equals(DesignChoiceConstants.PARAM_TYPE_INTEGER);
  }
  return false;
}

Fixed version (ground truth):
private boolean matchType(ResultSetColumnHandle column){
  if (style.equals(DesignChoiceConstants.PARAM_TYPE_STRING) || DesignChoiceConstants.COLUMN_DATA_TYPE_ANY.equals(column.getDataType())) {
    return true;
  }
  if (DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME.equals(column.getDataType())) {
    return style.equals(DesignChoiceConstants.PARAM_TYPE_DATETIME);
  }
 else   if (DesignChoiceConstants.COLUMN_DATA_TYPE_DECIMAL.equals(column.getDataType())) {
    return style.equals(DesignChoiceConstants.PARAM_TYPE_DECIMAL) || style.equals(DesignChoiceConstants.PARAM_TYPE_INTEGER);
  }
 else   if (DesignChoiceConstants.COLUMN_DATA_TYPE_FLOAT.equals(column.getDataType())) {
    return style.equals(DesignChoiceConstants.PARAM_TYPE_FLOAT);
  }
 else   if (DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER.equals(column.getDataType())) {
    return style.equals(DesignChoiceConstants.PARAM_TYPE_INTEGER);
  }
 else   if (DesignChoiceConstants.COLUMN_DATA_TYPE_BOOLEAN.equals(column.getDataType())) {
    return style.equals(DesignChoiceConstants.PARAM_TYPE_BOOLEAN);
  }
  return false;
}
Program: 76435
Project: 76435
Buggy source:
private boolean matchDataType(ScalarParameterHandle handle,ResultSetColumnHandle columnHandle){
  String type=handle.getDataType();
  if (handle == selectedParameter && dataTypeChooser.isEnabled()) {
    type=getSelectedDataType();
  }
  if (DesignChoiceConstants.PARAM_TYPE_STRING.equals(type) || DesignChoiceConstants.COLUMN_DATA_TYPE_ANY.equals(columnHandle.getDataType())) {
    return true;
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_BOOLEAN.equals(type)) {
    return DesignChoiceConstants.COLUMN_DATA_TYPE_ANY.equals(columnHandle.getDataType());
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equals(type)) {
    return DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME.equals(columnHandle.getDataType());
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals(type)) {
    return DesignChoiceConstants.COLUMN_DATA_TYPE_DECIMAL.equals(columnHandle.getDataType());
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_FLOAT.equals(type)) {
    return DesignChoiceConstants.COLUMN_DATA_TYPE_FLOAT.equals(columnHandle.getDataType());
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_INTEGER.equals(type)) {
    return DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER.equals(columnHandle.getDataType());
  }
  return false;
}

Fixed version (ground truth):
private boolean matchDataType(ScalarParameterHandle handle,ResultSetColumnHandle columnHandle){
  String type=handle.getDataType();
  if (handle == selectedParameter && dataTypeChooser.isEnabled()) {
    type=getSelectedDataType();
  }
  if (DesignChoiceConstants.PARAM_TYPE_STRING.equals(type) || DesignChoiceConstants.COLUMN_DATA_TYPE_ANY.equals(columnHandle.getDataType())) {
    return true;
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_BOOLEAN.equals(type)) {
    return DesignChoiceConstants.COLUMN_DATA_TYPE_BOOLEAN.equals(columnHandle.getDataType());
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equals(type)) {
    return DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME.equals(columnHandle.getDataType());
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals(type)) {
    return DesignChoiceConstants.COLUMN_DATA_TYPE_DECIMAL.equals(columnHandle.getDataType());
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_FLOAT.equals(type)) {
    return DesignChoiceConstants.COLUMN_DATA_TYPE_FLOAT.equals(columnHandle.getDataType());
  }
 else   if (DesignChoiceConstants.PARAM_TYPE_INTEGER.equals(type)) {
    return DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER.equals(columnHandle.getDataType());
  }
  return false;
}
Program: 76436
Project: 76436
Buggy source:
/** 
 * Create a parameter hint based on Parameter definition and value
 * @param paramDefn
 * @param evaValue
 */
private ParameterHint createParameterHint(IParameterDefinition paramDefn,Object paramValue) throws DataException {
  ParameterHint parameterHint=new ParameterHint(paramDefn.getName(),paramDefn.isInputMode(),paramDefn.isOutputMode());
  if (paramDefn.getPosition() > 0)   parameterHint.setPosition(paramDefn.getPosition());
  Class dataTypeClass=DataType.getClass(paramDefn.getType());
  if (dataTypeClass == DataType.AnyType.class || dataTypeClass == Boolean.class || dataTypeClass == Blob.class) {
    dataTypeClass=String.class;
  }
  parameterHint.setDataType(dataTypeClass);
  parameterHint.setNativeDataType(paramDefn.getNativeType());
  parameterHint.setIsInputOptional(paramDefn.isInputOptional());
  if (parameterHint.isInputMode())   parameterHint.setDefaultInputValue(getParameterValueString(dataTypeClass,paramValue));
  parameterHint.setIsNullable(paramDefn.isNullable());
  return parameterHint;
}

Fixed version (ground truth):
/** 
 * Create a parameter hint based on Parameter definition and value
 * @param paramDefn
 * @param evaValue
 */
private ParameterHint createParameterHint(IParameterDefinition paramDefn,Object paramValue) throws DataException {
  ParameterHint parameterHint=new ParameterHint(paramDefn.getName(),paramDefn.isInputMode(),paramDefn.isOutputMode());
  if (paramDefn.getPosition() > 0)   parameterHint.setPosition(paramDefn.getPosition());
  Class dataTypeClass=DataType.getClass(paramDefn.getType());
  if (dataTypeClass == DataType.AnyType.class || dataTypeClass == Blob.class) {
    dataTypeClass=String.class;
  }
  parameterHint.setDataType(dataTypeClass);
  parameterHint.setNativeDataType(paramDefn.getNativeType());
  parameterHint.setIsInputOptional(paramDefn.isInputOptional());
  if (parameterHint.isInputMode())   parameterHint.setDefaultInputValue(getParameterValueString(dataTypeClass,paramValue));
  parameterHint.setIsNullable(paramDefn.isNullable());
  return parameterHint;
}
Program: 76437
Project: 76437
Buggy source:
/** 
 * Map oda data type to model data type.
 * @param modelDataType
 * @return
 */
private static String toModelDataType(int modelDataType){
  if (modelDataType == DataType.INTEGER_TYPE)   return DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER;
 else   if (modelDataType == DataType.STRING_TYPE)   return DesignChoiceConstants.COLUMN_DATA_TYPE_STRING;
 else   if (modelDataType == DataType.DATE_TYPE)   return DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME;
 else   if (modelDataType == DataType.DECIMAL_TYPE)   return DesignChoiceConstants.COLUMN_DATA_TYPE_DECIMAL;
 else   if (modelDataType == DataType.DOUBLE_TYPE)   return DesignChoiceConstants.COLUMN_DATA_TYPE_FLOAT;
  return DesignChoiceConstants.COLUMN_DATA_TYPE_ANY;
}

Fixed version (ground truth):
/** 
 * Map oda data type to model data type.
 * @param modelDataType
 * @return
 */
private static String toModelDataType(int modelDataType){
  if (modelDataType == DataType.INTEGER_TYPE)   return DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER;
 else   if (modelDataType == DataType.STRING_TYPE)   return DesignChoiceConstants.COLUMN_DATA_TYPE_STRING;
 else   if (modelDataType == DataType.DATE_TYPE)   return DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME;
 else   if (modelDataType == DataType.DECIMAL_TYPE)   return DesignChoiceConstants.COLUMN_DATA_TYPE_DECIMAL;
 else   if (modelDataType == DataType.DOUBLE_TYPE)   return DesignChoiceConstants.COLUMN_DATA_TYPE_FLOAT;
 else   if (modelDataType == DataType.BOOLEAN_TYPE)   return DesignChoiceConstants.COLUMN_DATA_TYPE_BOOLEAN;
  return DesignChoiceConstants.COLUMN_DATA_TYPE_ANY;
}
Program: 76438
Project: 76438
Buggy source:
/** 
 * Adapts a Model data type (string) to Data Engine data type constant (integer) on column
 */
public static int adaptModelDataType(String modelDataType){
  if (modelDataType == null)   return DataType.UNKNOWN_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_ANY))   return DataType.ANY_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER))   return DataType.INTEGER_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_STRING))   return DataType.STRING_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME))   return DataType.DATE_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_DECIMAL))   return DataType.DECIMAL_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_FLOAT))   return DataType.DOUBLE_TYPE;
  return DataType.UNKNOWN_TYPE;
}

Fixed version (ground truth):
/** 
 * Adapts a Model data type (string) to Data Engine data type constant (integer) on column
 */
public static int adaptModelDataType(String modelDataType){
  if (modelDataType == null)   return DataType.UNKNOWN_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_ANY))   return DataType.ANY_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER))   return DataType.INTEGER_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_STRING))   return DataType.STRING_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME))   return DataType.DATE_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_DECIMAL))   return DataType.DECIMAL_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_FLOAT))   return DataType.DOUBLE_TYPE;
  if (modelDataType.equals(DesignChoiceConstants.COLUMN_DATA_TYPE_BOOLEAN))   return DataType.BOOLEAN_TYPE;
  return DataType.UNKNOWN_TYPE;
}
Program: 76441
Project: 76441
Buggy source:
public boolean hasChildren(Object element){
  if (element instanceof Object[]) {
    return ((Object[])element).length > 0;
  }
  if (element instanceof DimensionHandle) {
    return true;
  }
  if (element instanceof LevelHandle) {
    HierarchyHandle hierarchy=(HierarchyHandle)((LevelHandle)element).getContainer();
    int pos=((LevelHandle)element).getIndex();
    return hierarchy.getLevel(pos + 1) != null;
  }
  if (element instanceof MeasureGroupHandle) {
    return true;
  }
  if (element instanceof CubeHandle) {
    return true;
  }
  if (element instanceof CubeModel) {
    CubeModel model=(CubeModel)element;
    if (model.getType() == CubeModel.TYPE_DIMENSION) {
      List dimensionList=model.getModel().getContents(CubeHandle.DIMENSIONS_PROP);
      if (dimensionList != null && dimensionList.size() > 0)       return true;
    }
 else     if (model.getType() == CubeModel.TYPE_MEASURES) {
      List measureList=model.getModel().getContents(CubeHandle.MEASURE_GROUPS_PROP);
      if (measureList != null && measureList.size() > 0)       return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean hasChildren(Object element){
  if (element instanceof Object[]) {
    return ((Object[])element).length > 0;
  }
  if (element instanceof DimensionHandle) {
    return true;
  }
  if (element instanceof LevelHandle) {
    HierarchyHandle hierarchy=(HierarchyHandle)((LevelHandle)element).getContainer();
    int pos=((LevelHandle)element).getIndex();
    return hierarchy.getLevel(pos + 1) != null;
  }
  if (element instanceof MeasureGroupHandle) {
    return true;
  }
  if (element instanceof CubeHandle) {
    return true;
  }
  if (element instanceof CubeModel) {
    CubeModel model=(CubeModel)element;
    if (model.getType() == CubeModel.TYPE_DIMENSION) {
      List dimensionList=model.getModel().getContents(CubeHandle.DIMENSIONS_PROP);
      if (dimensionList == null || dimensionList.size() == 0) {
        TabularDimensionHandle dimension=DesignElementFactory.getInstance().newTabularDimension("String_Node_Str");
        try {
          model.getModel().add(CubeHandle.DIMENSIONS_PROP,dimension);
        }
 catch (        SemanticException e) {
          ExceptionHandler.handle(e);
        }
      }
      return dimensionList != null && dimensionList.size() > 0;
    }
 else     if (model.getType() == CubeModel.TYPE_MEASURES) {
      List measureList=model.getModel().getContents(CubeHandle.MEASURE_GROUPS_PROP);
      if (measureList == null || measureList.size() == 0) {
        TabularMeasureGroupHandle measureGroup=DesignElementFactory.getInstance().newTabularMeasureGroup("String_Node_Str");
        try {
          model.getModel().add(CubeHandle.MEASURE_GROUPS_PROP,measureGroup);
        }
 catch (        SemanticException e) {
          ExceptionHandler.handle(e);
        }
      }
      return measureList != null && measureList.size() > 0;
    }
  }
  return false;
}
Program: 76442
Project: 76442
Buggy source:
/** 
 * Checks whether the data type needs quote.
 * @param romDataType the ROM defined data type
 * @return <code>true</code> if data type is string. Otherwise<code>false</code>.
 */
static boolean needsQuoteDelimiters(String romDataType){
  boolean needs=false;
  if (DesignChoiceConstants.PARAM_TYPE_STRING.equals(romDataType))   needs=true;
 else   if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equals(romDataType))   needs=true;
 else   if (DesignChoiceConstants.PARAM_TYPE_ANY.equals(romDataType))   needs=true;
  return needs;
}

Fixed version (ground truth):
/** 
 * Checks whether the data type needs quote.
 * @param romDataType the ROM defined data type
 * @return <code>true</code> if data type is string. Otherwise<code>false</code>.
 */
static boolean needsQuoteDelimiters(String romDataType){
  boolean needs=false;
  if (DesignChoiceConstants.PARAM_TYPE_STRING.equals(romDataType))   needs=true;
 else   if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equals(romDataType))   needs=true;
 else   if (DesignChoiceConstants.PARAM_TYPE_DATE.equals(romDataType))   needs=true;
 else   if (DesignChoiceConstants.PARAM_TYPE_TIME.equals(romDataType))   needs=true;
 else   if (DesignChoiceConstants.PARAM_TYPE_ANY.equals(romDataType))   needs=true;
  return needs;
}
Program: 76445
Project: 76445
Buggy source:
/** 
 * Sets properties on scalar parameters.
 * @throws Exception
 */
public void testSetsPropertiesOnParameter() throws Exception {
  SlotHandle params=designHandle.getParameters();
  ScalarParameterHandle handle=(ScalarParameterHandle)params.get(0);
  assertFalse(handle.isHidden());
  handle.setHidden(true);
  assertTrue(handle.isHidden());
  handle.setDataType(DesignChoiceConstants.PARAM_TYPE_DATETIME);
  assertEquals(DesignChoiceConstants.PARAM_TYPE_DATETIME,handle.getDataType());
  handle.setDataType(DesignChoiceConstants.PARAM_TYPE_FLOAT);
  assertEquals(DesignChoiceConstants.PARAM_TYPE_FLOAT,handle.getDataType());
  handle.setConcealValue(true);
  assertTrue(handle.isConcealValue());
  handle.setDefaultValue("String_Node_Str");
  assertEquals("String_Node_Str",handle.getDefaultValue());
  handle.setIsRequired(false);
  assertFalse(handle.isRequired());
  handle.setPattern("String_Node_Str");
  assertEquals("String_Node_Str",handle.getPattern());
  handle.setControlType(DesignChoiceConstants.PARAM_CONTROL_RADIO_BUTTON);
  assertEquals(DesignChoiceConstants.PARAM_CONTROL_RADIO_BUTTON,handle.getControlType());
  handle.setAlignment(DesignChoiceConstants.SCALAR_PARAM_ALIGN_RIGHT);
  assertEquals(DesignChoiceConstants.SCALAR_PARAM_ALIGN_RIGHT,handle.getAlignment());
}

Fixed version (ground truth):
/** 
 * Sets properties on scalar parameters.
 * @throws Exception
 */
public void testSetsPropertiesOnParameter() throws Exception {
  SlotHandle params=designHandle.getParameters();
  ScalarParameterHandle handle=(ScalarParameterHandle)params.get(0);
  assertFalse(handle.isHidden());
  handle.setHidden(true);
  assertTrue(handle.isHidden());
  handle.setDataType(DesignChoiceConstants.PARAM_TYPE_DATETIME);
  assertEquals(DesignChoiceConstants.PARAM_TYPE_DATETIME,handle.getDataType());
  handle.setDataType(DesignChoiceConstants.PARAM_TYPE_DATE);
  assertEquals(DesignChoiceConstants.PARAM_TYPE_DATE,handle.getDataType());
  handle.setDataType(DesignChoiceConstants.PARAM_TYPE_TIME);
  assertEquals(DesignChoiceConstants.PARAM_TYPE_TIME,handle.getDataType());
  handle.setDataType(DesignChoiceConstants.PARAM_TYPE_FLOAT);
  assertEquals(DesignChoiceConstants.PARAM_TYPE_FLOAT,handle.getDataType());
  handle.setConcealValue(true);
  assertTrue(handle.isConcealValue());
  handle.setDefaultValue("String_Node_Str");
  assertEquals("String_Node_Str",handle.getDefaultValue());
  handle.setIsRequired(false);
  assertFalse(handle.isRequired());
  handle.setPattern("String_Node_Str");
  assertEquals("String_Node_Str",handle.getPattern());
  handle.setControlType(DesignChoiceConstants.PARAM_CONTROL_RADIO_BUTTON);
  assertEquals(DesignChoiceConstants.PARAM_CONTROL_RADIO_BUTTON,handle.getControlType());
  handle.setAlignment(DesignChoiceConstants.SCALAR_PARAM_ALIGN_RIGHT);
  assertEquals(DesignChoiceConstants.SCALAR_PARAM_ALIGN_RIGHT,handle.getAlignment());
}
Program: 76446
Project: 76446
Buggy source:
private List doQueryCascadeParameterSelectionList(String paramName,IViewerReportDesignHandle design,String groupName,Object[] groupKeys,InputOptions options,ViewerAttributeBean attrBean) throws RemoteException, ReportServiceException {
  List selectionList=new ArrayList();
  Collection list=getReportService().getSelectionListForCascadingGroup(design,groupName,groupKeys,options);
  if (list != null && list.size() > 0) {
    ParameterDefinition parameter=attrBean.findParameterDefinition(paramName);
    Iterator iList=list.iterator();
    int index=0;
    while (iList != null && iList.hasNext()) {
      ParameterSelectionChoice item=(ParameterSelectionChoice)iList.next();
      if (item == null)       continue;
      Object value=item.getValue();
      if (value == null)       continue;
      try {
        value=DataUtil.convert(value,parameter.getDataType());
      }
 catch (      Exception e) {
      }
      String displayValue=DataUtil.getDisplayValue(value);
      if (displayValue == null)       continue;
      String label=item.getLabel();
      if (label == null || label.length() <= 0) {
        label=ParameterValidationUtil.getDisplayValue(null,parameter.getPattern(),value,attrBean.getLocale());
      }
      if (label != null) {
        SelectItemChoice selectItemChoice=new SelectItemChoice();
        selectItemChoice.setLabel(label);
        selectItemChoice.setValue(displayValue);
        selectionList.add(index++,selectItemChoice);
      }
    }
  }
  return selectionList;
}

Fixed version (ground truth):
private List doQueryCascadeParameterSelectionList(String paramName,IViewerReportDesignHandle design,String groupName,Object[] groupKeys,InputOptions options,ViewerAttributeBean attrBean) throws RemoteException, ReportServiceException {
  List selectionList=new ArrayList();
  Collection list=getReportService().getSelectionListForCascadingGroup(design,groupName,groupKeys,options);
  if (list != null && list.size() > 0) {
    ParameterDefinition parameter=attrBean.findParameterDefinition(paramName);
    Iterator iList=list.iterator();
    int index=0;
    while (iList != null && iList.hasNext()) {
      ParameterSelectionChoice item=(ParameterSelectionChoice)iList.next();
      if (item == null)       continue;
      Object value=item.getValue();
      try {
        value=DataUtil.convert(value,parameter.getDataType());
      }
 catch (      Exception e) {
        value=null;
      }
      String displayValue=DataUtil.getDisplayValue(value);
      if (displayValue == null)       continue;
      String label=item.getLabel();
      if (label == null || label.length() <= 0) {
        label=ParameterValidationUtil.getDisplayValue(null,parameter.getPattern(),value,attrBean.getLocale());
      }
      if (label != null) {
        SelectItemChoice selectItemChoice=new SelectItemChoice();
        selectItemChoice.setLabel(label);
        selectItemChoice.setValue(displayValue);
        selectionList.add(index++,selectItemChoice);
      }
    }
  }
  return selectionList;
}
Program: 76447
Project: 76447
Buggy source:
/** 
 * Removes a dimension view in the given position. Index is 0-based integer.
 * @param index the position index of the dimension to remove, 0-based integer
 * @throws SemanticException
 */
public void removeDimension(int index) throws SemanticException {
  DimensionViewHandle dimensionView=getDimension(index);
  if (dimensionView == null) {
    logger.log(Level.SEVERE,MessageConstants.CROSSTAB_EXCEPTION_DIMENSION_NOT_FOUND,String.valueOf(index));
    return;
  }
  CommandStack stack=getCommandStack();
  stack.startTrans(null);
  try {
    CrosstabReportItemHandle crosstab=getCrosstab();
    if (crosstab != null) {
      for (int i=0; i < dimensionView.getLevelCount(); i++) {
        LevelViewHandle levelView=dimensionView.getLevel(i);
        CrosstabUtil.adjustForLevelView(crosstab,levelView,dimensionView.getCubeDimensionName(),levelView.getCubeLevelName(),getAxisType(),false);
      }
    }
    dimensionView.handle.drop();
  }
 catch (  SemanticException e) {
    stack.rollback();
    throw e;
  }
  stack.commit();
}

Fixed version (ground truth):
/** 
 * Removes a dimension view in the given position. Index is 0-based integer.
 * @param index the position index of the dimension to remove, 0-based integer
 * @throws SemanticException
 */
public void removeDimension(int index) throws SemanticException {
  DimensionViewHandle dimensionView=getDimension(index);
  if (dimensionView == null) {
    logger.log(Level.SEVERE,MessageConstants.CROSSTAB_EXCEPTION_DIMENSION_NOT_FOUND,String.valueOf(index));
    return;
  }
  CommandStack stack=getCommandStack();
  stack.startTrans(null);
  try {
    CrosstabReportItemHandle crosstab=getCrosstab();
    if (crosstab != null) {
      for (int i=0; i < dimensionView.getLevelCount(); i++) {
        LevelViewHandle levelView=dimensionView.getLevel(i);
        CrosstabModelUtil.adjustForLevelView(dimensionView,levelView,false);
      }
    }
    dimensionView.handle.drop();
  }
 catch (  SemanticException e) {
    stack.rollback();
    throw e;
  }
  stack.commit();
}
Program: 76448
Project: 76448
Buggy source:
/** 
 * Adds a row/column grand total to the crosstab if it is empty. The axis type can be either <code>ICrosstabConstants.ROW_AXIS_TYPE</code> or <code>ICrosstabConstants.COLUMN_AXIS_TYPE</code>.
 * @param axisType row/column axis type
 * @return the grand total of this crosstab view
 */
public CrosstabCellHandle addGrandTotal(){
  PropertyHandle propHandle=getGrandTotalProperty();
  if (propHandle.getContentCount() > 0)   return getGrandTotal();
  CommandStack stack=getCommandStack();
  try {
    stack.startTrans(null);
    ExtendedItemHandle grandTotal=CrosstabExtendedItemFactory.createCrosstabCell(moduleHandle);
    propHandle.add(grandTotal);
    CrosstabReportItemHandle crosstab=getCrosstab();
    if (crosstab != null) {
      CrosstabUtil.adjustMeasureAggregations(crosstab,getAxisType(),null,null,null,false,true);
    }
    stack.commit();
    return (CrosstabCellHandle)CrosstabUtil.getReportItem(grandTotal);
  }
 catch (  SemanticException e) {
    logger.log(Level.INFO,e.getMessage(),e);
    stack.rollback();
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Adds a row/column grand total to the crosstab if it is empty. The axis type can be either <code>ICrosstabConstants.ROW_AXIS_TYPE</code> or <code>ICrosstabConstants.COLUMN_AXIS_TYPE</code>.
 * @param axisType row/column axis type
 * @return the grand total of this crosstab view
 */
public CrosstabCellHandle addGrandTotal(){
  PropertyHandle propHandle=getGrandTotalProperty();
  if (propHandle.getContentCount() > 0)   return getGrandTotal();
  CommandStack stack=getCommandStack();
  try {
    stack.startTrans(null);
    ExtendedItemHandle grandTotal=CrosstabExtendedItemFactory.createCrosstabCell(moduleHandle);
    propHandle.add(grandTotal);
    CrosstabReportItemHandle crosstab=getCrosstab();
    if (crosstab != null) {
      CrosstabModelUtil.adjustMeasureAggregations(crosstab,getAxisType(),true);
    }
    stack.commit();
    return (CrosstabCellHandle)CrosstabUtil.getReportItem(grandTotal);
  }
 catch (  SemanticException e) {
    logger.log(Level.INFO,e.getMessage(),e);
    stack.rollback();
    return null;
  }
}
Program: 76449
Project: 76449
Buggy source:
/** 
 * Removes grand total from crosstab if it is not empty, otherwise do nothing.
 */
public void removeGrandTotal(){
  PropertyHandle propHandle=getGrandTotalProperty();
  if (propHandle.getContentCount() > 0) {
    CommandStack stack=getCommandStack();
    stack.startTrans(null);
    try {
      CrosstabReportItemHandle crosstab=getCrosstab();
      if (crosstab != null) {
        CrosstabUtil.adjustMeasureAggregations(crosstab,getAxisType(),null,null,null,false,false);
      }
      propHandle.drop(0);
    }
 catch (    SemanticException e) {
      logger.log(Level.INFO,e.getMessage(),e);
      stack.rollback();
    }
    stack.commit();
  }
}

Fixed version (ground truth):
/** 
 * Removes grand total from crosstab if it is not empty, otherwise do nothing.
 */
public void removeGrandTotal(){
  PropertyHandle propHandle=getGrandTotalProperty();
  if (propHandle.getContentCount() > 0) {
    CommandStack stack=getCommandStack();
    stack.startTrans(null);
    try {
      CrosstabReportItemHandle crosstab=getCrosstab();
      if (crosstab != null) {
        CrosstabModelUtil.adjustMeasureAggregations(crosstab,getAxisType(),false);
      }
      propHandle.drop(0);
    }
 catch (    SemanticException e) {
      logger.log(Level.INFO,e.getMessage(),e);
      stack.rollback();
    }
    stack.commit();
  }
}
Program: 76451
Project: 76451
Buggy source:
/** 
 * Removes a level view at the given position. The position index is 0-based integer.
 * @param index the position index of the level view to remove
 * @throws SemanticException
 */
public void removeLevel(int index) throws SemanticException {
  LevelViewHandle levelView=getLevel(index);
  if (levelView != null) {
    CommandStack stack=getCommandStack();
    stack.startTrans(null);
    try {
      CrosstabReportItemHandle crosstab=getCrosstab();
      if (crosstab != null) {
        CrosstabUtil.adjustForLevelView(crosstab,levelView,getCubeDimensionName(),levelView.getCubeLevelName(),getAxisType(),false);
      }
      levelView.handle.drop();
    }
 catch (    SemanticException e) {
      stack.rollback();
      throw e;
    }
    stack.commit();
  }
}

Fixed version (ground truth):
/** 
 * Removes a level view at the given position. The position index is 0-based integer.
 * @param index the position index of the level view to remove
 * @throws SemanticException
 */
public void removeLevel(int index) throws SemanticException {
  LevelViewHandle levelView=getLevel(index);
  if (levelView != null) {
    CommandStack stack=getCommandStack();
    stack.startTrans(null);
    try {
      CrosstabReportItemHandle crosstab=getCrosstab();
      if (crosstab != null) {
        CrosstabModelUtil.adjustForLevelView(this,levelView,false);
      }
      levelView.handle.drop();
    }
 catch (    SemanticException e) {
      stack.rollback();
      throw e;
    }
    stack.commit();
  }
}
Program: 76452
Project: 76452
Buggy source:
/** 
 * Removes the aggregation header cell if it is not empty, otherwise do nothing.
 */
public void removeAggregationHeader(){
  if (getAggregationHeaderProperty().getContentCount() > 0) {
    CommandStack stack=getCommandStack();
    stack.startTrans(null);
    try {
      CrosstabReportItemHandle crosstab=getCrosstab();
      if (crosstab != null) {
        CrosstabUtil.adjustMeasureAggregations(crosstab,getAxisType(),this,((DimensionViewHandle)getContainer()).getCubeDimensionName(),getCubeLevelName(),isInnerMost(),false);
      }
      getAggregationHeaderProperty().drop(0);
    }
 catch (    SemanticException e) {
      logger.log(Level.WARNING,e.getMessage(),e);
      stack.rollback();
    }
    stack.commit();
  }
}

Fixed version (ground truth):
/** 
 * Removes the aggregation header cell if it is not empty, otherwise do nothing.
 */
public void removeAggregationHeader(){
  if (getAggregationHeaderProperty().getContentCount() > 0) {
    CommandStack stack=getCommandStack();
    stack.startTrans(null);
    try {
      CrosstabReportItemHandle crosstab=getCrosstab();
      if (crosstab != null) {
        CrosstabModelUtil.adjustMeasureAggregations(crosstab,this,false);
      }
      getAggregationHeaderProperty().drop(0);
    }
 catch (    SemanticException e) {
      logger.log(Level.WARNING,e.getMessage(),e);
      stack.rollback();
    }
    stack.commit();
  }
}
Program: 76453
Project: 76453
Buggy source:
/** 
 * Adds a aggregation header to the level if it is empty.
 */
public void addAggregationHeader(){
  if (getAggregationHeaderProperty().getContentCount() != 0) {
    logger.log(Level.INFO,"String_Node_Str");
    return;
  }
  if (isInnerMost()) {
    logger.log(Level.WARNING,"String_Node_Str" + handle.getName() + "String_Node_Str");
    return;
  }
  CommandStack stack=getCommandStack();
  stack.startTrans(null);
  try {
    getAggregationHeaderProperty().add(CrosstabExtendedItemFactory.createCrosstabCell(moduleHandle));
    CrosstabReportItemHandle crosstab=getCrosstab();
    if (crosstab != null) {
      CrosstabUtil.adjustMeasureAggregations(crosstab,getAxisType(),this,((DimensionViewHandle)getContainer()).getCubeDimensionName(),getCubeLevelName(),false,true);
    }
  }
 catch (  SemanticException e) {
    logger.log(Level.WARNING,e.getMessage(),e);
    stack.rollback();
  }
  stack.commit();
}

Fixed version (ground truth):
/** 
 * Adds a aggregation header to the level if it is empty.
 */
public void addAggregationHeader(){
  if (getAggregationHeaderProperty().getContentCount() != 0) {
    logger.log(Level.INFO,"String_Node_Str");
    return;
  }
  if (isInnerMost()) {
    logger.log(Level.WARNING,"String_Node_Str" + handle.getName() + "String_Node_Str");
    return;
  }
  CommandStack stack=getCommandStack();
  stack.startTrans(null);
  try {
    getAggregationHeaderProperty().add(CrosstabExtendedItemFactory.createCrosstabCell(moduleHandle));
    CrosstabReportItemHandle crosstab=getCrosstab();
    if (crosstab != null) {
      CrosstabModelUtil.adjustMeasureAggregations(crosstab,this,true);
    }
  }
 catch (  SemanticException e) {
    logger.log(Level.WARNING,e.getMessage(),e);
    stack.rollback();
  }
  stack.commit();
}
Program: 76454
Project: 76454
Buggy source:
public void cancel(Object signal){
  if (signal == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  cancelFlag=true;
  long waitingTime=0;
  do {
    waitingTime+=100;
    try {
      Thread.sleep(100);
    }
 catch (    Exception ex) {
    }
    if (runningStatus != RUNNING_STATUS_RUNNING) {
      return;
    }
  }
 while (waitingTime < 5000);
  return;
}

Fixed version (ground truth):
public void cancel(Object signal){
  if (signal == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  cancelFlag=true;
  long waitingTime=0;
  do {
    waitingTime+=100;
    try {
      Thread.sleep(100);
    }
 catch (    Exception ex) {
    }
    if (runningStatus != STATUS_RUNNING) {
      return;
    }
  }
 while (waitingTime < 5000);
  return;
}
Program: 76455
Project: 76455
Buggy source:
public int getStatus(){
}

Fixed version (ground truth):
public int getStatus(){
  return runningStatus;
}
Program: 76456
Project: 76456
Buggy source:
public void setErrorHandlingOption(int option){
  if (option == CANCEL_ON_ERROR) {
    this.errorHandlingOption=CANCEL_ON_ERROR;
    executionContext.setCancelOnError(true);
  }
 else {
    this.errorHandlingOption=CONTINUE_ON_ERROR;
    executionContext.setCancelOnError(false);
  }
}

Fixed version (ground truth):
public void setErrorHandlingOption(int option){
  if (option == CANCEL_ON_ERROR) {
    executionContext.setCancelOnError(true);
  }
 else {
    executionContext.setCancelOnError(false);
  }
}
Program: 76457
Project: 76457
Buggy source:
public void run() throws EngineException {
  try {
    runningStatus=RUNNING_STATUS_RUNNING;
    doRun();
  }
  finally {
    runningStatus=RUNNING_STATUS_STOP;
  }
}

Fixed version (ground truth):
public void run() throws EngineException {
  try {
    changeStatusToRunning();
    doRun();
  }
  finally {
    changeStatusToStopped();
  }
}
Program: 76458
Project: 76458
Buggy source:
/** 
 * @deprecated
 */
public void run(FolderArchive fArchive) throws EngineException {
  try {
    runningStatus=RUNNING_STATUS_RUNNING;
    setDataSource(fArchive);
    run((IDocArchiveWriter)fArchive);
  }
  finally {
    runningStatus=RUNNING_STATUS_STOP;
  }
}

Fixed version (ground truth):
/** 
 * @deprecated
 */
public void run(FolderArchive fArchive) throws EngineException {
  try {
    changeStatusToRunning();
    setDataSource(fArchive);
    run((IDocArchiveWriter)fArchive);
  }
  finally {
    changeStatusToStopped();
  }
}
Program: 76459
Project: 76459
Buggy source:
public String getStyleClass(){
  if (styleClass != null) {
    return styleClass;
  }
  if (generateBy instanceof ReportItemDesign) {
    return ((ReportItemDesign)generateBy).getStyleName();
  }
  return null;
}

Fixed version (ground truth):
public String getStyleClass(){
  if (styleClass != null) {
    return styleClass;
  }
  if (generateBy instanceof StyledElementDesign) {
    return ((StyledElementDesign)generateBy).getStyleName();
  }
  return null;
}
Program: 76461
Project: 76461
Buggy source:
/** 
 * Test CssSharedStyleHandle is readonly.
 * @throws Exception
 */
public void testReadOnlyCssStyleHandle() throws Exception {
  openDesign("String_Node_Str");
  designHandle.addCss("String_Node_Str");
  List styles=designHandle.getAllStyles();
  SharedStyleHandle styleHandle=(SharedStyleHandle)styles.get(0);
  try {
    styleHandle.setFontStyle(DesignChoiceConstants.FONT_STYLE_ITALIC);
    fail();
  }
 catch (  IllegalOperationException e) {
    assertEquals(CssException.DESIGN_EXCEPTION_READONLY,e.getMessage());
  }
  HighlightRule highlightRule=StructureFactory.createHighlightRule();
  PropertyHandle propHandle=styleHandle.getPropertyHandle(IStyleModel.HIGHLIGHT_RULES_PROP);
  try {
    propHandle.addItem(highlightRule);
    fail();
  }
 catch (  IllegalOperationException e) {
    assertEquals(CssException.DESIGN_EXCEPTION_READONLY,e.getMessage());
  }
  DimensionHandle fontSize=styleHandle.getFontSize();
  try {
    fontSize.setStringValue("String_Node_Str");
    fail();
  }
 catch (  IllegalOperationException e) {
    assertEquals(CssException.DESIGN_EXCEPTION_READONLY,e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Test CssSharedStyleHandle is readonly.
 * @throws Exception
 */
public void testReadOnlyCssStyleHandle() throws Exception {
  openDesign("String_Node_Str");
  CssStyleSheetHandle sheetHandle=designHandle.openCssStyleSheet(getResource("String_Node_Str").getFile());
  designHandle.addCss(sheetHandle);
  List styles=designHandle.getAllStyles();
  SharedStyleHandle styleHandle=(SharedStyleHandle)styles.get(0);
  try {
    styleHandle.setFontStyle(DesignChoiceConstants.FONT_STYLE_ITALIC);
    fail();
  }
 catch (  IllegalOperationException e) {
    assertEquals(CssException.DESIGN_EXCEPTION_READONLY,e.getMessage());
  }
  HighlightRule highlightRule=StructureFactory.createHighlightRule();
  PropertyHandle propHandle=styleHandle.getPropertyHandle(IStyleModel.HIGHLIGHT_RULES_PROP);
  try {
    propHandle.addItem(highlightRule);
    fail();
  }
 catch (  IllegalOperationException e) {
    assertEquals(CssException.DESIGN_EXCEPTION_READONLY,e.getMessage());
  }
  DimensionHandle fontSize=styleHandle.getFontSize();
  try {
    fontSize.setStringValue("String_Node_Str");
    fail();
  }
 catch (  IllegalOperationException e) {
    assertEquals(CssException.DESIGN_EXCEPTION_READONLY,e.getMessage());
  }
}
Program: 76462
Project: 76462
Buggy source:
/** 
 * Tests css style sheet.
 * @throws Exception
 */
public void testCssStyleSheet() throws Exception {
  openDesign("String_Node_Str");
  designHandle.addCss("String_Node_Str");
  List styles=designHandle.getAllStyles();
  assertEquals(5,styles.size());
  try {
    designHandle.addCss("String_Node_Str");
    fail();
  }
 catch (  CssException e) {
    assertEquals(CssException.DESIGN_EXCEPTION_DUPLICATE_CSS,e.getErrorCode());
  }
  LabelHandle labelHandle=designHandle.getElementFactory().newLabel("String_Node_Str");
  designHandle.getBody().add(labelHandle);
  labelHandle.setStyle((SharedStyleHandle)styles.get(0));
  IncludedCssStyleSheetHandle sheetHandle=(IncludedCssStyleSheetHandle)designHandle.includeCssesIterator().next();
  ElementRefValue value=(ElementRefValue)labelHandle.getElement().getLocalProperty(designHandle.getModule(),"String_Node_Str");
  assertTrue(value.isResolved());
  designHandle.dropCss(sheetHandle);
  assertFalse(value.isResolved());
  assertNull(designHandle.includeCssesIterator().next());
  assertNull(labelHandle.getStyle());
}

Fixed version (ground truth):
/** 
 * Tests css style sheet.
 * @throws Exception
 */
public void testCssStyleSheet() throws Exception {
  openDesign("String_Node_Str");
  assertTrue(designHandle.canAddCssStyleSheet(getResource("String_Node_Str").getFile()));
  CssStyleSheetHandle sheetHandle=designHandle.openCssStyleSheet(getResource("String_Node_Str").getFile());
  designHandle.addCss(sheetHandle);
  assertFalse(designHandle.canAddCssStyleSheet(getResource("String_Node_Str").getFile()));
  assertFalse(designHandle.canAddCssStyleSheet(sheetHandle));
  List styles=designHandle.getAllStyles();
  assertEquals(5,styles.size());
  try {
    designHandle.addCss(sheetHandle);
    fail();
  }
 catch (  CssException e) {
    assertEquals(CssException.DESIGN_EXCEPTION_DUPLICATE_CSS,e.getErrorCode());
  }
  LabelHandle labelHandle=designHandle.getElementFactory().newLabel("String_Node_Str");
  designHandle.getBody().add(labelHandle);
  labelHandle.setStyle((SharedStyleHandle)styles.get(0));
  assertTrue(designHandle.canDropCssStyleSheet(sheetHandle));
  ElementRefValue value=(ElementRefValue)labelHandle.getElement().getLocalProperty(designHandle.getModule(),"String_Node_Str");
  assertTrue(value.isResolved());
  designHandle.dropCss(sheetHandle);
  assertFalse(value.isResolved());
  assertNull(designHandle.includeCssesIterator().next());
  assertNull(labelHandle.getStyle());
  assertFalse(designHandle.canDropCssStyleSheet(sheetHandle));
  designHandle.addCss("String_Node_Str");
  styles=designHandle.getAllStyles();
  assertEquals(5,styles.size());
}
Program: 76463
Project: 76463
Buggy source:
public void elementChanged(DesignElementHandle focus,NotificationEvent ev){
  if (ev.getEventType() == NotificationEvent.CSS_EVENT) {
    CssEvent event=(CssEvent)ev;
    action=event.getAction();
    eventType=event.getEventType();
  }
 else   if (ev.getEventType() == NotificationEvent.CSS_RELOADED_EVENT) {
    CssReloadedEvent event=(CssReloadedEvent)ev;
    eventType=event.getEventType();
  }
}

Fixed version (ground truth):
public void elementChanged(DesignElementHandle focus,NotificationEvent ev){
  if (ev.getEventType() == NotificationEvent.CSS_EVENT) {
    CssEvent event=(CssEvent)ev;
    action=event.getAction();
    eventType=event.getEventType();
  }
 else   if (ev.getEventType() == NotificationEvent.CSS_RELOADED_EVENT) {
    CssReloadedEvent event=(CssReloadedEvent)ev;
    eventType=event.getEventType();
  }
  ++count;
}
Program: 76464
Project: 76464
Buggy source:
/** 
 * Test addCss method.
 * @throws Exception
 */
public void testAdd() throws Exception {
  openDesign("String_Node_Str");
  MyListener listener=new MyListener();
  designHandle.addListener(listener);
  designHandle.addCss("String_Node_Str");
  assertEquals(NotificationEvent.CSS_EVENT,listener.getEventType());
  assertEquals(CssEvent.ADD,listener.getAction());
  designHandle.dropCss((IncludedCssStyleSheetHandle)designHandle.includeCssesIterator().next());
  assertEquals(CssEvent.DROP,listener.getAction());
}

Fixed version (ground truth):
/** 
 * Test addCss method.
 * @throws Exception
 */
public void testAdd() throws Exception {
  openDesign("String_Node_Str");
  MyListener listener=new MyListener();
  designHandle.addListener(listener);
  CssStyleSheetHandle sheetHandle=designHandle.openCssStyleSheet("String_Node_Str");
  designHandle.addCss(sheetHandle);
  assertEquals(NotificationEvent.CSS_EVENT,listener.getEventType());
  assertEquals(CssEvent.ADD,listener.getAction());
  assertEquals(1,listener.getEventCount());
  listener.clearEventCount();
  sheetHandle=(CssStyleSheetHandle)designHandle.getAllCssStyleSheets().get(0);
  designHandle.reloadCss(sheetHandle);
  assertEquals(NotificationEvent.CSS_RELOADED_EVENT,listener.getEventType());
  assertEquals(1,listener.getEventCount());
  listener.clearEventCount();
  designHandle.dropCss(sheetHandle);
  assertEquals(CssEvent.DROP,listener.getAction());
  assertEquals(1,listener.getEventCount());
}
Program: 76467
Project: 76467
Buggy source:
/** 
 * convert a object to given class Classes supported: Integer.class BigDecimal.class Boolean.class Time.class Date.class Double.class String.class Blob.class
 * @param source
 * @param toTypeClass
 * @return
 * @throws BirtException
 */
public static Object convert(Object source,Class toTypeClass) throws BirtException {
  if (toTypeClass == DataType.getClass(DataType.ANY_TYPE))   return source;
  if (toTypeClass == Integer.class)   return toInteger(source);
  if (toTypeClass == BigDecimal.class)   return toBigDecimal(source);
  if (toTypeClass == Boolean.class)   return toBoolean(source);
  if (toTypeClass == Time.class)   return toTime(source);
  if (Date.class.isAssignableFrom(toTypeClass))   return toDate(source);
  if (toTypeClass == Double.class)   return toDouble(source);
  if (toTypeClass == String.class)   return toString(source);
  if (toTypeClass == Blob.class)   return toBlob(source);
  throw new CoreException(ResourceConstants.INVALID_TYPE,resourceBundle);
}

Fixed version (ground truth):
/** 
 * convert a object to given class Classes supported: Integer.class BigDecimal.class Boolean.class Time.class Date.class Double.class String.class Blob.class
 * @param source
 * @param toTypeClass
 * @return
 * @throws BirtException
 */
public static Object convert(Object source,Class toTypeClass) throws BirtException {
  if (toTypeClass == DataType.getClass(DataType.ANY_TYPE))   return source;
  if (toTypeClass == Integer.class)   return toInteger(source);
  if (toTypeClass == BigDecimal.class)   return toBigDecimal(source);
  if (toTypeClass == Boolean.class)   return toBoolean(source);
  if (toTypeClass == Time.class)   return toSqlTime(source);
  if (toTypeClass == java.sql.Date.class)   return toSqlDate(source);
  if (toTypeClass == Date.class)   return toDate(source);
  if (toTypeClass == Double.class)   return toDouble(source);
  if (toTypeClass == String.class)   return toString(source);
  if (toTypeClass == Blob.class)   return toBlob(source);
  throw new CoreException(ResourceConstants.INVALID_TYPE,resourceBundle);
}
Program: 76469
Project: 76469
Buggy source:
/** 
 * Test DataTypeUtil#toApiDataType( int odaDataTypeCode )
 * @throws BirtException
 */
public void testToApiFromOdaDataType() throws BirtException {
  assertEquals(DataType.STRING_TYPE,DataTypeUtil.toApiDataType(Types.CHAR));
  assertEquals(DataType.INTEGER_TYPE,DataTypeUtil.toApiDataType(Types.INTEGER));
  assertEquals(DataType.DOUBLE_TYPE,DataTypeUtil.toApiDataType(Types.DOUBLE));
  assertEquals(DataType.DECIMAL_TYPE,DataTypeUtil.toApiDataType(Types.DECIMAL));
  assertEquals(DataType.DATE_TYPE,DataTypeUtil.toApiDataType(Types.DATE));
  assertEquals(DataType.DATE_TYPE,DataTypeUtil.toApiDataType(Types.TIME));
  assertEquals(DataType.DATE_TYPE,DataTypeUtil.toApiDataType(Types.TIMESTAMP));
  assertEquals(DataType.BINARY_TYPE,DataTypeUtil.toApiDataType(Types.BLOB));
  assertEquals(DataType.STRING_TYPE,DataTypeUtil.toApiDataType(Types.CLOB));
  assertEquals(DataType.UNKNOWN_TYPE,DataTypeUtil.toApiDataType(Types.NULL));
  boolean hasException=false;
  try {
    DataTypeUtil.toApiDataType(Types.OTHER);
  }
 catch (  BirtException e) {
    hasException=true;
  }
  assertTrue(hasException);
}

Fixed version (ground truth):
/** 
 * Test DataTypeUtil#toApiDataType( int odaDataTypeCode )
 * @throws BirtException
 */
public void testToApiFromOdaDataType() throws BirtException {
  assertEquals(DataType.STRING_TYPE,DataTypeUtil.toApiDataType(Types.CHAR));
  assertEquals(DataType.INTEGER_TYPE,DataTypeUtil.toApiDataType(Types.INTEGER));
  assertEquals(DataType.DOUBLE_TYPE,DataTypeUtil.toApiDataType(Types.DOUBLE));
  assertEquals(DataType.DECIMAL_TYPE,DataTypeUtil.toApiDataType(Types.DECIMAL));
  assertEquals(DataType.SQL_DATE_TYPE,DataTypeUtil.toApiDataType(Types.DATE));
  assertEquals(DataType.SQL_TIME_TYPE,DataTypeUtil.toApiDataType(Types.TIME));
  assertEquals(DataType.DATE_TYPE,DataTypeUtil.toApiDataType(Types.TIMESTAMP));
  assertEquals(DataType.BINARY_TYPE,DataTypeUtil.toApiDataType(Types.BLOB));
  assertEquals(DataType.STRING_TYPE,DataTypeUtil.toApiDataType(Types.CLOB));
  assertEquals(DataType.UNKNOWN_TYPE,DataTypeUtil.toApiDataType(Types.NULL));
  boolean hasException=false;
  try {
    DataTypeUtil.toApiDataType(Types.OTHER);
  }
 catch (  BirtException e) {
    hasException=true;
  }
  assertTrue(hasException);
}
Program: 76470
Project: 76470
Buggy source:
/** 
 * convert a object to given class Classes supported: Integer.class BigDecimal.class Boolean.class Time.class Date.class Double.class String.class Blob.class
 * @param source
 * @param toTypeClass
 * @return
 * @throws BirtException
 */
public static Object convert(Object source,Class toTypeClass) throws BirtException {
  if (toTypeClass == DataType.getClass(DataType.ANY_TYPE))   return source;
  if (toTypeClass == Integer.class)   return toInteger(source);
  if (toTypeClass == BigDecimal.class)   return toBigDecimal(source);
  if (toTypeClass == Boolean.class)   return toBoolean(source);
  if (toTypeClass == Time.class)   return toSqlTime(source);
  if (toTypeClass == java.sql.Date.class)   return toSqlDate(source);
  if (toTypeClass == Date.class)   return toDate(source);
  if (toTypeClass == Double.class)   return toDouble(source);
  if (toTypeClass == String.class)   return toString(source);
  if (toTypeClass == Blob.class)   return toBlob(source);
  throw new CoreException(ResourceConstants.INVALID_TYPE,resourceBundle);
}

Fixed version (ground truth):
/** 
 * convert a object to given class Classes supported: Integer.class BigDecimal.class Boolean.class Time.class Date.class Double.class String.class Blob.class
 * @param source
 * @param toTypeClass
 * @return
 * @throws BirtException
 */
public static Object convert(Object source,Class toTypeClass) throws BirtException {
  if (toTypeClass == DataType.getClass(DataType.ANY_TYPE))   return source;
  if (toTypeClass == Integer.class)   return toInteger(source);
  if (toTypeClass == BigDecimal.class)   return toBigDecimal(source);
  if (toTypeClass == Boolean.class)   return toBoolean(source);
  if (toTypeClass == Time.class)   return toSqlTime(source);
  if (toTypeClass == java.sql.Date.class)   return toSqlDate(source);
  if (toTypeClass == java.sql.Timestamp.class)   return toDate(source);
  if (toTypeClass == Date.class)   return toDate(source);
  if (toTypeClass == Double.class)   return toDouble(source);
  if (toTypeClass == String.class)   return toString(source);
  if (toTypeClass == Blob.class)   return toBlob(source);
  throw new CoreException(ResourceConstants.INVALID_TYPE,resourceBundle);
}