nus-yam/ex-repair huggingface dataset:
Program: 126334
Project: 126334
Buggy source:
/** 
 * add field to Group Limit.
 * @param mainComposite
 * @param form
 * @param width
 * @param height
 */
private void addGroupLimit(final Composite mainComposite,final int width,final int height){
  Group group=Form.createGroup(mainComposite,2,Messages.getString("String_Node_Str"),height);
  group.setLayout(new FillLayout());
  GridData groupLayoutData=(GridData)group.getLayoutData();
  groupLayoutData.heightHint=-1;
  groupLayoutData.minimumHeight=-1;
  groupLayoutData.minimumWidth=-1;
  groupLayoutData.widthHint=-1;
  groupLayoutData.grabExcessVerticalSpace=false;
  Composite compositeLimit=Form.startNewDimensionnedGridLayout(group,3,width,height);
  compositeLimit.setLayoutData(null);
  Label info=new Label(compositeLimit,SWT.NONE);
  GridData gridData=new GridData();
  gridData.horizontalSpan=3;
  info.setLayoutData(gridData);
  info.setText(Messages.getString("String_Node_Str"));
  rowsToSkipLimitCheckboxCombo=new LabelledCheckboxCombo(compositeLimit,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
}

Fixed version (ground truth):
/** 
 * add field to Group Limit.
 * @param mainComposite
 * @param form
 * @param width
 * @param height
 */
private void addGroupLimit(final Composite mainComposite,final int width,final int height){
  Group group=Form.createGroup(mainComposite,2,Messages.getString("String_Node_Str"),SWT.DEFAULT);
  group.setLayout(new FillLayout());
  GridData groupLayoutData=(GridData)group.getLayoutData();
  groupLayoutData.minimumWidth=SWT.DEFAULT;
  groupLayoutData.widthHint=SWT.DEFAULT;
  groupLayoutData.grabExcessVerticalSpace=false;
  Composite compositeLimit=Form.startNewDimensionnedGridLayout(group,3,width,height);
  compositeLimit.setLayoutData(null);
  Label info=new Label(compositeLimit,SWT.NONE);
  GridData gridData=new GridData();
  gridData.horizontalSpan=3;
  info.setLayoutData(gridData);
  info.setText(Messages.getString("String_Node_Str"));
  rowsToSkipLimitCheckboxCombo=new LabelledCheckboxCombo(compositeLimit,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
}
Program: 126336
Project: 126336
Buggy source:
private void addGroupRowsToSkip(final Composite mainComposite,final int width,final int height){
  Group group=Form.createGroup(mainComposite,1,Messages.getString("String_Node_Str"),height);
  group.setLayout(new FillLayout());
  GridData groupLayoutData=(GridData)group.getLayoutData();
  groupLayoutData.heightHint=-1;
  groupLayoutData.minimumHeight=-1;
  groupLayoutData.minimumWidth=-1;
  groupLayoutData.widthHint=-1;
  groupLayoutData.grabExcessVerticalSpace=false;
  Composite compositeRowsToSkip=Form.startNewDimensionnedGridLayout(group,3,width - 100,height);
  compositeRowsToSkip.setLayoutData(null);
  Label info=new Label(compositeRowsToSkip,SWT.NONE);
  GridData gridData=new GridData();
  gridData.horizontalSpan=3;
  info.setLayoutData(gridData);
  info.setText(Messages.getString("String_Node_Str"));
  rowsToSkipHeaderCheckboxCombo=new LabelledCheckboxCombo(compositeRowsToSkip,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
  rowsToSkipFooterCheckboxCombo=new LabelledCheckboxCombo(compositeRowsToSkip,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
  emptyRowsToSkipCheckbox=new Button(compositeRowsToSkip,SWT.CHECK);
  emptyRowsToSkipCheckbox.setText(Messages.getString("String_Node_Str"));
  emptyRowsToSkipCheckbox.setAlignment(SWT.LEFT);
  gridData=new GridData(SWT.FILL,SWT.BOTTOM,true,false);
  gridData.horizontalSpan=3;
  emptyRowsToSkipCheckbox.setLayoutData(gridData);
}

Fixed version (ground truth):
private void addGroupRowsToSkip(final Composite mainComposite,final int width,final int height){
  Group group=Form.createGroup(mainComposite,1,Messages.getString("String_Node_Str"),SWT.DEFAULT);
  group.setLayout(new FillLayout());
  GridData groupLayoutData=(GridData)group.getLayoutData();
  groupLayoutData.minimumWidth=SWT.DEFAULT;
  groupLayoutData.widthHint=SWT.DEFAULT;
  groupLayoutData.grabExcessVerticalSpace=false;
  Composite compositeRowsToSkip=Form.startNewDimensionnedGridLayout(group,3,width - 100,height);
  compositeRowsToSkip.setLayoutData(null);
  Label info=new Label(compositeRowsToSkip,SWT.NONE);
  GridData gridData=new GridData();
  gridData.horizontalSpan=3;
  info.setLayoutData(gridData);
  info.setText(Messages.getString("String_Node_Str"));
  rowsToSkipHeaderCheckboxCombo=new LabelledCheckboxCombo(compositeRowsToSkip,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
  rowsToSkipFooterCheckboxCombo=new LabelledCheckboxCombo(compositeRowsToSkip,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),STRING_NUMBERS_DATA,1,true,SWT.NONE);
  emptyRowsToSkipCheckbox=new Button(compositeRowsToSkip,SWT.CHECK);
  emptyRowsToSkipCheckbox.setText(Messages.getString("String_Node_Str"));
  emptyRowsToSkipCheckbox.setAlignment(SWT.LEFT);
  gridData=new GridData(SWT.FILL,SWT.BOTTOM,true,false);
  gridData.horizontalSpan=3;
  emptyRowsToSkipCheckbox.setLayoutData(gridData);
}
Program: 126337
Project: 126337
Buggy source:
public static void process(Throwable ex,Priority priority){
  CommonExceptionHandler.process(ex,priority);
  if (priority == Level.FATAL) {
    ExceptionService service=CommonsPlugin.getDefault().getExceptionService();
    if (service != null) {
      service.showExceptionInMessgeBox(ex);
    }
  }
}

Fixed version (ground truth):
public static void process(Throwable ex,Priority priority){
  CommonExceptionHandler.process(ex,priority);
  if (priority == Level.FATAL && !CommonsPlugin.isHeadless()) {
    ExceptionService service=CommonsPlugin.getDefault().getExceptionService();
    if (service != null) {
      service.showExceptionInMessgeBox(ex);
    }
  }
}
Program: 126338
Project: 126338
Buggy source:
@Override protected void createColumns(TableViewerCreator<B> tableViewerCreator,Table table){
  tableViewerCreator.setReadOnly(false);
  TableViewerCreatorColumn column=new TableViewerCreatorColumn(tableViewerCreator);
  column.setTitle("String_Node_Str");
  column.setDefaultInternalValue("String_Node_Str");
  column.setWidth(15);
  if (isRepository) {
    configureUsefulColumn(tableViewerCreator);
  }
  configureNameColumn(tableViewerCreator);
  if (showDbColumnName) {
    configureDbColumnName(tableViewerCreator);
  }
  if (showKeyColumn) {
    configureKeyColumn(tableViewerCreator);
  }
  configureTypeColumns(tableViewerCreator);
  if (showNullableColumn) {
    configureNullableColumn(tableViewerCreator);
  }
  configurePatternColumn(tableViewerCreator);
  if (showLengthColumn) {
    configureLengthColumn(tableViewerCreator);
  }
  if (showOriginalLength) {
    configureOriginalLengthColumn(tableViewerCreator);
  }
  if (showAdditionalFieldColumn) {
    configureAdditionalFieldColumns(tableViewerCreator);
  }
  if (showPrecisionColumn) {
    configurePrecisionColumn(tableViewerCreator);
  }
  configureDefaultColumn(tableViewerCreator);
  if (showCommentColumn) {
    configureCommentColumn(tableViewerCreator);
  }
  if (PluginChecker.isDatacertPluginLoaded()) {
    configureRelationshipType(tableViewerCreator);
    configureRelatedEntity(tableViewerCreator);
  }
}

Fixed version (ground truth):
@Override protected void createColumns(TableViewerCreator<B> tableViewerCreator,Table table){
  tableViewerCreator.setReadOnly(false);
  TableViewerCreatorColumn column=new TableViewerCreatorColumn(tableViewerCreator);
  column.setTitle("String_Node_Str");
  column.setDefaultInternalValue("String_Node_Str");
  column.setWidth(15);
  if (isRepository) {
    configureUsefulColumn(tableViewerCreator);
  }
  configureNameColumn(tableViewerCreator);
  if (showDbColumnName) {
    configureDbColumnName(tableViewerCreator);
  }
  if (showKeyColumn) {
    configureKeyColumn(tableViewerCreator);
  }
  configureTypeColumns(tableViewerCreator);
  if (showNullableColumn) {
    configureNullableColumn(tableViewerCreator);
  }
  configurePatternColumn(tableViewerCreator);
  if (showLengthColumn) {
    configureLengthColumn(tableViewerCreator);
  }
  if (showOriginalLength) {
    configureOriginalLengthColumn(tableViewerCreator);
  }
  if (showAdditionalFieldColumn) {
    configureAdditionalFieldColumns(tableViewerCreator);
  }
  if (showPrecisionColumn) {
    configurePrecisionColumn(tableViewerCreator);
  }
  if (showDefaultColumn) {
    configureDefaultColumn(tableViewerCreator);
  }
  if (showCommentColumn) {
    configureCommentColumn(tableViewerCreator);
  }
  if (PluginChecker.isDatacertPluginLoaded()) {
    configureRelationshipType(tableViewerCreator);
    configureRelatedEntity(tableViewerCreator);
  }
}
Program: 126341
Project: 126341
Buggy source:
/** 
 * <p> Set JDBC properties to the hive db connection. </p> DOC ycbai Comment method "setHiveJDBCProperties".
 * @param metadataConn
 * @param dbConn
 */
private void setHiveJDBCProperties(IMetadataConnection metadataConn,Connection dbConn){
  if (metadataConn == null || dbConn == null) {
    return;
  }
  String jdbcPropertiesStr=String.valueOf(metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_JDBC_PROPERTIES));
  List<Map<String,Object>> jdbcProperties=HadoopRepositoryUtil.getHadoopPropertiesList(jdbcPropertiesStr);
  Statement statement=null;
  try {
    statement=dbConn.createStatement();
    for (    Map<String,Object> propMap : jdbcProperties) {
      String key=TalendQuoteUtils.removeQuotesIfExist(String.valueOf(propMap.get("String_Node_Str")));
      String value=TalendQuoteUtils.removeQuotesIfExist(String.valueOf(propMap.get("String_Node_Str")));
      if (StringUtils.isNotEmpty(key) && value != null) {
        statement.execute("String_Node_Str" + key + "String_Node_Str"+ value);
      }
    }
  }
 catch (  SQLException e) {
    ExceptionHandler.process(e);
  }
 finally {
    if (statement != null) {
      try {
        statement.close();
      }
 catch (      SQLException e) {
        e.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * <p> Set JDBC properties to the hive db connection. </p> DOC ycbai Comment method "setHiveJDBCProperties".
 * @param metadataConn
 * @param dbConn
 */
private void setHiveJDBCProperties(IMetadataConnection metadataConn,Connection dbConn){
  if (metadataConn == null || dbConn == null) {
    return;
  }
  Object jdbcPropertiesObj=metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HIVE_JDBC_PROPERTIES);
  if (jdbcPropertiesObj == null) {
    return;
  }
  String jdbcPropertiesStr=String.valueOf(jdbcPropertiesObj);
  List<Map<String,Object>> jdbcProperties=HadoopRepositoryUtil.getHadoopPropertiesList(jdbcPropertiesStr);
  Statement statement=null;
  try {
    statement=dbConn.createStatement();
    for (    Map<String,Object> propMap : jdbcProperties) {
      String key=TalendQuoteUtils.removeQuotesIfExist(String.valueOf(propMap.get("String_Node_Str")));
      String value=TalendQuoteUtils.removeQuotesIfExist(String.valueOf(propMap.get("String_Node_Str")));
      if (StringUtils.isNotEmpty(key) && value != null) {
        statement.execute("String_Node_Str" + key + "String_Node_Str"+ value);
      }
    }
  }
 catch (  SQLException e) {
    ExceptionHandler.process(e);
  }
 finally {
    if (statement != null) {
      try {
        statement.close();
      }
 catch (      SQLException e) {
        e.printStackTrace();
      }
    }
  }
}
Program: 126344
Project: 126344
Buggy source:
private RepositoryNode getAndStoreTopLevelNode(RepositoryNode repositoryNode){
  RepositoryNode aTopLevelNode=getInitialTopLevelNode(repositoryNode);
  if (aTopLevelNode != null) {
    boolean isNewTopLevel=topLevelNodes.add(aTopLevelNode);
    if (isNewTopLevel) {
      initilizeContentProviderWithTopLevelNode(aTopLevelNode);
    }
  }
  return aTopLevelNode;
}

Fixed version (ground truth):
protected RepositoryNode getAndStoreTopLevelNode(RepositoryNode repositoryNode){
  RepositoryNode aTopLevelNode=getInitialTopLevelNode(repositoryNode);
  if (aTopLevelNode != null) {
    boolean isNewTopLevel=topLevelNodes.add(aTopLevelNode);
    if (isNewTopLevel) {
      initilizeContentProviderWithTopLevelNode(aTopLevelNode);
    }
  }
  return aTopLevelNode;
}
Program: 126346
Project: 126346
Buggy source:
public static MetadataTable getMetadataTableFromRepository(String metaRepositoryId){
  org.talend.core.model.metadata.builder.connection.Connection connection;
  String[] names=metaRepositoryId.split("String_Node_Str");
  if (names.length < 2) {
    return null;
  }
  String linkedRepository=names[0];
  String tableName=null;
  if (names.length == 2) {
    tableName=names[1];
  }
 else   if (names.length > 2) {
    tableName=metaRepositoryId.substring(linkedRepository.length() + 3);
  }
  connection=getConnectionFromRepository(linkedRepository);
  if (connection != null) {
    if (connection instanceof SAPConnection) {
      return getMetadataTableFromSAPFunction((SAPConnection)connection,metaRepositoryId);
    }
    Set tables=ConnectionHelper.getTables(connection);
    for (    Object tableObj : tables) {
      MetadataTable table=(MetadataTable)tableObj;
      if (table.getLabel().equals(tableName)) {
        return table;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public static MetadataTable getMetadataTableFromRepository(String metaRepositoryId){
  org.talend.core.model.metadata.builder.connection.Connection connection;
  String[] names=metaRepositoryId.split("String_Node_Str");
  if (names.length < 2) {
    return null;
  }
  String linkedRepository=names[0];
  String tableName=null;
  if (names.length == 2) {
    tableName=names[1];
  }
 else   if (names.length > 2) {
    tableName=metaRepositoryId.substring(linkedRepository.length() + 3);
  }
  connection=getConnectionFromRepository(linkedRepository);
  if (connection != null) {
    if (connection instanceof SAPConnection) {
      if (tableName == null) {
        return null;
      }
      if (tableName.contains("String_Node_Str")) {
        return getMetadataTableFromSAPFunction((SAPConnection)connection,metaRepositoryId);
      }
    }
    Set tables=ConnectionHelper.getTables(connection);
    for (    Object tableObj : tables) {
      MetadataTable table=(MetadataTable)tableObj;
      if (table.getLabel().equals(tableName)) {
        return table;
      }
    }
  }
  return null;
}
Program: 126347
Project: 126347
Buggy source:
/** 
 * Add a group of child to the tree node.
 * @param children
 */
public void addChild(Object[] children){
  for (  Object element : children) {
    this.children.add(element);
    ((ATreeNode)element).setNodeParent(this);
  }
}

Fixed version (ground truth):
/** 
 * Add a group of child to the tree node.
 * @param children
 */
public void addChild(Object[] children){
  for (  Object element : children) {
    addChild(element);
  }
}
Program: 126351
Project: 126351
Buggy source:
/** 
 * wzhang Comment method "addChild".
 * @param index
 * @param child
 */
public void addChild(int index,FOXTreeNode child){
  if (index < children.size()) {
    children.add(index,child);
  }
 else {
    children.add(child);
  }
  child.setParent(this);
}

Fixed version (ground truth):
/** 
 * wzhang Comment method "addChild".
 * @param index
 * @param child
 */
public void addChild(int index,FOXTreeNode child){
  if (index < children.size() && index > 0) {
    children.add(index,child);
  }
 else {
    children.add(child);
  }
  child.setParent(this);
}
Program: 126353
Project: 126353
Buggy source:
/** 
 * wzhang Comment method "addChild".
 * @param index
 * @param child
 */
public void addChild(int index,FOXTreeNode child){
  if (index < children.size() && index > 0) {
    children.add(index,child);
  }
 else {
    children.add(child);
  }
  child.setParent(this);
}

Fixed version (ground truth):
/** 
 * wzhang Comment method "addChild".
 * @param index
 * @param child
 */
public void addChild(int index,FOXTreeNode child){
  if (index < children.size() && index >= 0) {
    children.add(index,child);
  }
 else {
    children.add(child);
  }
  child.setParent(this);
}
Program: 126354
Project: 126354
Buggy source:
/** 
 * DOC cmeng Comment method "doVaribleReplace".
 * @param oldName
 * @param newName
 * @param value
 * @param functionNameAreas
 * @param vStart
 * @param vEnd
 */
private static String doVaribleReplace(String oldName,String newName,String value,List<Point> functionNameAreas,int vStart,int vEnd){
  StringBuffer replacedString=new StringBuffer();
  int replaceableStart=vStart;
  int replaceableEnd=vEnd;
  for (  Point functionNameArea : functionNameAreas) {
    if (vEnd <= functionNameArea.x) {
      break;
    }
    if (functionNameArea.y <= vStart) {
      continue;
    }
    if (replaceableStart < functionNameArea.x) {
      replaceableEnd=functionNameArea.x;
      String replaceableString=value.substring(replaceableStart,replaceableEnd);
      replacedString.append(doReplace(oldName,newName,replaceableString));
      replacedString.append(value.substring(functionNameArea.x,functionNameArea.y));
    }
 else {
      replacedString.append(value.substring(functionNameArea.x,functionNameArea.y));
    }
    replaceableStart=functionNameArea.y;
  }
  if (replaceableStart < vEnd) {
    String replaceableString=value.substring(replaceableStart,vEnd);
    replacedString.append(doReplace(oldName,newName,replaceableString));
  }
  return replacedString.toString();
}

Fixed version (ground truth):
/** 
 * DOC cmeng Comment method "doVaribleReplace".
 * @param oldName
 * @param newName
 * @param value
 * @param functionNameAreas
 * @param vStart
 * @param vEnd
 */
private static String doVaribleReplace(String oldName,String newName,String value,List<Point> functionNameAreas,int vStart,int vEnd){
  if (value.trim().isEmpty()) {
    return value;
  }
  StringBuffer replacedString=new StringBuffer();
  int replaceableStart=vStart;
  int replaceableEnd=vEnd;
  for (  Point functionNameArea : functionNameAreas) {
    if (vEnd <= functionNameArea.x) {
      break;
    }
    if (functionNameArea.y <= vStart) {
      continue;
    }
    if (replaceableStart < functionNameArea.x) {
      replaceableEnd=functionNameArea.x;
      String replaceableString=value.substring(replaceableStart,replaceableEnd);
      replacedString.append(doReplace(oldName,newName,replaceableString));
      replacedString.append(doReplace(oldName,newName,value.substring(functionNameArea.x,functionNameArea.y)));
    }
 else {
      replacedString.append(doReplace(oldName,newName,value.substring(functionNameArea.x,functionNameArea.y)));
    }
    replaceableStart=functionNameArea.y;
  }
  if (replaceableStart < vEnd) {
    String replaceableString=value.substring(replaceableStart,vEnd);
    replacedString.append(doReplace(oldName,newName,replaceableString));
  }
  return replacedString.toString();
}
Program: 126356
Project: 126356
Buggy source:
@Test public void testExecuteProjectItem(){
  ContextItem jobDocExtItem=PropertiesFactory.eINSTANCE.createContextItem();
  jobDocExtItem.setProperty(PropertiesFactory.eINSTANCE.createProperty());
  JobDocItemMigrationTask jobDocItemMigrationTaskSpy=spy(new JobDocItemMigrationTask());
  jobDocItemMigrationTaskSpy.execute(null,jobDocExtItem);
  verify(jobDocItemMigrationTaskSpy).execute(jobDocExtItem);
}

Fixed version (ground truth):
@Test public void testExecuteProjectItem(){
  ContextItem jobDocExtItem=PropertiesFactory.eINSTANCE.createContextItem();
  jobDocExtItem.setProperty(PropertiesFactory.eINSTANCE.createProperty());
  JobDocItemMigrationTask jobDocItemMigrationTaskSpy=spy(new JobDocItemMigrationTask());
  jobDocItemMigrationTaskSpy.execute(jobDocExtItem);
  verify(jobDocItemMigrationTaskSpy).execute(jobDocExtItem);
}
Program: 126358
Project: 126358
Buggy source:
private String getTypeName(String typeName){
  String result=typeName;
  if (TABLE.equals(typeName)) {
    result=T;
  }
 else   if (VIEW.equals(typeName)) {
    result=V;
  }
 else   if (SYNONYM.equals(typeName)) {
    result=S;
  }
 else   if (ALIAS.equals(typeName)) {
    result=A;
  }
  return result;
}

Fixed version (ground truth):
private String getTypeName(String typeName){
  String result=typeName;
  if (TABLE.equals(typeName)) {
    result=T;
  }
 else   if (VIEW.equals(typeName)) {
    result=V;
  }
 else   if (SYNONYM.equals(typeName)) {
    result=S;
  }
 else   if (ALIAS.equals(typeName)) {
    result=A;
  }
 else   if (EXTERNAL_TABLE.equals(typeName)) {
    result=P;
  }
  return result;
}
Program: 126360
Project: 126360
Buggy source:
private String getTypeName(String typeName){
  String result=typeName;
  if (TABLE.equals(typeName)) {
    result=T;
  }
 else   if (VIEW.equals(typeName)) {
    result=V;
  }
 else   if (SYNONYM.equals(typeName)) {
    result=S;
  }
 else   if (ALIAS.equals(typeName)) {
    result=A;
  }
  return result;
}

Fixed version (ground truth):
private String getTypeName(String typeName){
  String result=typeName;
  if (TABLE.equals(typeName)) {
    result=T;
  }
 else   if (VIEW.equals(typeName)) {
    result=V;
  }
 else   if (SYNONYM.equals(typeName)) {
    result=S;
  }
 else   if (ALIAS.equals(typeName)) {
    result=A;
  }
 else   if (EXTERNAL_TABLE.equals(typeName)) {
    result=P;
  }
  return result;
}
Program: 126361
Project: 126361
Buggy source:
/** 
 * DOC YeXiaowei Comment method "createSAPFunctionNodes".
 * @param metadataConnection
 * @param functionNode
 */
private void createSAPFunctionNodes(final RepositoryNode recBin,IRepositoryViewObject rebObj,Connection metadataConnection,RepositoryNode functionNode,List<IRepositoryViewObject> validationRules){
  EList functions=((SAPConnection)metadataConnection).getFuntions();
  if (functions == null || functions.isEmpty()) {
    return;
  }
  for (int i=0; i < functions.size(); i++) {
    SAPFunctionUnit unit=(SAPFunctionUnit)functions.get(i);
    RepositoryNode tableNode=createSAPNode(rebObj,functionNode,unit);
    RepositoryNode inputNode=new StableRepositoryNode(tableNode,Messages.getString("String_Node_Str"),ECoreImage.FOLDER_CLOSE_ICON);
    tableNode.getChildren().add(inputNode);
    createTables(recBin,inputNode,rebObj,unit.getInputTables(),ERepositoryObjectType.METADATA_CON_TABLE,validationRules);
    RepositoryNode outputNode=new StableRepositoryNode(tableNode,Messages.getString("String_Node_Str"),ECoreImage.FOLDER_CLOSE_ICON);
    tableNode.getChildren().add(outputNode);
    createTables(recBin,outputNode,rebObj,unit.getTables(),ERepositoryObjectType.METADATA_CON_TABLE,validationRules);
    if (SubItemHelper.isDeleted(unit)) {
    }
 else {
      functionNode.getChildren().add(tableNode);
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC YeXiaowei Comment method "createSAPFunctionNodes".
 * @param metadataConnection
 * @param functionNode
 */
private void createSAPFunctionNodes(final RepositoryNode recBin,IRepositoryViewObject rebObj,Connection metadataConnection,RepositoryNode functionNode,List<IRepositoryViewObject> validationRules){
  EList functions=((SAPConnection)metadataConnection).getFuntions();
  if (functions == null || functions.isEmpty()) {
    return;
  }
  for (int i=0; i < functions.size(); i++) {
    SAPFunctionUnit unit=(SAPFunctionUnit)functions.get(i);
    RepositoryNode tableNode=createSAPNode(rebObj,functionNode,unit);
    RepositoryNode inputNode=new StableRepositoryNode(tableNode,Messages.getString("String_Node_Str"),ECoreImage.FOLDER_CLOSE_ICON);
    inputNode.setProperties(EProperties.CONTENT_TYPE,ERepositoryObjectType.METADATA_SAP_FUNCTION);
    tableNode.getChildren().add(inputNode);
    createTables(recBin,inputNode,rebObj,unit.getInputTables(),ERepositoryObjectType.METADATA_CON_TABLE,validationRules);
    RepositoryNode outputNode=new StableRepositoryNode(tableNode,Messages.getString("String_Node_Str"),ECoreImage.FOLDER_CLOSE_ICON);
    outputNode.setProperties(EProperties.CONTENT_TYPE,ERepositoryObjectType.METADATA_SAP_FUNCTION);
    tableNode.getChildren().add(outputNode);
    createTables(recBin,outputNode,rebObj,unit.getTables(),ERepositoryObjectType.METADATA_CON_TABLE,validationRules);
    if (SubItemHelper.isDeleted(unit)) {
    }
 else {
      functionNode.getChildren().add(tableNode);
    }
  }
}
Program: 126362
Project: 126362
Buggy source:
/** 
 * hwang Comment method "isSAPTable". for sap
 */
private boolean isSAPTable(RepositoryNode theNode){
  ERepositoryObjectType nodeType=(ERepositoryObjectType)theNode.getProperties(EProperties.CONTENT_TYPE);
  if (nodeType == ERepositoryObjectType.METADATA_CON_TABLE) {
    RepositoryNode node=theNode.getParent();
    nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType == ERepositoryObjectType.METADATA_SAP_FUNCTION || nodeType == ERepositoryObjectType.METADATA_SAP_IDOC || nodeType == ERepositoryObjectType.METADATA_SAP_TABLE) {
      return true;
    }
  }
 else   if (nodeType == ERepositoryObjectType.METADATA_CON_COLUMN) {
    RepositoryNode node=theNode.getParent().getParent().getParent();
    nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType == ERepositoryObjectType.METADATA_SAP_FUNCTION || nodeType == ERepositoryObjectType.METADATA_SAP_IDOC || nodeType == ERepositoryObjectType.METADATA_SAP_TABLE) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * hwang Comment method "isSAPTable". for sap
 */
private boolean isSAPTable(RepositoryNode theNode){
  ERepositoryObjectType nodeType=(ERepositoryObjectType)theNode.getProperties(EProperties.CONTENT_TYPE);
  if (nodeType == ERepositoryObjectType.METADATA_CON_TABLE) {
    RepositoryNode node=theNode.getParent();
    nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType == ERepositoryObjectType.METADATA_SAP_TABLE) {
      return true;
    }
  }
 else   if (nodeType == ERepositoryObjectType.METADATA_CON_COLUMN) {
    RepositoryNode node=theNode.getParent().getParent().getParent();
    nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType == ERepositoryObjectType.METADATA_SAP_TABLE) {
      return true;
    }
  }
  return false;
}
Program: 126365
Project: 126365
Buggy source:
public void addItem(ImportItem itemRecord){
  if (itemRecord != null) {
    this.allImportItemRecords.add(itemRecord);
    final Project project=itemRecord.getItemProject();
    if (project == null) {
      return;
    }
    final String technicalLabel=project.getTechnicalLabel();
    ProjectImportNode projectImportNode=this.projectNodesMap.get(technicalLabel);
    if (projectImportNode == null) {
      projectImportNode=new ProjectImportNode(project);
      this.projectNodesMap.put(technicalLabel,projectImportNode);
    }
    final Item item=itemRecord.getItem();
    final ERepositoryObjectType itemType=itemRecord.getRepositoryType();
    ImportNode typeImportNode=findAndCreateParentTypeNode(projectImportNode,itemType);
    ImportNode parentImportNode=typeImportNode;
    if (parentImportNode == null) {
      parentImportNode=projectImportNode;
    }
    String path=item.getState().getPath();
    if (StringUtils.isNotEmpty(path)) {
      parentImportNode=findAndCreateFolderNode(typeImportNode,new Path(path));
    }
    ItemImportNode itemNode=new ItemImportNode(itemRecord);
    parentImportNode.addChild(itemNode);
  }
}

Fixed version (ground truth):
public void addItem(ImportItem itemRecord){
  if (itemRecord != null) {
    this.allImportItemRecords.add(itemRecord);
    final Project project=itemRecord.getItemProject();
    if (project == null) {
      return;
    }
    final String technicalLabel=project.getTechnicalLabel();
    ProjectImportNode projectImportNode=this.projectNodesMap.get(technicalLabel);
    if (projectImportNode == null) {
      projectImportNode=new ProjectImportNode(project);
      this.projectNodesMap.put(technicalLabel,projectImportNode);
    }
    final Item item=itemRecord.getItem();
    if (item != null && hadoopClusterService != null && hadoopClusterService.isHadoopSubItem(item)) {
      return;
    }
    final ERepositoryObjectType itemType=itemRecord.getRepositoryType();
    ImportNode typeImportNode=findAndCreateParentTypeNode(projectImportNode,itemType);
    ImportNode parentImportNode=typeImportNode;
    if (parentImportNode == null) {
      parentImportNode=projectImportNode;
    }
    String path=item.getState().getPath();
    if (StringUtils.isNotEmpty(path)) {
      parentImportNode=findAndCreateFolderNode(typeImportNode,new Path(path));
    }
    ItemImportNode itemNode=new ItemImportNode(itemRecord);
    parentImportNode.addChild(itemNode);
  }
}
Program: 126366
Project: 126366
Buggy source:
/** 
 * Retrieve and return the dbms from the given id.
 * @param dbmsId
 * @return the dbms from the given id
 */
public static Dbms getDbms(String dbmsId){
  if (dbmsId == null) {
    throw new IllegalArgumentException();
  }
  Dbms[] allDbmsArray=getAllDbmsArray();
  for (  Dbms dbms : allDbmsArray) {
    if (dbmsId.equals(dbms.getId())) {
      return dbms;
    }
  }
  throw new IllegalArgumentException(Messages.getString("String_Node_Str",dbmsId));
}

Fixed version (ground truth):
/** 
 * Retrieve and return the dbms from the given id.
 * @param dbmsId
 * @return the dbms from the given id
 */
public static Dbms getDbms(String dbmsId){
  if (dbmsId == null) {
    throw new IllegalArgumentException();
  }
  Dbms[] allDbmsArray=getAllDbmsArray();
  for (  Dbms dbms : allDbmsArray) {
    if (dbmsId.equals(dbms.getId())) {
      return dbms;
    }
  }
  ExceptionHandler.log(Messages.getString("String_Node_Str",dbmsId));
  return null;
}
Program: 126368
Project: 126368
Buggy source:
private void createSAPTableNodes(final RepositoryNode recBin,IRepositoryViewObject repObj,Connection metadataConnection,RepositoryNode node,List<IRepositoryViewObject> validationRules){
  StableRepositoryNode tableContainer=new StableRepositoryNode(node,Messages.getString("String_Node_Str"),ECoreImage.FOLDER_CLOSE_ICON);
  tableContainer.setChildrenObjectType(ERepositoryObjectType.METADATA_CON_TABLE);
  node.getChildren().add(tableContainer);
  List<MetadataTable> tablesWithOrders=ConnectionHelper.getTablesWithOrders(metadataConnection);
  EList tables=new BasicEList();
  tables.addAll(tablesWithOrders);
  createTables(recBin,tableContainer,repObj,tables,ERepositoryObjectType.METADATA_CON_TABLE,validationRules);
}

Fixed version (ground truth):
private void createSAPTableNodes(final RepositoryNode recBin,IRepositoryViewObject repObj,Connection metadataConnection,RepositoryNode node,List<IRepositoryViewObject> validationRules){
  StableRepositoryNode tableContainer=new StableRepositoryNode(node,Messages.getString("String_Node_Str"),ECoreImage.FOLDER_CLOSE_ICON);
  tableContainer.setChildrenObjectType(ERepositoryObjectType.METADATA_CON_TABLE);
  tableContainer.setProperties(EProperties.CONTENT_TYPE,ERepositoryObjectType.METADATA_SAP_TABLE);
  node.getChildren().add(tableContainer);
  List<MetadataTable> tablesWithOrders=ConnectionHelper.getTablesWithOrders(metadataConnection);
  EList tables=new BasicEList();
  tables.addAll(tablesWithOrders);
  createTables(recBin,tableContainer,repObj,tables,ERepositoryObjectType.METADATA_CON_TABLE,validationRules);
}
Program: 126370
Project: 126370
Buggy source:
private String getParamType(IMetadataTable table){
  if (functionUnit == null) {
    return null;
  }
  SAPFunctionParamData paramData=functionUnit.getParamData();
  if (paramData == null) {
    return null;
  }
  for (  SAPFunctionParameter parameter : paramData.getOutputRoot().getChildren()) {
    if (parameter.getName().equals(table.getTableName())) {
      if (parameter.getType().equals(ISAPConstant.PARAM_STRUCTURE)) {
        return ISAPConstant.PARAM_STRUCTURE.toUpperCase();
      }
 else       if (parameter.getType().equals(ISAPConstant.PARAM_TABLE)) {
        return ISAPConstant.PARAM_TABLE.toUpperCase();
      }
 else {
        return ISAPConstant.PARAM_SINGLE.toUpperCase();
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private String getParamType(IMetadataTable table,boolean isInput){
  if (functionUnit == null) {
    return null;
  }
  SAPFunctionParamData paramData=functionUnit.getParamData();
  if (paramData == null) {
    return null;
  }
  EList<SAPFunctionParameter> parameterChildrenList=null;
  if (isInput) {
    parameterChildrenList=paramData.getInputRoot().getChildren();
  }
 else {
    parameterChildrenList=paramData.getOutputRoot().getChildren();
  }
  for (  SAPFunctionParameter parameter : parameterChildrenList) {
    if (parameter.getName().equals(table.getTableName())) {
      if (parameter.getType().equals(ISAPConstant.PARAM_STRUCTURE)) {
        return ISAPConstant.PARAM_STRUCTURE.toUpperCase();
      }
 else       if (parameter.getType().equals(ISAPConstant.PARAM_TABLE)) {
        return ISAPConstant.PARAM_TABLE.toUpperCase();
      }
 else {
        return ISAPConstant.PARAM_SINGLE.toUpperCase();
      }
    }
  }
  if (ISAPConstant.SINGLE_PARAM_TABLE_NAME.equals(table.getTableName())) {
    return ISAPConstant.PARAM_TABLE.toUpperCase();
  }
  return null;
}
Program: 126372
Project: 126372
Buggy source:
/** 
 * hwang Comment method "isSAPTable". for sap
 */
private boolean isSAPTable(RepositoryNode theNode){
  ERepositoryObjectType nodeType=(ERepositoryObjectType)theNode.getProperties(EProperties.CONTENT_TYPE);
  if (nodeType == ERepositoryObjectType.METADATA_CON_TABLE) {
    RepositoryNode node=theNode.getParent();
    nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType == ERepositoryObjectType.METADATA_SAP_FUNCTION || nodeType == ERepositoryObjectType.METADATA_SAP_IDOC) {
      return true;
    }
  }
 else   if (nodeType == ERepositoryObjectType.METADATA_CON_COLUMN) {
    RepositoryNode node=theNode.getParent().getParent().getParent();
    nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType == ERepositoryObjectType.METADATA_SAP_FUNCTION || nodeType == ERepositoryObjectType.METADATA_SAP_IDOC) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * hwang Comment method "isSAPTable". for sap
 */
private boolean isSAPTable(RepositoryNode theNode){
  ERepositoryObjectType nodeType=(ERepositoryObjectType)theNode.getProperties(EProperties.CONTENT_TYPE);
  if (nodeType == ERepositoryObjectType.METADATA_CON_TABLE) {
    RepositoryNode node=theNode.getParent();
    nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType == ERepositoryObjectType.METADATA_SAP_FUNCTION || nodeType == ERepositoryObjectType.METADATA_SAP_IDOC || nodeType == ERepositoryObjectType.METADATA_SAP_TABLE) {
      return true;
    }
  }
 else   if (nodeType == ERepositoryObjectType.METADATA_CON_COLUMN) {
    RepositoryNode node=theNode.getParent().getParent().getParent();
    nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType == ERepositoryObjectType.METADATA_SAP_FUNCTION || nodeType == ERepositoryObjectType.METADATA_SAP_IDOC || nodeType == ERepositoryObjectType.METADATA_SAP_TABLE) {
      return true;
    }
  }
  return false;
}
Program: 126373
Project: 126373
Buggy source:
/** 
 * DOC qzhang Comment method "addTableListener".
 */
private void addTableListener(){
  table.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    final SelectionEvent e){
      if (e.detail == SWT.CHECK) {
        TableItem tableItem=(TableItem)e.item;
        boolean promptNeeded=tableItem.getChecked();
        if (promptNeeded) {
          clearTableItem(tableItem);
          tableItem.setText(2,"String_Node_Str");
          tableItem.setText(3,Messages.getString("String_Node_Str"));
          countPending++;
          parentWizardPage.setPageComplete(false);
          refreshTable(tableItem,-1);
        }
 else {
          clearTableItem(tableItem);
          if (tableItem.getText() != null && tableItem.getText().equals(Messages.getString("String_Node_Str"))) {
            countPending--;
          }
        }
        if (forTemplate && (ConnectionHelper.getTables(getConnection()).size() <= 0)) {
          parentWizardPage.setPageComplete(false);
        }
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * DOC qzhang Comment method "addTableListener".
 */
private void addTableListener(){
  table.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    final SelectionEvent e){
      if (e.detail == SWT.CHECK) {
        TableItem tableItem=(TableItem)e.item;
        boolean promptNeeded=tableItem.getChecked();
        if (promptNeeded) {
          clearTableItem(tableItem);
          tableItem.setText(2,"String_Node_Str");
          tableItem.setText(3,Messages.getString("String_Node_Str"));
synchronized (countPending) {
            countPending++;
          }
          parentWizardPage.setPageComplete(false);
          refreshTable(tableItem,-1);
        }
 else {
          String pending=tableItem.getText(3);
          clearTableItem(tableItem);
          if (pending != null && pending.equals(Messages.getString("String_Node_Str"))) {
synchronized (countPending) {
              countPending--;
            }
          }
        }
        if (forTemplate && (ConnectionHelper.getTables(getConnection()).size() <= 0)) {
          parentWizardPage.setPageComplete(false);
        }
      }
    }
  }
);
}
Program: 126375
Project: 126375
Buggy source:
@Override public void widgetSelected(final SelectionEvent e){
  if (e.detail == SWT.CHECK) {
    TableItem tableItem=(TableItem)e.item;
    boolean promptNeeded=tableItem.getChecked();
    if (promptNeeded) {
      clearTableItem(tableItem);
      tableItem.setText(2,"String_Node_Str");
      tableItem.setText(3,Messages.getString("String_Node_Str"));
      countPending++;
      parentWizardPage.setPageComplete(false);
      refreshTable(tableItem,-1);
    }
 else {
      clearTableItem(tableItem);
      if (tableItem.getText() != null && tableItem.getText().equals(Messages.getString("String_Node_Str"))) {
        countPending--;
      }
    }
    if (forTemplate && (ConnectionHelper.getTables(getConnection()).size() <= 0)) {
      parentWizardPage.setPageComplete(false);
    }
  }
}

Fixed version (ground truth):
@Override public void widgetSelected(final SelectionEvent e){
  if (e.detail == SWT.CHECK) {
    TableItem tableItem=(TableItem)e.item;
    boolean promptNeeded=tableItem.getChecked();
    if (promptNeeded) {
      clearTableItem(tableItem);
      tableItem.setText(2,"String_Node_Str");
      tableItem.setText(3,Messages.getString("String_Node_Str"));
synchronized (countPending) {
        countPending++;
      }
      parentWizardPage.setPageComplete(false);
      refreshTable(tableItem,-1);
    }
 else {
      String pending=tableItem.getText(3);
      clearTableItem(tableItem);
      if (pending != null && pending.equals(Messages.getString("String_Node_Str"))) {
synchronized (countPending) {
          countPending--;
        }
      }
    }
    if (forTemplate && (ConnectionHelper.getTables(getConnection()).size() <= 0)) {
      parentWizardPage.setPageComplete(false);
    }
  }
}
Program: 126378
Project: 126378
Buggy source:
@Override public ExecutionResult execute(Item item){
  if (item instanceof LDAPSchemaConnectionItem) {
    Connection connection=((LDAPSchemaConnectionItem)item).getConnection();
    if (connection instanceof LDAPSchemaConnection) {
      LDAPSchemaConnection ldapConn=(LDAPSchemaConnection)connection;
      try {
        if (!ldapConn.isContextMode()) {
          String pass=ldapConn.getBindPassword();
          ldapConn.setBindPassword(ldapConn.getValue(pass,true));
          factory.save(item,true);
        }
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
        return ExecutionResult.FAILURE;
      }
    }
  }
  return ExecutionResult.SUCCESS_NO_ALERT;
}

Fixed version (ground truth):
@Override public ExecutionResult execute(Item item){
  if (item instanceof LDAPSchemaConnectionItem) {
    Connection connection=((LDAPSchemaConnectionItem)item).getConnection();
    if (connection instanceof LDAPSchemaConnection) {
      LDAPSchemaConnection ldapConn=(LDAPSchemaConnection)connection;
      try {
        if (!ldapConn.isContextMode()) {
          String pass=ldapConn.getBindPassword();
          ldapConn.setBindPassword(ldapConn.getValue(pass,true));
          factory.save(item,true);
          return ExecutionResult.SUCCESS_NO_ALERT;
        }
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
        return ExecutionResult.FAILURE;
      }
    }
  }
  return ExecutionResult.NOTHING_TO_DO;
}
Program: 126379
Project: 126379
Buggy source:
@Override public ExecutionResult execute(Item item){
  if (item instanceof SalesforceSchemaConnectionItem) {
    Connection connection=((SalesforceSchemaConnectionItem)item).getConnection();
    if (connection instanceof SalesforceSchemaConnection) {
      SalesforceSchemaConnection ssConn=(SalesforceSchemaConnection)connection;
      try {
        if (!ssConn.isContextMode()) {
          ssConn.setPassword(ssConn.getValue(ssConn.getPassword(),true));
          ssConn.setProxyPassword(ssConn.getValue(ssConn.getProxyPassword(),true));
          ssConn.setConsumeSecret(ssConn.getValue(ssConn.getConsumeSecret(),true));
          factory.save(item,true);
        }
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
        return ExecutionResult.FAILURE;
      }
    }
  }
  return ExecutionResult.SUCCESS_NO_ALERT;
}

Fixed version (ground truth):
@Override public ExecutionResult execute(Item item){
  if (item instanceof SalesforceSchemaConnectionItem) {
    Connection connection=((SalesforceSchemaConnectionItem)item).getConnection();
    if (connection instanceof SalesforceSchemaConnection) {
      SalesforceSchemaConnection ssConn=(SalesforceSchemaConnection)connection;
      try {
        if (!ssConn.isContextMode()) {
          ssConn.setPassword(ssConn.getValue(ssConn.getPassword(),true));
          ssConn.setProxyPassword(ssConn.getValue(ssConn.getProxyPassword(),true));
          ssConn.setConsumeSecret(ssConn.getValue(ssConn.getConsumeSecret(),true));
          factory.save(item,true);
          return ExecutionResult.SUCCESS_NO_ALERT;
        }
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
        return ExecutionResult.FAILURE;
      }
    }
  }
  return ExecutionResult.NOTHING_TO_DO;
}
Program: 126380
Project: 126380
Buggy source:
@Override Set<String> getDrivers(){
  Set<String> drivers=new HashSet<String>();
  String javaVersion=System.getProperty("String_Node_Str");
  if (javaVersion != null) {
    org.talend.commons.utils.Version v=new org.talend.commons.utils.Version(javaVersion);
    if (v.getMajor() == 1 && v.getMinor() > 6) {
      drivers.add(DRIVER_1_6);
    }
 else {
      drivers.add(DRIVER_1_5);
    }
  }
  return drivers;
}

Fixed version (ground truth):
@Override Set<String> getDrivers(){
  Set<String> drivers=new HashSet<String>();
  String javaVersion=System.getProperty("String_Node_Str");
  if (javaVersion != null) {
    org.talend.commons.utils.Version v=new org.talend.commons.utils.Version(javaVersion);
    if (v.getMajor() == 1 && v.getMinor() == 5) {
      drivers.add(DRIVER_1_5);
    }
 else {
      drivers.add(DRIVER_1_6);
    }
  }
  return drivers;
}
Program: 126381
Project: 126381
Buggy source:
public static String getPasswordDisplay(String value){
  if (value != null) {
    if (value.length() == 0) {
      return "String_Node_Str";
    }
 else {
      return value.replaceAll("String_Node_Str","String_Node_Str");
    }
  }
  return value;
}

Fixed version (ground truth):
public static String getPasswordDisplay(String value){
  if (value == null || value.length() == 0) {
    return "String_Node_Str";
  }
 else {
    return value.replaceAll("String_Node_Str","String_Node_Str");
  }
}
Program: 126384
Project: 126384
Buggy source:
/** 
 * DOC ycbai Comment method "addQuotesIfNotExist".
 * @param text
 * @return
 */
public static String addQuotesIfNotExist(String text,String quote){
  if (text == null) {
    return null;
  }
  if (!text.startsWith(quote)) {
    text=quote + text;
  }
  if (!text.endsWith(quote)) {
    text=text + quote;
  }
  return text;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "addQuotesIfNotExist".
 * @param text
 * @return
 */
public static String addQuotesIfNotExist(String text,String quote){
  if (text == null) {
    return null;
  }
  if ("String_Node_Str".equals(text)) {
    text=quote + quote;
  }
 else {
    if (!text.startsWith(quote)) {
      text=quote + text;
    }
    if (!text.endsWith(quote)) {
      text=text + quote;
    }
  }
  return text;
}
Program: 126386
Project: 126386
Buggy source:
/** 
 * DOC ycbai Comment method "addQuotesIfNotExist".
 * @param text
 * @return
 */
public static String addQuotesIfNotExist(String text,String quote){
  if (text == null) {
    return null;
  }
  if ("String_Node_Str".equals(text)) {
    text=quote + quote;
  }
 else {
    if (!text.startsWith(quote)) {
      text=quote + text;
    }
    if (!text.endsWith(quote)) {
      text=text + quote;
    }
  }
  return text;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "addQuotesIfNotExist".
 * @param text
 * @return
 */
public static String addQuotesIfNotExist(String text,String quote){
  if (text == null) {
    return null;
  }
  if (!text.startsWith(quote)) {
    text=quote + text;
  }
  if (!text.endsWith(quote) || (quote != null && quote.equals(text))) {
    text=text + quote;
  }
  return text;
}
Program: 126387
Project: 126387
Buggy source:
protected void switchSettingsView(String oldName,String newName){
}

Fixed version (ground truth):
public void switchSettingsView(String oldName,String newName){
}
Program: 126388
Project: 126388
Buggy source:
@Override public void execute(){
  boolean modified=false;
  if (modelManager.getContextManager() != null) {
    originalName=param.getName();
    for (    IContext context : modelManager.getContextManager().getListContext()) {
      for (      IContextParameter contextParameter : context.getContextParameterList()) {
        String tempSourceId=contextParameter.getSource();
        if (originalName.equals(contextParameter.getName()) && tempSourceId.equals(sourceId)) {
          contextParameter.setName(newName);
          if (contextParameter.getPrompt().equals(originalName + "String_Node_Str")) {
            contextParameter.setPrompt(newName + "String_Node_Str");
          }
          modified=true;
        }
      }
    }
    param.setName(newName);
    if (param.getPrompt().equals(originalName + "String_Node_Str")) {
      param.setPrompt(newName + "String_Node_Str");
    }
  }
  if (modified) {
    updateRelation();
  }
}

Fixed version (ground truth):
@Override public void execute(){
  boolean modified=false;
  if (modelManager.getContextManager() != null) {
    originalName=param.getName();
    for (    IContext context : modelManager.getContextManager().getListContext()) {
      for (      IContextParameter contextParameter : context.getContextParameterList()) {
        String tempSourceId=contextParameter.getSource();
        if (originalName.equals(contextParameter.getName()) && tempSourceId.equals(sourceId)) {
          contextParameter.setName(newName);
          if (contextParameter.getPrompt().equals(originalName + "String_Node_Str")) {
            contextParameter.setPrompt(newName + "String_Node_Str");
          }
          modified=true;
        }
      }
    }
    param.setName(newName);
    if (param.getPrompt().equals(originalName + "String_Node_Str")) {
      param.setPrompt(newName + "String_Node_Str");
    }
  }
  if (modified) {
    updateRelation(originalName,newName);
  }
}