nus-yam/ex-repair huggingface dataset:
Program: 130071
Project: 130071
Buggy source:
private boolean createChildNode(FOXTreeNode node){
  if (node.getColumn() != null) {
    if (!MessageDialog.openConfirm(xmlViewer.getControl().getShell(),"String_Node_Str","String_Node_Str" + node.getLabel() + "String_Node_Str")) {
      return false;
    }
    node.setColumn(null);
  }
  String label="String_Node_Str";
  while (!StringUtil.validateLabelForXML(label)) {
    InputDialog dialog=new InputDialog(null,"String_Node_Str","String_Node_Str","String_Node_Str",null);
    int status=dialog.open();
    if (status == InputDialog.OK) {
      label=dialog.getValue().trim();
    }
    if (status == InputDialog.CANCEL) {
      return false;
    }
  }
  FOXTreeNode child=new Element(label);
  node.addChild(child);
  this.xmlViewer.refresh();
  this.xmlViewer.expandAll();
  return true;
}

Fixed version (ground truth):
private boolean createChildNode(FOXTreeNode node){
  if (node.getColumn() != null) {
    if (!MessageDialog.openConfirm(xmlViewer.getControl().getShell(),"String_Node_Str","String_Node_Str" + node.getLabel() + "String_Node_Str")) {
      return false;
    }
    node.setColumn(null);
  }
  String label="String_Node_Str";
  while (!StringUtil.validateLabelForXML(label)) {
    InputDialog dialog=new InputDialog(null,"String_Node_Str","String_Node_Str","String_Node_Str",null);
    int status=dialog.open();
    if (status == InputDialog.OK) {
      label=dialog.getValue().trim();
    }
    if (status == InputDialog.CANCEL) {
      return false;
    }
  }
  FOXTreeNode child=new Element(label);
  node.addChild(child);
  if (node.getParent() == null && node.isLoop()) {
    node.setLoop(false);
  }
  this.xmlViewer.refresh();
  this.xmlViewer.expandAll();
  return true;
}
Program: 130072
Project: 130072
Buggy source:
@Override public void selectionChanged(IStructuredSelection selection){
  FOXTreeNode node=(FOXTreeNode)this.getStructuredSelection().getFirstElement();
  if (node == null) {
    this.setEnabled(false);
    return;
  }
  if (node instanceof Attribute) {
    this.setEnabled(false);
    return;
  }
  if (node instanceof NameSpaceNode) {
    this.setEnabled(false);
    return;
  }
  this.setEnabled(TreeUtil.checkTreeLoopNode(node));
}

Fixed version (ground truth):
@Override public void selectionChanged(IStructuredSelection selection){
  FOXTreeNode node=(FOXTreeNode)this.getStructuredSelection().getFirstElement();
  if (node == null) {
    this.setEnabled(false);
    return;
  }
  this.setEnabled(TreeUtil.canSetAsLoop(node));
}
Program: 130075
Project: 130075
Buggy source:
public XSDSchema getXSDSchema(String fileName) throws URISyntaxException, MalformedURLException {
  ResourceSet resourceSet=new ResourceSetImpl();
  XSDResourceImpl xsdResource=(XSDResourceImpl)resourceSet.getResource(URI.createFileURI(fileName),true);
  XSDSchema xsdSchema=xsdResource.getSchema();
  return xsdSchema;
}

Fixed version (ground truth):
public XSDSchema getXSDSchema(String fileName) throws URISyntaxException, MalformedURLException {
  XSDResourceImpl mainXsdResource=(XSDResourceImpl)resourceSet.getResource(URI.createFileURI(fileName),true);
  boolean haveExternalDependenciesWithoutLocation=false;
  for (  Resource resource : resourceSet.getResources()) {
    if (resource instanceof XSDResourceImpl) {
      XSDResourceImpl xsdResource=(XSDResourceImpl)resource;
      for (      EObject object : xsdResource.getSchema().getContents()) {
        if (object instanceof XSDImport) {
          XSDImport xsdImport=(XSDImport)object;
          if (StringUtils.isEmpty(xsdImport.getSchemaLocation())) {
            for (            Resource resource2 : resourceSet.getResources()) {
              if (resource2 instanceof XSDResourceImpl) {
                XSDResourceImpl xsdResource2=(XSDResourceImpl)resource2;
                if (xsdResource2.getSchema().getTargetNamespace() != null && xsdResource2.getSchema().getTargetNamespace().equals(xsdImport.getNamespace())) {
                  xsdImport.setSchemaLocation(xsdResource2.getSchema().getSchemaLocation());
                  haveExternalDependenciesWithoutLocation=true;
                }
              }
            }
          }
        }
      }
    }
  }
  XSDSchema xsdSchema=mainXsdResource.getSchema();
  if (haveExternalDependenciesWithoutLocation) {
    xsdSchema.setElement(xsdSchema.getDocument().getDocumentElement());
  }
  return xsdSchema;
}
Program: 130076
Project: 130076
Buggy source:
public Property getProperty(){
  Property property=viewObject.getProperty();
  updataColumn(property);
  return property;
}

Fixed version (ground truth):
public Property getProperty(){
  Property property=viewObject.getProperty();
  updateColumn(property);
  return property;
}
Program: 130077
Project: 130077
Buggy source:
public Property getProperty(){
  Property property=viewObject.getProperty();
  updataCatalog(property);
  return property;
}

Fixed version (ground truth):
public Property getProperty(){
  Property property=viewObject.getProperty();
  updateCatalog(property);
  return property;
}
Program: 130078
Project: 130078
Buggy source:
public Property getProperty(){
  Property property=viewObject.getProperty();
  updataCatalog(property);
  return property;
}

Fixed version (ground truth):
public Property getProperty(){
  Property property=viewObject.getProperty();
  updateCatalog(property);
  return property;
}
Program: 130079
Project: 130079
Buggy source:
public Property getProperty(){
  Property property=viewObject.getProperty();
  updataTable(property);
  return property;
}

Fixed version (ground truth):
public Property getProperty(){
  Property property=viewObject.getProperty();
  updateTable(property);
  return property;
}
Program: 130080
Project: 130080
Buggy source:
public Property getProperty(){
  Property property=viewObject.getProperty();
  updataCatalog(property);
  return property;
}

Fixed version (ground truth):
public Property getProperty(){
  Property property=viewObject.getProperty();
  updateCatalog(property);
  return property;
}
Program: 130081
Project: 130081
Buggy source:
public Property getProperty(){
  Property property=viewObject.getProperty();
  updataCatalog(property);
  return property;
}

Fixed version (ground truth):
public Property getProperty(){
  Property property=viewObject.getProperty();
  updateCatalog(property);
  return property;
}
Program: 130085
Project: 130085
Buggy source:
public static List<TreeItem> collectAllItems(TreeItem treeItem){
  List<TreeItem> list=new ArrayList<TreeItem>();
  TreeItem[] items=treeItem.getItems();
  for (  TreeItem item : items) {
    list.add(item);
    list.addAll(collectAllItems(item));
  }
  return list;
}

Fixed version (ground truth):
public static List<TreeItem> collectAllItems(TreeItem treeItem){
  List<TreeItem> list=new ArrayList<TreeItem>();
  list.add(treeItem);
  TreeItem[] items=treeItem.getItems();
  for (  TreeItem item : items) {
    list.addAll(collectAllItems(item));
  }
  return list;
}
Program: 130087
Project: 130087
Buggy source:
@Override public void run(){
  FOXTreeNode node=(FOXTreeNode)this.getStructuredSelection().getFirstElement();
  if (createChildNode(node)) {
    form.redrawLinkers();
  }
  form.updateConnection();
}

Fixed version (ground truth):
@Override public void run(){
  FOXTreeNode node=(FOXTreeNode)this.getStructuredSelection().getFirstElement();
  if (createChildNode(node)) {
    form.redrawLinkers();
  }
  form.updateConnection();
  form.updateStatus();
}
Program: 130089
Project: 130089
Buggy source:
public String format(double d,String pattern){
  return String.valueOf(d);
}

Fixed version (ground truth):
public static String format(double d,String pattern){
  return String.valueOf(d);
}
Program: 130090
Project: 130090
Buggy source:
/** 
 * DOC cantoine. Method to return DatabaseMetaData of a DB connection.
 * @param AbstractConnection conn
 * @return DatabaseMetaData
 */
public static DatabaseMetaData getDatabaseMetaData(Connection conn,String dbType){
  DatabaseMetaData dbMetaData=null;
  try {
    if (needFakeDatabaseMetaData(dbType)) {
      dbMetaData=createFakeDatabaseMetaData(conn);
    }
 else     if (ExtractMetaDataUtils.metadataCon != null && teradataNeedFakeDatabaseMetaData(dbType) && ExtractMetaDataUtils.metadataCon.isSqlMode()) {
      dbMetaData=createTeradataFakeDatabaseMetaData(conn);
      TeradataDataBaseMetadata teraDbmeta=(TeradataDataBaseMetadata)dbMetaData;
      teraDbmeta.setDatabaseName(ExtractMetaDataUtils.metadataCon.getDatabase());
    }
 else     if (sasNeedFakeDatabaseMetaData(dbType)) {
      dbMetaData=createSASFakeDatabaseMetaData(conn);
    }
 else {
      dbMetaData=conn.getMetaData();
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
  return dbMetaData;
}

Fixed version (ground truth):
/** 
 * DOC cantoine. Method to return DatabaseMetaData of a DB connection.
 * @param AbstractConnection conn
 * @return DatabaseMetaData
 */
public static DatabaseMetaData getDatabaseMetaData(Connection conn,String dbType){
  DatabaseMetaData dbMetaData=null;
  try {
    if (dbType.equals(EDatabaseTypeName.IBMDB2ZOS.getXmlName())) {
      dbMetaData=createFakeDatabaseMetaData(conn);
    }
 else     if (ExtractMetaDataUtils.metadataCon != null && dbType.equals(EDatabaseTypeName.TERADATA.getXmlName()) && ExtractMetaDataUtils.metadataCon.isSqlMode()) {
      dbMetaData=createTeradataFakeDatabaseMetaData(conn);
      TeradataDataBaseMetadata teraDbmeta=(TeradataDataBaseMetadata)dbMetaData;
      teraDbmeta.setDatabaseName(ExtractMetaDataUtils.metadataCon.getDatabase());
    }
 else     if (dbType.equals(EDatabaseTypeName.SAS.getXmlName())) {
      dbMetaData=createSASFakeDatabaseMetaData(conn);
    }
 else {
      dbMetaData=conn.getMetaData();
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
  return dbMetaData;
}
Program: 130091
Project: 130091
Buggy source:
/** 
 * check if a FakeDatabaseMetaData is needed. only for db2 on z/os right now.
 * @param dbMetaData
 * @return
 */
public static boolean needFakeDatabaseMetaData(String dbType){
  if (dbType.equals(EDatabaseTypeName.IBMDB2ZOS.getXmlName())) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
public static boolean needFakeDatabaseMetaData(String dbType,boolean isSqlMode){
  if (dbType.equals(EDatabaseTypeName.IBMDB2ZOS.getXmlName())) {
    return true;
  }
 else   if (dbType.equals(EDatabaseTypeName.TERADATA.getXmlName()) && isSqlMode) {
    return true;
  }
 else   if (dbType.equals(EDatabaseTypeName.SAS.getXmlName())) {
    return true;
  }
  return false;
}
Program: 130093
Project: 130093
Buggy source:
public static String addQuotesWithSpaceFieldForSQLStringForce(String fieldName,String dbType,boolean simple){
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  final String quote=getQuoteByDBType(name);
  boolean isCheck=false;
  String preferenceValue=CorePlugin.getDefault().getPreferenceStore().getString(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  isCheck=Boolean.parseBoolean(preferenceValue);
  String temp=removeQuotes(fieldName);
  Pattern pattern=Pattern.compile("String_Node_Str");
  Matcher matcher=pattern.matcher(temp);
  boolean isSqlKeyword=KeywordsValidator.isSqlKeyword(temp,name.getProduct());
  boolean isH2=EDatabaseTypeName.H2 == name;
  if (((!matcher.matches() || isSqlKeyword) && !isH2 && EDatabaseTypeName.SAS != name && EDatabaseTypeName.IMPALA != name) || isIBMDB2ContainLowerCase(dbType,fieldName)) {
    isCheck=true;
  }
  if (!isCheck && isPSQLSimilar(name) && !EDatabaseTypeName.MYSQL.equals(name)) {
    return fieldName;
  }
  String newFieldName=fieldName;
  newFieldName=TalendQuoteUtils.addQuotesForSQLString(newFieldName,quote,simple);
  return newFieldName;
}

Fixed version (ground truth):
public static String addQuotesWithSpaceFieldForSQLStringForce(String fieldName,String dbType,boolean simple){
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  final String quote=getQuoteByDBType(name);
  boolean isCheck=false;
  String preferenceValue=CorePlugin.getDefault().getPreferenceStore().getString(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  isCheck=Boolean.parseBoolean(preferenceValue);
  String temp=removeQuotes(fieldName);
  Pattern pattern=Pattern.compile("String_Node_Str");
  Matcher matcher=pattern.matcher(temp);
  Pattern pattern2=Pattern.compile("String_Node_Str");
  Matcher matcher2=pattern2.matcher(temp);
  boolean isSqlKeyword=KeywordsValidator.isSqlKeyword(temp,name.getProduct());
  boolean isH2=EDatabaseTypeName.H2 == name;
  if (((!matcher.matches() || matcher2.matches() || isSqlKeyword) && !isH2 && EDatabaseTypeName.SAS != name && EDatabaseTypeName.IMPALA != name) || isIBMDB2ContainLowerCase(dbType,fieldName)) {
    isCheck=true;
  }
  if (!isCheck && isPSQLSimilar(name) && !EDatabaseTypeName.MYSQL.equals(name)) {
    return fieldName;
  }
  String newFieldName=fieldName;
  newFieldName=TalendQuoteUtils.addQuotesForSQLString(newFieldName,quote,simple);
  return newFieldName;
}
Program: 130094
Project: 130094
Buggy source:
public TableNode(){
  children=new ArrayList<TableNode>();
}

Fixed version (ground truth):
public TableNode(){
  children=new ArrayList<TableNode>();
  columnDataList=new ArrayList<Object>();
}
Program: 130095
Project: 130095
Buggy source:
private void updateLeafItem(final TreeItem treeItem,boolean promptNeeded,int nodeType){
  if (treeItem == null) {
    return;
  }
  Object data=treeItem.getData();
  if (data != null && data instanceof TableNode) {
    treeItem.setChecked(promptNeeded);
    TableNode tableNode=(TableNode)data;
    if (tableNode.getType() == nodeType) {
      if (promptNeeded) {
        MetadataTable existTable=getExistTable(treeItem.getText(0));
        if (existTable != null) {
          refreshExistItem(existTable,treeItem);
        }
 else {
          treeItem.setText(2,"String_Node_Str");
          treeItem.setText(3,Messages.getString("String_Node_Str"));
          countPending++;
          parentWizardPage.setPageComplete(false);
          refreshTable(treeItem,-1);
        }
      }
 else {
        clearTableItem(treeItem);
        if (treeItem.getText() != null && treeItem.getText().equals(Messages.getString("String_Node_Str"))) {
          countPending--;
        }
      }
    }
 else {
      if (!treeItem.getExpanded()) {
        viewer.expandToLevel(tableNode,1);
      }
      for (      TreeItem colItem : treeItem.getItems()) {
        updateLeafItem(colItem,promptNeeded,nodeType);
      }
    }
  }
}

Fixed version (ground truth):
private void updateLeafItem(final TreeItem treeItem,boolean promptNeeded,int nodeType){
  if (treeItem == null) {
    return;
  }
  Object data=treeItem.getData();
  if (data != null && data instanceof TableNode) {
    treeItem.setChecked(promptNeeded);
    TableNode tableNode=(TableNode)data;
    if (tableNode.getType() == nodeType) {
      if (promptNeeded) {
        MetadataTable existTable=getExistTable(treeItem.getText(0));
        if (existTable != null) {
          refreshExistItem(existTable,treeItem);
        }
 else {
          treeItem.setText(2,"String_Node_Str");
          treeItem.setText(3,Messages.getString("String_Node_Str"));
          refreshColumnData(tableNode,treeItem);
          countPending++;
          parentWizardPage.setPageComplete(false);
          refreshTable(treeItem,-1);
        }
      }
 else {
        clearTableItem(treeItem);
        if (treeItem.getText() != null && treeItem.getText().equals(Messages.getString("String_Node_Str"))) {
          countPending--;
        }
      }
    }
 else {
      if (!treeItem.getExpanded()) {
        viewer.expandToLevel(tableNode,1);
      }
      for (      TreeItem colItem : treeItem.getItems()) {
        updateLeafItem(colItem,promptNeeded,nodeType);
      }
    }
  }
}
Program: 130096
Project: 130096
Buggy source:
@Override public void run(){
  orgomg.cwm.objectmodel.core.Package pack=(orgomg.cwm.objectmodel.core.Package)existTable.eContainer();
  boolean confirm=MessageDialog.openConfirm(Display.getDefault().getActiveShell(),"String_Node_Str","String_Node_Str" + existTable.getLabel() + "String_Node_Str"+ pack.getName()+ "String_Node_Str");
  if (confirm) {
    TreeItem existItem=getExistItem(existTable);
    TableNode existTableItem=getExistCheckedTable((TableNode)item.getData());
    if (existItem == null) {
      if (existTableItem == null) {
        return;
      }
 else {
        clearTableItem(existTableItem,true);
      }
    }
 else {
      clearTableItem(existItem);
      existItem.setChecked(false);
    }
    item.setText(3,Messages.getString("String_Node_Str"));
    countPending++;
    parentWizardPage.setPageComplete(false);
    refreshTable(item,-1);
  }
 else {
    item.setChecked(false);
    boolean hasCheckedItem=false;
    TreeItem parentItem=item.getParentItem();
    if (parentItem != null) {
      for (      TreeItem i : parentItem.getItems()) {
        if (i.getChecked()) {
          hasCheckedItem=true;
          break;
        }
      }
    }
    if (!hasCheckedItem && parentItem != null) {
      parentItem.setChecked(false);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  orgomg.cwm.objectmodel.core.Package pack=(orgomg.cwm.objectmodel.core.Package)existTable.eContainer();
  boolean confirm=MessageDialog.openConfirm(Display.getDefault().getActiveShell(),"String_Node_Str","String_Node_Str" + existTable.getLabel() + "String_Node_Str"+ pack.getName()+ "String_Node_Str");
  if (confirm) {
    TreeItem existItem=getExistItem(existTable);
    TableNode existTableItem=getExistCheckedTable((TableNode)item.getData());
    if (existItem == null) {
      if (existTableItem == null) {
        return;
      }
 else {
        clearTableItem(existTableItem,true);
      }
    }
 else {
      clearTableItem(existItem);
      existItem.setChecked(false);
    }
    item.setText(3,Messages.getString("String_Node_Str"));
    refreshColumnData(existTableItem,item);
    countPending++;
    parentWizardPage.setPageComplete(false);
    refreshTable(item,-1);
  }
 else {
    item.setChecked(false);
    boolean hasCheckedItem=false;
    TreeItem parentItem=item.getParentItem();
    if (parentItem != null) {
      for (      TreeItem i : parentItem.getItems()) {
        if (i.getChecked()) {
          hasCheckedItem=true;
          break;
        }
      }
    }
    if (!hasCheckedItem && parentItem != null) {
      parentItem.setChecked(false);
    }
  }
}
Program: 130102
Project: 130102
Buggy source:
private void refreshItem(TreeItem item){
  if (item != null && item.getData() != null) {
    int type=((TableNode)item.getData()).getType();
    if (type == TableNode.TABLE) {
      item.setChecked(false);
      if (item.getData() != null) {
        TableNode node=(TableNode)item.getData();
        if (isExistTable(node)) {
          item.setChecked(true);
          Integer num=tableColumnNums.get(item.getText(0));
          if (num != null) {
            item.setText(2,num.toString());
            item.setText(3,Messages.getString("String_Node_Str"));
          }
 else {
            refreshTable(item,-1);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void refreshItem(TreeItem item){
  if (item != null && item.getData() != null) {
    int type=((TableNode)item.getData()).getType();
    if (type == TableNode.TABLE) {
      item.setChecked(false);
      if (item.getData() != null) {
        TableNode node=(TableNode)item.getData();
        if (isExistTable(node)) {
          item.setChecked(true);
          Integer num=tableColumnNums.get(item.getText(0));
          if (num != null) {
            item.setText(2,num.toString());
            item.setText(3,Messages.getString("String_Node_Str"));
            refreshColumnData(node,item);
          }
 else {
            refreshTable(item,-1);
          }
        }
      }
    }
  }
}
Program: 130104
Project: 130104
Buggy source:
@Override public void updateUIInThreadIfThread(){
  if (treeItem.isDisposed()) {
    return;
  }
  if (checkConnectionIsDone) {
    treeItem.setText(3,Messages.getString("String_Node_Str"));
    countSuccess++;
  }
 else {
    updateStatus(IStatus.WARNING,Messages.getString("String_Node_Str"));
    new ErrorDialogWidthDetailArea(getShell(),PID,Messages.getString("String_Node_Str"),managerConnection.getMessageException());
  }
  count++;
  updateStatus(IStatus.OK,null);
  parentWizardPage.setPageComplete(threadExecutor.getQueue().isEmpty() && (threadExecutor.getActiveCount() == 0 || countSuccess == countPending));
}

Fixed version (ground truth):
@Override public void updateUIInThreadIfThread(){
  if (treeItem.isDisposed()) {
    return;
  }
  if (checkConnectionIsDone) {
    treeItem.setText(3,Messages.getString("String_Node_Str"));
    countSuccess++;
  }
 else {
    updateStatus(IStatus.WARNING,Messages.getString("String_Node_Str"));
    new ErrorDialogWidthDetailArea(getShell(),PID,Messages.getString("String_Node_Str"),managerConnection.getMessageException());
  }
  refreshColumnData(tableNode,treeItem);
  count++;
  updateStatus(IStatus.OK,null);
  parentWizardPage.setPageComplete(threadExecutor.getQueue().isEmpty() && (threadExecutor.getActiveCount() == 0 || countSuccess == countPending));
}
Program: 130105
Project: 130105
Buggy source:
@Override public String getColumnText(Object element,int columnIndex){
  TableNode tableNode=(TableNode)element;
  int type=tableNode.getType();
switch (columnIndex) {
case 0:
    String value=tableNode.getValue();
  if (value == null) {
    return "String_Node_Str";
  }
return value;
case 1:
if (type == TableNode.CATALOG) {
return "String_Node_Str";
}
 else if (type == TableNode.SCHEMA) {
return "String_Node_Str";
}
 else {
return tableNode.getItemType();
}
default :
return "String_Node_Str";
}
}

Fixed version (ground truth):
@Override public String getColumnText(Object element,int columnIndex){
  TableNode tableNode=(TableNode)element;
  int type=tableNode.getType();
  List<Object> columnData=tableNode.getColumnDataList();
switch (columnIndex) {
case 0:
    String value=tableNode.getValue();
  if (value == null) {
    return "String_Node_Str";
  }
return value;
case 1:
if (type == TableNode.CATALOG) {
return "String_Node_Str";
}
 else if (type == TableNode.SCHEMA) {
return "String_Node_Str";
}
 else {
return tableNode.getItemType();
}
default :
if (columnData != null && columnIndex < columnData.size()) {
Object columnObj=columnData.get(columnIndex);
if (columnObj != null) {
return columnObj.toString();
}
}
return "String_Node_Str";
}
}
Program: 130106
Project: 130106
Buggy source:
private ConnectionUserPerReader(){
  proper=new EncryptedProperties();
  isRead=false;
  path=new Path(Platform.getConfigurationLocation().getURL().getPath()).toFile().getAbsolutePath();
  String tmp=String.valueOf(path.charAt(path.length() - 1));
  if (!tmp.equals(File.separator)) {
    perfile=new File(path + File.separator + perfileName);
  }
 else {
    perfile=new File(path + perfileName);
  }
}

Fixed version (ground truth):
private ConnectionUserPerReader(){
  proper=new EncryptedProperties();
  isRead=false;
  path=new Path(Platform.getInstanceLocation().getURL().getPath()).toFile().getAbsolutePath();
  String tmp=String.valueOf(path.charAt(path.length() - 1));
  if (!tmp.equals(File.separator)) {
    perfile=new File(path + File.separator + perfileName);
  }
 else {
    perfile=new File(path + perfileName);
  }
}
Program: 130108
Project: 130108
Buggy source:
public static boolean isSchemaFromSidOrDatabase(EDatabaseTypeName inType){
  if (EDatabaseTypeName.TERADATA.equals(inType) || EDatabaseTypeName.IMPALA.equals(inType)) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public static boolean isSchemaFromSidOrDatabase(EDatabaseTypeName inType){
  if (EDatabaseTypeName.TERADATA.equals(inType) || EDatabaseTypeName.IMPALA.equals(inType) || EDatabaseTypeName.AS400.equals(inType)) {
    return true;
  }
 else {
    return false;
  }
}
Program: 130111
Project: 130111
Buggy source:
@Override public boolean isValidForDataViewer(IMetadataTable metadataTable){
  return true;
}

Fixed version (ground truth):
@Override public boolean isValidForDataViewer(Connection connection,IMetadataTable metadataTable){
  if (!canHandle(connection)) {
    return false;
  }
  return true;
}
Program: 130112
Project: 130112
Buggy source:
/** 
 * DOC ycbai Comment method "isValidForDataViewer". <p> Check if the table can do data viewer.
 * @param metadataTable
 * @return
 */
public boolean isValidForDataViewer(IMetadataTable metadataTable);

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "isValidForDataViewer". <p> Check if the table can do data viewer.
 * @param connection
 * @param metadataTable
 * @return
 */
public boolean isValidForDataViewer(Connection connection,IMetadataTable metadataTable);
Program: 130113
Project: 130113
Buggy source:
@Override public boolean isValidForDataViewer(IMetadataTable metadataTable){
  return true;
}

Fixed version (ground truth):
@Override public boolean isValidForDataViewer(Connection connection,IMetadataTable metadataTable){
  if (!canHandle(connection)) {
    return false;
  }
  return true;
}
Program: 130114
Project: 130114
Buggy source:
public boolean hasChildren(Object element){
  if (element instanceof SheetNode) {
    return ((SheetNode)element).getChildren() != null && ((SheetNode)element).getChildren().size() > 0;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean hasChildren(Object element){
  if (element instanceof SheetNode) {
    return ((SheetNode)element).getChildren() != null && ((SheetNode)element).getChildren().size() > 0;
  }
  return false;
}
Program: 130115
Project: 130115
Buggy source:
@SuppressWarnings("String_Node_Str") public void run(){
  disposeExistColumns();
  final List<String[]> input=excelReader.readSheet(sheetName);
  if (input == null) {
    viewer.setInput(getEmptyInput());
    return;
  }
  int maxLength=0;
  for (int i=0, z=input.size(); i < z; i++) {
    int x=input.get(i).length;
    if (x > maxLength) {
      maxLength=x;
    }
  }
  String[] names=ExcelReader.getColumnsTitle(maxLength);
  List columns=getConnection().getSheetColumns();
  columns.clear();
  for (  String name : names) {
    columns.add(name);
    TableColumn tableColumn=new TableColumn(viewer.getTable(),SWT.NONE);
    tableColumn.setText(name);
    tableColumn.setWidth(WIDTH);
  }
  viewer.setInput(input);
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public void run(){
  disposeExistColumns();
  final List<String[]> input=excelReader.readSheet(sheetName);
  if (input == null) {
    viewer.setInput(getEmptyInput());
    return;
  }
  int maxLength=0;
  for (int i=0, z=input.size(); i < z; i++) {
    int x=input.get(i).length;
    if (x > maxLength) {
      maxLength=x;
    }
  }
  String[] names=ExcelReader.getColumnsTitle(maxLength);
  List columns=getConnection().getSheetColumns();
  columns.clear();
  for (  String name : names) {
    columns.add(name);
    TableColumn tableColumn=new TableColumn(viewer.getTable(),SWT.NONE);
    tableColumn.setText(name);
    tableColumn.setWidth(WIDTH);
  }
  viewer.setInput(input);
}
Program: 130116
Project: 130116
Buggy source:
private void addTreeListener(){
  sheetViewer.addCheckStateListener(new ICheckStateListener(){
    public void checkStateChanged(    CheckStateChangedEvent event){
      fillSheetList();
      checkFieldsValue();
    }
  }
);
}

Fixed version (ground truth):
private void addTreeListener(){
  sheetViewer.addCheckStateListener(new ICheckStateListener(){
    @Override public void checkStateChanged(    CheckStateChangedEvent event){
      fillSheetList();
      checkFieldsValue();
    }
  }
);
}
Program: 130117
Project: 130117
Buggy source:
public String getColumnText(Object element,int columnIndex){
  if (element instanceof String[]) {
    try {
      return ((String[])element)[columnIndex];
    }
 catch (    Exception e) {
      return "String_Node_Str";
    }
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String getColumnText(Object element,int columnIndex){
  if (element instanceof String[]) {
    try {
      return ((String[])element)[columnIndex];
    }
 catch (    Exception e) {
      return "String_Node_Str";
    }
  }
  return "String_Node_Str";
}
Program: 130118
Project: 130118
Buggy source:
public void inputChanged(Viewer viewer,Object oldInput,Object newInput){
}

Fixed version (ground truth):
@Override public void inputChanged(Viewer viewer,Object oldInput,Object newInput){
}
Program: 130119
Project: 130119
Buggy source:
public void addListener(ILabelProviderListener listener){
}

Fixed version (ground truth):
@Override public void addListener(ILabelProviderListener listener){
}
Program: 130120
Project: 130120
Buggy source:
public void setVisible(boolean visible){
  super.setVisible(visible);
  if (isReadOnly() != readOnly) {
    adaptFormToReadOnly();
  }
  if (visible) {
    initAllParameters();
    initTreeSelectStates();
    checkFieldsValue();
  }
}

Fixed version (ground truth):
@Override public void setVisible(boolean visible){
  super.setVisible(visible);
  if (isReadOnly() != readOnly) {
    adaptFormToReadOnly();
  }
  if (visible) {
    initAllParameters();
    initTreeSelectStates();
    checkFieldsValue();
  }
}
Program: 130121
Project: 130121
Buggy source:
public void widgetSelected(final SelectionEvent e){
  getShell().close();
}

Fixed version (ground truth):
@Override public void widgetSelected(final SelectionEvent e){
  getShell().close();
}
Program: 130123
Project: 130123
Buggy source:
@Override protected boolean checkFieldsValue(){
  if (!isContextMode()) {
    fileField.setEditable(true);
  }
  if (fileField.getText() == "String_Node_Str") {
    updateStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
    return false;
  }
  String modeText=modeCombo.getText();
  if (!(modeText.equals("String_Node_Str") || modeText.equals("String_Node_Str"))) {
    updateStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
    return false;
  }
  if (!getConnection().isSelectAllSheets() && !isContextMode()) {
    if (getConnection().getSheetList() == null || getConnection().getSheetList().size() <= 0) {
      updateStatus(IStatus.ERROR,"String_Node_Str");
      return false;
    }
  }
  updateStatus(IStatus.OK,null);
  return true;
}

Fixed version (ground truth):
@Override protected boolean checkFieldsValue(){
  if (!isContextMode()) {
    fileField.setEditable(true);
  }
  if (!errorSet.isEmpty()) {
    return false;
  }
  if (fileField.getText() == "String_Node_Str") {
    updateStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
    return false;
  }
  String modeText=modeCombo.getText();
  if (!(modeText.equals("String_Node_Str") || modeText.equals("String_Node_Str"))) {
    updateStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
    return false;
  }
  if (!isContextMode()) {
    Object elements[]=sheetViewer.getCheckedElements();
    if (elements == null || elements.length <= 0) {
      updateStatus(IStatus.ERROR,"String_Node_Str");
      return false;
    }
  }
  updateStatus(IStatus.OK,null);
  return true;
}
Program: 130124
Project: 130124
Buggy source:
public String getText(Object element){
  if (element instanceof SheetNode) {
    return ((SheetNode)element).getLabel();
  }
  return null;
}

Fixed version (ground truth):
@Override public String getText(Object element){
  if (element instanceof SheetNode) {
    return ((SheetNode)element).getLabel();
  }
  return null;
}
Program: 130125
Project: 130125
Buggy source:
public void removeListener(ILabelProviderListener listener){
}

Fixed version (ground truth):
@Override public void removeListener(ILabelProviderListener listener){
}
Program: 130126
Project: 130126
Buggy source:
@Override protected void addUtilsButtonListeners(){
  if (!isInWizard()) {
    cancelButton.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      final SelectionEvent e){
        getShell().close();
      }
    }
);
  }
}

Fixed version (ground truth):
@Override protected void addUtilsButtonListeners(){
  if (!isInWizard()) {
    cancelButton.addSelectionListener(new SelectionAdapter(){
      @Override public void widgetSelected(      final SelectionEvent e){
        getShell().close();
      }
    }
);
  }
}
Program: 130128
Project: 130128
Buggy source:
public Image getColumnImage(Object element,int columnIndex){
  return null;
}

Fixed version (ground truth):
@Override public Image getColumnImage(Object element,int columnIndex){
  return null;
}
Program: 130131
Project: 130131
Buggy source:
public Object[] getElements(Object inputElement){
  if (inputElement instanceof List) {
    return ((List)inputElement).toArray();
  }
  return null;
}

Fixed version (ground truth):
@Override public Object[] getElements(Object inputElement){
  if (inputElement instanceof List) {
    return ((List)inputElement).toArray();
  }
  return null;
}
Program: 130132
Project: 130132
Buggy source:
public void dispose(){
}

Fixed version (ground truth):
@Override public void dispose(){
}
Program: 130133
Project: 130133
Buggy source:
public void checkStateChanged(CheckStateChangedEvent event){
  fillSheetList();
  checkFieldsValue();
}

Fixed version (ground truth):
@Override public void checkStateChanged(CheckStateChangedEvent event){
  fillSheetList();
  checkFieldsValue();
}
Program: 130134
Project: 130134
Buggy source:
public Image getImage(Object element){
  return null;
}

Fixed version (ground truth):
@Override public Image getImage(Object element){
  return null;
}
Program: 130135
Project: 130135
Buggy source:
public boolean isLabelProperty(Object element,String property){
  return true;
}

Fixed version (ground truth):
@Override public boolean isLabelProperty(Object element,String property){
  return true;
}
Program: 130136
Project: 130136
Buggy source:
@Override protected IStatus run(IProgressMonitor monitor){
  try {
    futureTask.get();
  }
 catch (  Exception e) {
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
@Override protected IStatus run(IProgressMonitor monitor){
  try {
    futureTask.get();
  }
 catch (  Throwable e) {
  }
  return Status.OK_STATUS;
}
Program: 130137
Project: 130137
Buggy source:
abstract protected T runWithCancel(IProgressMonitor monitor) throws Exception ;

Fixed version (ground truth):
abstract protected T runWithCancel(IProgressMonitor monitor) throws Throwable ;
Program: 130138
Project: 130138
Buggy source:
@Override protected ResourcesManager runWithCancel(IProgressMonitor monitor) throws Exception {
  return fileUnityManager.doUnify(true);
}

Fixed version (ground truth):
@Override protected ResourcesManager runWithCancel(IProgressMonitor monitor) throws Throwable {
  return fileUnityManager.doUnify(true);
}
Program: 130141
Project: 130141
Buggy source:
@Override protected Boolean runWithCancel(IProgressMonitor monitor) throws Exception {
  return managerConnection.check(retProposedSchema);
}

Fixed version (ground truth):
@Override protected Boolean runWithCancel(IProgressMonitor monitor) throws Throwable {
  return managerConnection.check(retProposedSchema);
}
Program: 130142
Project: 130142
Buggy source:
public static void copyFolder(File resFolder,File destFolder){
  try {
    if (!resFolder.exists()) {
      return;
    }
    destFolder.mkdirs();
    String[] file=resFolder.list();
    File temp=null;
    for (    String element : file) {
      temp=new File(resFolder,element);
      if (temp.isFile()) {
        FileInputStream input=new FileInputStream(temp);
        FileOutputStream output=new FileOutputStream(new File(destFolder,temp.getName()));
        byte[] b=new byte[1024 * 5];
        int len;
        while ((len=input.read(b)) != -1) {
          output.write(b,0,len);
        }
        output.flush();
        output.close();
        input.close();
      }
      if (temp.isDirectory()) {
        copyFolder(new File(resFolder,element),new File(destFolder,element));
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
public static void copyFolder(File resFolder,File destFolder,boolean interruptable) throws Exception {
  Thread currentThread=Thread.currentThread();
  if (interruptable && currentThread.isInterrupted()) {
    throw new InterruptedException();
  }
  if (!resFolder.exists()) {
    return;
  }
  destFolder.mkdirs();
  String[] file=resFolder.list();
  File temp=null;
  for (  String element : file) {
    if (interruptable && currentThread.isInterrupted()) {
      throw new InterruptedException();
    }
    temp=new File(resFolder,element);
    if (temp.isFile()) {
      FileInputStream input=new FileInputStream(temp);
      FileOutputStream output=new FileOutputStream(new File(destFolder,temp.getName()));
      byte[] b=new byte[1024 * 5];
      int len;
      while ((len=input.read(b)) != -1) {
        if (interruptable && currentThread.isInterrupted()) {
          break;
        }
        output.write(b,0,len);
      }
      output.flush();
      output.close();
      input.close();
    }
    if (temp.isDirectory()) {
      copyFolder(new File(resFolder,element),new File(destFolder,element));
    }
  }
}
Program: 130144
Project: 130144
Buggy source:
private void decompress(ResourcesManager srcManager,File destRootFolder) throws IOException {
  Set<IPath> paths=srcManager.getPaths();
  for (  IPath path : paths) {
    InputStream bis=srcManager.getStream(path);
    File destFile=new File(destRootFolder,path.toPortableString());
    File parentFile=destFile.getParentFile();
    if (!parentFile.exists()) {
      parentFile.mkdirs();
    }
    BufferedOutputStream bos=null;
    try {
      bos=new BufferedOutputStream(new FileOutputStream(destFile),BUFFER_SIZE);
      int count;
      byte data[]=new byte[BUFFER_SIZE];
      while ((count=bis.read(data,0,BUFFER_SIZE)) != -1) {
        bos.write(data,0,count);
      }
    }
  finally {
      if (bos != null) {
        bos.flush();
        bos.close();
      }
      bis.close();
    }
  }
}

Fixed version (ground truth):
private void decompress(ResourcesManager srcManager,File destRootFolder,boolean interrupable) throws IOException {
  Set<IPath> paths=srcManager.getPaths();
  Thread currentThread=Thread.currentThread();
  try {
    for (    IPath path : paths) {
      if (interrupable && currentThread.isInterrupted()) {
        throw new InterruptedException();
      }
      InputStream bis=srcManager.getStream(path);
      File destFile=new File(destRootFolder,path.toPortableString());
      File parentFile=destFile.getParentFile();
      if (!parentFile.exists()) {
        parentFile.mkdirs();
      }
      BufferedOutputStream bos=null;
      try {
        bos=new BufferedOutputStream(new FileOutputStream(destFile),BUFFER_SIZE);
        int count;
        byte data[]=new byte[BUFFER_SIZE];
        while ((count=bis.read(data,0,BUFFER_SIZE)) != -1) {
          if (interrupable && currentThread.isInterrupted()) {
            break;
          }
          bos.write(data,0,count);
        }
      }
  finally {
        if (bos != null) {
          bos.flush();
          bos.close();
        }
        bis.close();
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}
Program: 130145
Project: 130145
Buggy source:
private boolean doCollectItemFiles(File directory){
  File[] contents=directory.listFiles();
  if (contents != null) {
    for (    File content : contents) {
      File file=content;
      if (file.isFile()) {
        add(file.getAbsolutePath(),file);
      }
      if (file.isDirectory()) {
        if ((!FilesUtils.isSVNFolder(file))) {
          collectPath2Object(content);
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean doCollectItemFiles(File directory,boolean interruptable){
  File[] contents=directory.listFiles();
  Thread currentThread=Thread.currentThread();
  if (contents != null) {
    for (    File content : contents) {
      if (interruptable && currentThread.isInterrupted()) {
        return false;
      }
      File file=content;
      if (file.isFile()) {
        add(file.getAbsolutePath(),file);
      }
      if (file.isDirectory()) {
        if ((!FilesUtils.isSVNFolder(file))) {
          collectPath2Object(content);
        }
      }
    }
  }
  return true;
}
Program: 130146
Project: 130146
Buggy source:
@Override public boolean collectPath2Object(Object root){
  return doCollectItemFiles((File)root);
}

Fixed version (ground truth):
public boolean collectPath2Object(Object root,boolean interruptable){
  if (interruptable && Thread.currentThread().isInterrupted()) {
    return false;
  }
  return doCollectItemFiles((File)root,interruptable);
}
Program: 130147
Project: 130147
Buggy source:
public static void copyFolder(File resFolder,File destFolder,boolean interruptable) throws Exception {
  Thread currentThread=Thread.currentThread();
  if (interruptable && currentThread.isInterrupted()) {
    throw new InterruptedException();
  }
  if (!resFolder.exists()) {
    return;
  }
  destFolder.mkdirs();
  String[] file=resFolder.list();
  File temp=null;
  for (  String element : file) {
    if (interruptable && currentThread.isInterrupted()) {
      throw new InterruptedException();
    }
    temp=new File(resFolder,element);
    if (temp.isFile()) {
      FileInputStream input=new FileInputStream(temp);
      FileOutputStream output=new FileOutputStream(new File(destFolder,temp.getName()));
      byte[] b=new byte[1024 * 5];
      int len;
      while ((len=input.read(b)) != -1) {
        if (interruptable && currentThread.isInterrupted()) {
          break;
        }
        output.write(b,0,len);
      }
      output.flush();
      output.close();
      input.close();
    }
    if (temp.isDirectory()) {
      copyFolder(new File(resFolder,element),new File(destFolder,element));
    }
  }
}

Fixed version (ground truth):
public static void copyFolder(File resFolder,File destFolder,boolean interruptable) throws Exception {
  Thread currentThread=Thread.currentThread();
  if (interruptable && currentThread.isInterrupted()) {
    throw new InterruptedException();
  }
  if (!resFolder.exists()) {
    return;
  }
  destFolder.mkdirs();
  String[] file=resFolder.list();
  File temp=null;
  for (  String element : file) {
    if (interruptable && currentThread.isInterrupted()) {
      throw new InterruptedException();
    }
    temp=new File(resFolder,element);
    if (temp.isFile()) {
      FileInputStream input=new FileInputStream(temp);
      FileOutputStream output=new FileOutputStream(new File(destFolder,temp.getName()));
      byte[] b=new byte[1024 * 5];
      int len;
      while ((len=input.read(b)) != -1) {
        if (interruptable && currentThread.isInterrupted()) {
          break;
        }
        output.write(b,0,len);
      }
      output.flush();
      output.close();
      input.close();
    }
    if (temp.isDirectory()) {
      copyFolder(new File(resFolder,element),new File(destFolder,element),interruptable);
    }
  }
}
Program: 130148
Project: 130148
Buggy source:
private boolean doCollectItemFiles(File directory,boolean interruptable){
  File[] contents=directory.listFiles();
  Thread currentThread=Thread.currentThread();
  if (contents != null) {
    for (    File content : contents) {
      if (interruptable && currentThread.isInterrupted()) {
        return false;
      }
      File file=content;
      if (file.isFile()) {
        add(file.getAbsolutePath(),file);
      }
      if (file.isDirectory()) {
        if ((!FilesUtils.isSVNFolder(file))) {
          collectPath2Object(content);
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean doCollectItemFiles(File directory,boolean interruptable){
  File[] contents=directory.listFiles();
  Thread currentThread=Thread.currentThread();
  if (contents != null) {
    for (    File content : contents) {
      if (interruptable && currentThread.isInterrupted()) {
        return false;
      }
      File file=content;
      if (file.isFile()) {
        add(file.getAbsolutePath(),file);
      }
      if (file.isDirectory()) {
        if ((!FilesUtils.isSVNFolder(file))) {
          collectPath2Object(content,interruptable);
        }
      }
    }
  }
  return true;
}
Program: 130150
Project: 130150
Buggy source:
public boolean hasChildren(Object element){
  return ((Folder)element).getChildren().size() > 0;
}

Fixed version (ground truth):
@Override public boolean hasChildren(Object element){
  return ((Folder)element).getChildren().size() > 0;
}
Program: 130151
Project: 130151
Buggy source:
public void run(){
  evaluateTextField();
}

Fixed version (ground truth):
@Override public void run(){
  evaluateTextField();
}
Program: 130153
Project: 130153
Buggy source:
public Object[] getChildren(Object parentElement){
  return ((Folder)parentElement).getChildren().toArray();
}

Fixed version (ground truth):
@Override public Object[] getChildren(Object parentElement){
  return ((Folder)parentElement).getChildren().toArray();
}
Program: 130154
Project: 130154
Buggy source:
public void modifyText(ModifyEvent e){
  property.setStatusCode(statusHelper.getStatusCode(statusText.getText()));
  property.setModificationDate(new Date());
  updatePageStatus();
}

Fixed version (ground truth):
@Override public void modifyText(ModifyEvent e){
  property.setStatusCode(statusHelper.getStatusCode(statusText.getText()));
  property.setModificationDate(new Date());
  updatePageStatus();
}
Program: 130155
Project: 130155
Buggy source:
public Object[] getElements(Object inputElement){
  ERepositoryObjectType type=(ERepositoryObjectType)inputElement;
  IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  try {
    List<String> folders=factory.getFolders(type);
    Collections.sort(folders);
    Folder root=formdFolderTree(folders);
    return new Folder[]{root};
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
    return new String[0];
  }
}

Fixed version (ground truth):
@Override public Object[] getElements(Object inputElement){
  ERepositoryObjectType type=(ERepositoryObjectType)inputElement;
  IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  try {
    List<String> folders=factory.getFolders(type);
    Collections.sort(folders);
    Folder root=formdFolderTree(folders);
    return new Folder[]{root};
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
    return new String[0];
  }
}
Program: 130156
Project: 130156
Buggy source:
public void dispose(){
}

Fixed version (ground truth):
@Override public void dispose(){
}