nus-yam/ex-repair huggingface dataset:
Program: 137993
Project: 137993
Buggy source:
/** 
 * remove the report node (remove the report generate doc folder also).
 * @param sourceNode
 * @param targetNode
 * @throws PersistenceException
 */
private void moveReportRepNode(IRepositoryNode sourceNode,IRepositoryNode targetNode) throws PersistenceException {
  relocateJrxmlTemplates(sourceNode,targetNode);
  IFolder outputFolder=ReportUtils.getOutputFolder((ReportRepNode)sourceNode);
  File sourceFile=WorkspaceUtils.ifolderToFile(outputFolder);
  IRepositoryViewObject objectToMove=sourceNode.getObject();
  IPath fullPath=ResourceManager.getReportsFolder().getFullPath();
  if (targetNode.getType() == ENodeType.SIMPLE_FOLDER) {
    moveObject(objectToMove,sourceNode,targetNode,fullPath.makeRelativeTo(ResourceManager.getRootProject().getFullPath()));
  }
 else   if (targetNode.getType() == ENodeType.SYSTEM_FOLDER) {
    moveObject(objectToMove,sourceNode,targetNode,Path.EMPTY);
  }
  IFolder targetFolder=RepositoryNodeHelper.getIFolder(targetNode);
  File targetFile=WorkspaceUtils.ifolderToFile(targetFolder);
  FilesUtils.copyDirectory(sourceFile,targetFile);
  FilesUtils.deleteFile(sourceFile,true);
  ReportUtils.updateReportListFile(outputFolder,targetFolder);
  CorePlugin.getDefault().refreshDQView(targetNode.getParent());
}

Fixed version (ground truth):
/** 
 * remove the report node (remove the report generate doc folder also).
 * @param sourceNode
 * @param targetNode
 * @throws PersistenceException
 */
private void moveReportRepNode(IRepositoryNode sourceNode,IRepositoryNode targetNode) throws PersistenceException {
  relocateJrxmlTemplates(sourceNode,targetNode);
  IFolder outputFolder=ReportUtils.getOutputFolder((ReportRepNode)sourceNode);
  File sourceFile=WorkspaceUtils.ifolderToFile(outputFolder);
  IRepositoryViewObject objectToMove=sourceNode.getObject();
  IPath fullPath=ResourceManager.getReportsFolder().getFullPath();
  if (targetNode.getType() == ENodeType.SIMPLE_FOLDER) {
    moveObject(objectToMove,sourceNode,targetNode,fullPath.makeRelativeTo(ResourceManager.getRootProject().getFullPath()));
  }
 else   if (targetNode.getType() == ENodeType.SYSTEM_FOLDER) {
    moveObject(objectToMove,sourceNode,targetNode,Path.EMPTY);
  }
  IFolder targetFolder=RepositoryNodeHelper.getIFolder(targetNode);
  if (targetFolder != null) {
    File targetFile=WorkspaceUtils.ifolderToFile(targetFolder);
    FilesUtils.copyDirectory(sourceFile,targetFile);
    FilesUtils.deleteFile(sourceFile,true);
    ReportUtils.updateReportListFile(outputFolder,targetFolder);
    CorePlugin.getDefault().refreshDQView(targetNode.getParent());
  }
}
Program: 137994
Project: 137994
Buggy source:
/** 
 * update the file .report.list to deal with the report generated doc folder's movement.
 * @param outputFolder source folder, the original report generated doc folder
 * @param targetFolder target folder, the new folder which source folder moved into
 */
public static void updateReportListFile(IFolder outputFolder,IFolder targetFolder){
  try {
    File oldFolder=WorkspaceUtils.ifolderToFile(outputFolder);
    File newFolder=WorkspaceUtils.ifolderToFile(targetFolder.getFolder(outputFolder.getName()));
    File file=new File(newFolder.getAbsolutePath() + File.separator + ReportUtils.REPORT_LIST);
    if (file.exists() && file.isFile()) {
      String str1=oldFolder.toString();
      String str2=newFolder.toString();
      str1=StringUtils.replace(str1,"String_Node_Str","String_Node_Str");
      str2=StringUtils.replace(str2,"String_Node_Str","String_Node_Str");
      FilesUtils.replaceInFile(str1,file.toString(),str2);
    }
  }
 catch (  Exception e) {
    log.warn(e,e);
  }
}

Fixed version (ground truth):
/** 
 * update the file .report.list to deal with the report generated doc folder's movement.
 * @param outputFolder source folder, the original report generated doc folder
 * @param targetFolder target folder, the new folder which source folder moved into
 */
public static void updateReportListFile(IFolder outputFolder,IFolder targetFolder){
  try {
    File oldFolder=WorkspaceUtils.ifolderToFile(outputFolder);
    File newFolder=WorkspaceUtils.ifolderToFile(targetFolder.getFolder(outputFolder.getName()));
    File file=new File(newFolder.getAbsolutePath() + File.separator + ReportUtils.REPORT_LIST);
    if (file.exists() && file.isFile()) {
      replaceReportGenDocFilePath(file,oldFolder.toString(),newFolder.toString());
    }
  }
 catch (  Exception e) {
    log.warn(e,e);
  }
}
Program: 137995
Project: 137995
Buggy source:
/** 
 * if the report's name changed, need to update the report folder name also.
 * @param oldFolderName
 * @param repItem
 */
public static void checkAndUpdateRepFolderName4Rename(String oldFolderName,TDQReportItem repItem){
  String newFolderName=ReportUtils.getSimpleName(repItem.getProperty());
  if (!oldFolderName.equals(newFolderName)) {
    IContainer repItemParent=PropertyHelper.getItemFile(repItem.getProperty()).getParent();
    File oldFolder=WorkspaceUtils.ifolderToFile(repItemParent.getFolder(Path.fromPortableString(PluginConstant.DOT_STRING + oldFolderName)));
    File newFolder=WorkspaceUtils.ifolderToFile(repItemParent.getFolder(Path.fromPortableString(PluginConstant.DOT_STRING + newFolderName)));
    try {
      oldFolder.renameTo(newFolder);
      File file=new File(ReportHelper.getOutputFolderNameDefault((IFolder)repItemParent,newFolderName) + File.separator + REPORT_LIST);
      if (file.exists() && file.isFile()) {
        FilesUtils.replaceInFile(oldFolder.toString(),file.toString(),newFolder.toString());
      }
      repItemParent.refreshLocal(IResource.DEPTH_INFINITE,null);
    }
 catch (    Exception e) {
      log.warn(e,e);
    }
  }
}

Fixed version (ground truth):
/** 
 * if the report's name changed, need to update the report folder name also.
 * @param parentFolder
 * @param oldFolderName
 * @param repItem
 */
public static void checkAndUpdateRepFolderName4Rename(IFolder parentFolder,String oldFolderName,TDQReportItem repItem){
  String newFolderName=ReportUtils.getSimpleName(repItem.getProperty());
  if (!oldFolderName.equals(newFolderName)) {
    File oldFolder=WorkspaceUtils.ifolderToFile(parentFolder.getFolder(Path.fromPortableString(PluginConstant.DOT_STRING + oldFolderName)));
    File newFolder=WorkspaceUtils.ifolderToFile(parentFolder.getFolder(Path.fromPortableString(PluginConstant.DOT_STRING + newFolderName)));
    try {
      oldFolder.renameTo(newFolder);
      File file=new File(ReportHelper.getOutputFolderNameDefault(parentFolder,newFolderName) + File.separator + REPORT_LIST);
      if (file.exists() && file.isFile()) {
        replaceReportGenDocFilePath(file,oldFolder.toString(),newFolder.toString());
      }
      parentFolder.refreshLocal(IResource.DEPTH_INFINITE,null);
    }
 catch (    Exception e) {
      log.warn(e,e);
    }
  }
}
Program: 137996
Project: 137996
Buggy source:
public static IFolder fileToIFolder(File file){
  IFolder folder=null;
  String filePath=file.getAbsolutePath();
  String rootPath=ResourcesPlugin.getWorkspace().getRoot().getLocationURI().getPath();
  if (filePath.startsWith(rootPath)) {
    folder=ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(filePath.substring(rootPath.length(),filePath.length())));
  }
  return folder;
}

Fixed version (ground truth):
public static IFolder fileToIFolder(File file){
  IFolder folder=null;
  String filePath=file.getAbsolutePath();
  String rootPath=ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
  if (filePath.startsWith(rootPath)) {
    folder=ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(filePath.substring(rootPath.length(),filePath.length())));
  }
  return folder;
}
Program: 137997
Project: 137997
Buggy source:
/** 
 * physical delete related.
 * @param item
 */
public static ReturnCode deleteRelations(Item item){
  ReturnCode rc=new ReturnCode(Boolean.TRUE);
  if (item == null || item.getProperty() == null || item instanceof FolderItem) {
    rc.setOk(Boolean.FALSE);
    return rc;
  }
  IFile itemFile=PropertyHelper.getItemFile(item.getProperty());
  if (itemFile == null || itemFile.exists()) {
    rc.setOk(Boolean.FALSE);
    return rc;
  }
  if (item instanceof TDQReportItem) {
    return deleteRepOutputFolder(itemFile);
  }
  return rc;
}

Fixed version (ground truth):
/** 
 * physical delete related.
 * @param item
 */
public static ReturnCode deleteRelations(Item item){
  ReturnCode rc=new ReturnCode(Boolean.TRUE);
  if (item == null || item.getProperty() == null || item instanceof FolderItem) {
    rc.setOk(Boolean.FALSE);
    return rc;
  }
  IFile itemFile=PropertyHelper.getItemFile(item.getProperty());
  if (itemFile == null || itemFile.exists()) {
    rc.setOk(Boolean.FALSE);
    return rc;
  }
  if (item instanceof TDQReportItem) {
    return ReportUtils.deleteRepOutputFolder(itemFile);
  }
  return rc;
}
Program: 137999
Project: 137999
Buggy source:
@Override protected String getFileExtension(){
  return null;
}

Fixed version (ground truth):
@Override protected String getFileExtension(){
  return "String_Node_Str";
}
Program: 138000
Project: 138000
Buggy source:
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
@Override protected EClass eStaticClass(){
  return PropertiesPackage.Literals.TDQ_SOURCE_FILE_ITEM;
}

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
@Override protected EClass eStaticClass(){
  return org.talend.dataquality.properties.PropertiesPackage.Literals.TDQ_SOURCE_FILE_ITEM;
}
Program: 138001
Project: 138001
Buggy source:
public static TypedReturnCode<Connection> getRefreshedDataProvider(Connection prevDataProvider){
  TypedReturnCode<Connection> returnProvider=new TypedReturnCode<Connection>();
  boolean mdm=ConnectionUtils.isMdmConnection(prevDataProvider);
  IMetadataConnection metadataConnection=ConvertionHelper.convert(prevDataProvider);
  Connection conn=null;
  if (mdm) {
    conn=MetadataFillFactory.getMDMInstance().fillUIConnParams(metadataConnection,null);
    MetadataFillFactory.getMDMInstance().fillSchemas(conn,null,null);
  }
 else {
    TypedReturnCode<?> trc=(TypedReturnCode<?>)MetadataFillFactory.getDBInstance().checkConnection(metadataConnection);
    Object sqlConnObject=trc.getObject();
    DatabaseMetaData dbJDBCMetadata=null;
    if (trc.isOk() && sqlConnObject instanceof java.sql.Connection) {
      java.sql.Connection sqlConn=(java.sql.Connection)sqlConnObject;
      try {
        dbJDBCMetadata=ExtractMetaDataUtils.getConnectionMetadata(sqlConn);
      }
 catch (      SQLException e) {
        log.error(e,e);
      }
    }
    conn=MetadataFillFactory.getDBInstance().fillUIConnParams(metadataConnection,null);
    MetadataFillFactory.getDBInstance().fillCatalogs(conn,dbJDBCMetadata,null);
    MetadataFillFactory.getDBInstance().fillSchemas(conn,dbJDBCMetadata,null);
  }
  if (conn == null) {
    returnProvider.setOk(false);
  }
 else {
    returnProvider.setObject(conn);
  }
  return returnProvider;
}

Fixed version (ground truth):
public static TypedReturnCode<Connection> getRefreshedDataProvider(Connection prevDataProvider){
  TypedReturnCode<Connection> returnProvider=new TypedReturnCode<Connection>();
  boolean mdm=ConnectionUtils.isMdmConnection(prevDataProvider);
  List<String> packageFilter=null;
  IMetadataConnection metadataConnection=ConvertionHelper.convert(prevDataProvider);
  Connection conn=null;
  if (mdm) {
    conn=MetadataFillFactory.getMDMInstance().fillUIConnParams(metadataConnection,null);
    MetadataFillFactory.getMDMInstance().fillSchemas(conn,null,null);
  }
 else {
    TypedReturnCode<?> trc=(TypedReturnCode<?>)MetadataFillFactory.getDBInstance().checkConnection(metadataConnection);
    Object sqlConnObject=trc.getObject();
    DatabaseMetaData dbJDBCMetadata=null;
    if (trc.isOk() && sqlConnObject instanceof java.sql.Connection) {
      java.sql.Connection sqlConn=(java.sql.Connection)sqlConnObject;
      try {
        dbJDBCMetadata=ExtractMetaDataUtils.getConnectionMetadata(sqlConn);
        packageFilter=MetadataConnectionUtils.getPackageFilter(prevDataProvider,dbJDBCMetadata,true);
      }
 catch (      SQLException e) {
        log.error(e,e);
      }
    }
    conn=MetadataFillFactory.getDBInstance().fillUIConnParams(metadataConnection,null);
    MetadataFillFactory.getDBInstance().fillCatalogs(conn,dbJDBCMetadata,packageFilter);
    MetadataFillFactory.getDBInstance().fillSchemas(conn,dbJDBCMetadata,packageFilter);
  }
  if (conn == null) {
    returnProvider.setOk(false);
  }
 else {
    returnProvider.setObject(conn);
  }
  return returnProvider;
}
Program: 138002
Project: 138002
Buggy source:
/** 
 * Test method for   {@link org.talend.dq.helper.DQDeleteHelper#deleteRelations(org.talend.core.model.properties.Item)}.
 */
@Test public void testDeleteRelations(){
  TDQReportItem item=mock(TDQReportItem.class);
  IFile file=mock(IFile.class);
  when(file.exists()).thenReturn(false);
  IFolder folder=mock(IFolder.class);
  when(folder.exists()).thenReturn(true);
  Property prop=mock(Property.class);
  when(item.getProperty()).thenReturn(prop);
  PowerMockito.mockStatic(PropertyHelper.class);
  when(PropertyHelper.getItemFile(prop)).thenReturn(file);
  PowerMockito.mockStatic(ReportHelper.class);
  when(ReportHelper.getOutputFolder(file)).thenReturn(folder);
  DQDeleteHelper.deleteRelations(item);
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.talend.dq.helper.DQDeleteHelper#deleteRelations(org.talend.core.model.properties.Item)}.
 */
@Test public void testDeleteRelations(){
  TDQReportItem item=mock(TDQReportItem.class);
  IFile file=mock(IFile.class);
  when(file.exists()).thenReturn(false);
  IFolder folder=mock(IFolder.class);
  when(folder.exists()).thenReturn(true);
  Property prop=mock(Property.class);
  when(item.getProperty()).thenReturn(prop);
  PowerMockito.mockStatic(PropertyHelper.class);
  when(PropertyHelper.getItemFile(prop)).thenReturn(file);
  PowerMockito.mockStatic(ReportHelper.class);
  when(ReportUtils.getOutputFolder(file)).thenReturn(folder);
  DQDeleteHelper.deleteRelations(item);
}
Program: 138003
Project: 138003
Buggy source:
protected IPath getItemFullPath(TDQSourceFileItem item){
  String statePathStr=null;
  if (item.getState() != null) {
    statePathStr=item.getState().getPath();
    if (!statePathStr.equals("String_Node_Str")) {
      org.eclipse.core.runtime.IPath path=new Path(statePathStr);
      IPath typedPath=ResourceManager.getSourceFileFolder().getLocation();
      if (path.matchingFirstSegments(typedPath) > -1) {
        statePathStr=path.removeFirstSegments(2).toString();
      }
 else {
        statePathStr="String_Node_Str" + statePathStr;
      }
    }
  }
  String fileName=item.getName() + "String_Node_Str" + item.getProperty().getVersion()+ "String_Node_Str"+ item.getExtension();
  IPath typedPath=ResourceManager.getSourceFileFolder().getLocation();
  IPath fullpath=typedPath.append(statePathStr + "String_Node_Str" + fileName);
  return fullpath;
}

Fixed version (ground truth):
protected IPath getItemFullPath(TDQSourceFileItem item){
  String statePathStr=null;
  if (item.getState() != null) {
    statePathStr=item.getState().getPath();
    if (!statePathStr.equals("String_Node_Str")) {
      statePathStr="String_Node_Str" + statePathStr;
    }
  }
  String fileName=item.getName() + "String_Node_Str" + item.getProperty().getVersion()+ "String_Node_Str"+ item.getExtension();
  IPath typedPath=ResourceManager.getSourceFileFolder().getLocation();
  IPath fullpath=typedPath.append(statePathStr + "String_Node_Str" + fileName);
  return fullpath;
}
Program: 138004
Project: 138004
Buggy source:
public static TypedReturnCode<Connection> getRefreshedDataProvider(Connection prevDataProvider){
  TypedReturnCode<Connection> returnProvider=new TypedReturnCode<Connection>();
  boolean mdm=ConnectionUtils.isMdmConnection(prevDataProvider);
  IMetadataConnection metadataConnection=ConvertionHelper.convert(prevDataProvider);
  Connection conn=null;
  if (mdm) {
    conn=MetadataFillFactory.getMDMInstance().fillUIConnParams(metadataConnection,null);
    MetadataFillFactory.getMDMInstance().fillSchemas(conn,null,null);
  }
 else {
    TypedReturnCode<?> trc=(TypedReturnCode<?>)MetadataFillFactory.getDBInstance().checkConnection(metadataConnection);
    Object sqlConnObject=trc.getObject();
    DatabaseMetaData dbJDBCMetadata=null;
    if (trc.isOk() && sqlConnObject instanceof java.sql.Connection) {
      java.sql.Connection sqlConn=(java.sql.Connection)sqlConnObject;
      try {
        dbJDBCMetadata=ExtractMetaDataUtils.getConnectionMetadata(sqlConn);
      }
 catch (      SQLException e) {
        log.error(e,e);
      }
    }
    conn=MetadataFillFactory.getDBInstance().fillUIConnParams(metadataConnection,null);
    MetadataFillFactory.getDBInstance().fillCatalogs(conn,dbJDBCMetadata,null);
    MetadataFillFactory.getDBInstance().fillSchemas(conn,dbJDBCMetadata,null);
  }
  if (conn == null) {
    returnProvider.setOk(false);
  }
 else {
    returnProvider.setObject(conn);
  }
  return returnProvider;
}

Fixed version (ground truth):
public static TypedReturnCode<Connection> getRefreshedDataProvider(Connection prevDataProvider){
  TypedReturnCode<Connection> returnProvider=new TypedReturnCode<Connection>();
  boolean mdm=ConnectionUtils.isMdmConnection(prevDataProvider);
  List<String> packageFilter=null;
  IMetadataConnection metadataConnection=ConvertionHelper.convert(prevDataProvider);
  Connection conn=null;
  if (mdm) {
    conn=MetadataFillFactory.getMDMInstance().fillUIConnParams(metadataConnection,null);
    MetadataFillFactory.getMDMInstance().fillSchemas(conn,null,null);
  }
 else {
    TypedReturnCode<?> trc=(TypedReturnCode<?>)MetadataFillFactory.getDBInstance().checkConnection(metadataConnection);
    Object sqlConnObject=trc.getObject();
    DatabaseMetaData dbJDBCMetadata=null;
    if (trc.isOk() && sqlConnObject instanceof java.sql.Connection) {
      java.sql.Connection sqlConn=(java.sql.Connection)sqlConnObject;
      try {
        dbJDBCMetadata=ExtractMetaDataUtils.getConnectionMetadata(sqlConn);
        packageFilter=MetadataConnectionUtils.getPackageFilter(prevDataProvider,dbJDBCMetadata,true);
      }
 catch (      SQLException e) {
        log.error(e,e);
      }
    }
    conn=MetadataFillFactory.getDBInstance().fillUIConnParams(metadataConnection,null);
    MetadataFillFactory.getDBInstance().fillCatalogs(conn,dbJDBCMetadata,packageFilter);
    MetadataFillFactory.getDBInstance().fillSchemas(conn,dbJDBCMetadata,packageFilter);
  }
  if (conn == null) {
    returnProvider.setOk(false);
  }
 else {
    returnProvider.setObject(conn);
  }
  return returnProvider;
}
Program: 138005
Project: 138005
Buggy source:
protected IPath getItemFullPath(TDQSourceFileItem item){
  String statePathStr=null;
  if (item.getState() != null) {
    statePathStr=item.getState().getPath();
    if (!statePathStr.equals("String_Node_Str")) {
      statePathStr="String_Node_Str" + statePathStr;
    }
  }
  String fileName=item.getName() + "String_Node_Str" + item.getProperty().getVersion()+ "String_Node_Str"+ item.getExtension();
  IPath typedPath=ResourceManager.getSourceFileFolder().getLocation();
  IPath fullpath=typedPath.append(statePathStr + "String_Node_Str" + fileName);
  return fullpath;
}

Fixed version (ground truth):
protected IPath getItemFullPath(TDQSourceFileItem item){
  String statePathStr=null;
  if (item.getState() != null) {
    statePathStr=item.getState().getPath();
    if (!statePathStr.equals("String_Node_Str")) {
      org.eclipse.core.runtime.IPath path=new Path(statePathStr);
      IPath typedPath=ResourceManager.getSourceFileFolder().getLocation();
      if (path.matchingFirstSegments(typedPath) > -1) {
        statePathStr=path.removeFirstSegments(2).toString();
      }
 else {
        statePathStr="String_Node_Str" + statePathStr;
      }
    }
  }
  String fileName=item.getName() + "String_Node_Str" + item.getProperty().getVersion()+ "String_Node_Str"+ item.getExtension();
  IPath typedPath=ResourceManager.getSourceFileFolder().getLocation();
  IPath fullpath=typedPath.append(statePathStr + "String_Node_Str" + fileName);
  return fullpath;
}
Program: 138006
Project: 138006
Buggy source:
@Override protected void doRun(){
  if (this.node instanceof JrxmlTempSubFolderNode) {
    MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
    return;
  }
  InputDialog dialog=new InputDialog(Display.getDefault().getActiveShell(),DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"),null,new IInputValidator(){
    public String isValid(    String newText){
      return null;
    }
  }
);
  if (dialog.open() == InputDialog.OK) {
    String value2=dialog.getValue();
    try {
      List<IRepositoryNode> openRepNodes=getOpenRepNodeForReName(node,true);
      RepNodeUtils.closeModelElementEditor(openRepNodes,true);
      IPath path=WorkbenchUtils.getPath(node);
      ProxyRepositoryFactory.getInstance().renameFolder(node.getObjectType(),path,value2);
      if (node != null && node.getParent() != null) {
        CorePlugin.getDefault().refreshDQView(node.getParent());
      }
    }
 catch (    PersistenceException e) {
      log.error(e.getMessage());
      MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(),DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"));
    }
  }
}

Fixed version (ground truth):
@Override protected void doRun(){
  if (this.node instanceof JrxmlTempSubFolderNode) {
    MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str"));
    return;
  }
  if (this.node instanceof SourceFileSubFolderNode) {
    ReturnCode rc=WorkspaceResourceHelper.checkSourceFileSubFolderNodeOpening((SourceFileSubFolderNode)node);
    if (rc.isOk()) {
      WorkspaceResourceHelper.showSourceFilesOpeningWarnMessages(rc.getMessage());
      return;
    }
  }
  InputDialog dialog=new InputDialog(Display.getDefault().getActiveShell(),DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"),null,new IInputValidator(){
    public String isValid(    String newText){
      return null;
    }
  }
);
  if (dialog.open() == InputDialog.OK) {
    String value2=dialog.getValue();
    try {
      List<IRepositoryNode> openRepNodes=getOpenRepNodeForReName(node,true);
      RepNodeUtils.closeModelElementEditor(openRepNodes,true);
      IPath path=WorkbenchUtils.getPath(node);
      ProxyRepositoryFactory.getInstance().renameFolder(node.getObjectType(),path,value2);
      if (node != null && node.getParent() != null) {
        CorePlugin.getDefault().refreshDQView(node.getParent());
      }
    }
 catch (    PersistenceException e) {
      log.error(e.getMessage());
      MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(),DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"));
    }
  }
}
Program: 138007
Project: 138007
Buggy source:
/** 
 * Test method for  {@link org.talend.dq.helper.DQDeleteHelper#deleteRelations(org.talend.core.model.properties.Item)}.
 */
@Test public void testDeleteRelations(){
  TDQReportItem item=mock(TDQReportItem.class);
  IFile file=mock(IFile.class);
  when(file.exists()).thenReturn(false);
  IFolder folder=mock(IFolder.class);
  when(folder.exists()).thenReturn(true);
  Property prop=mock(Property.class);
  when(item.getProperty()).thenReturn(prop);
  PowerMockito.mockStatic(PropertyHelper.class);
  when(PropertyHelper.getItemFile(prop)).thenReturn(file);
  PowerMockito.mockStatic(ReportHelper.class);
  when(ReportHelper.getOutputFolder(file)).thenReturn(folder);
  DQDeleteHelper.deleteRelations(item);
}

Fixed version (ground truth):
/** 
 * Test method for  {@link org.talend.dq.helper.DQDeleteHelper#deleteRelations(org.talend.core.model.properties.Item)}.
 */
@Test public void testDeleteRelations(){
  TDQReportItem item=mock(TDQReportItem.class);
  IFile file=mock(IFile.class);
  when(file.exists()).thenReturn(false);
  IFolder folder=mock(IFolder.class);
  when(folder.exists()).thenReturn(true);
  Property prop=mock(Property.class);
  when(item.getProperty()).thenReturn(prop);
  PowerMockito.mockStatic(PropertyHelper.class);
  when(PropertyHelper.getItemFile(prop)).thenReturn(file);
  PowerMockito.mockStatic(ReportHelper.class);
  when(ReportUtils.getOutputFolder(file)).thenReturn(folder);
  DQDeleteHelper.deleteRelations(item);
}
Program: 138008
Project: 138008
Buggy source:
/** 
 * move Source File(close the Source File editor when it's open).
 * @param sourceNode
 * @param targetNode
 * @throws PersistenceException
 */
public void moveSourceFileRepNode(IRepositoryNode sourceNode,IRepositoryNode targetNode) throws PersistenceException {
  if (WorkspaceResourceHelper.sourceFileHasBeenOpened(sourceNode)) {
    MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str",sourceNode.getLabel()));
  }
 else {
    IRepositoryViewObject objectToMove=sourceNode.getObject();
    ERepositoryObjectType targetObjectType=targetNode.getContentType();
    IPath fullPath=ResourceManager.getSourceFileFolder().getFullPath();
    IPath makeRelativeTo=fullPath.makeRelativeTo(ResourceManager.getRootProject().getFullPath());
    ENodeType type=targetNode.getType();
    if (ENodeType.SIMPLE_FOLDER == type || ENodeType.SYSTEM_FOLDER == type) {
      TDQSourceFileItem fileItem=(TDQSourceFileItem)objectToMove.getProperty().getItem();
      String oldPath=ResourceManager.getRootFolderLocation().append(fileItem.eResource().getURI().toPlatformString(true)).toOSString();
      if (oldPath != null) {
        oldPath=StringUtils.removeEnd(oldPath,"String_Node_Str").concat("String_Node_Str");
      }
 else {
        return;
      }
      moveObject(objectToMove,sourceNode,targetNode,makeRelativeTo);
      String newPath=ResourceManager.getRootFolderLocation().append(fileItem.eResource().getURI().toPlatformString(true)).toOSString();
      if (newPath == null) {
        log.error("String_Node_Str");
      }
      File srcFile=new File(oldPath);
      File dtnFile=new File(newPath);
      try {
        FileUtils.copyFileToDirectory(srcFile,dtnFile.getParentFile());
        FileUtils.forceDelete(srcFile);
      }
 catch (      Throwable e) {
        log.error(e.getMessage(),e);
      }
    }
    CorePlugin.getDefault().refreshDQView(targetNode.getParent());
  }
}

Fixed version (ground truth):
/** 
 * move Source File(close the Source File editor when it's open).
 * @param sourceNode
 * @param targetNode
 * @throws PersistenceException
 */
public void moveSourceFileRepNode(IRepositoryNode sourceNode,IRepositoryNode targetNode) throws PersistenceException {
  if (WorkspaceResourceHelper.sourceFileHasBeenOpened(sourceNode)) {
    MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str",sourceNode.getLabel()));
  }
 else {
    IRepositoryViewObject objectToMove=sourceNode.getObject();
    ERepositoryObjectType targetObjectType=targetNode.getContentType();
    IPath fullPath=ResourceManager.getSourceFileFolder().getFullPath();
    IPath makeRelativeTo=fullPath.makeRelativeTo(ResourceManager.getRootProject().getFullPath());
    ENodeType type=targetNode.getType();
    if (ENodeType.SIMPLE_FOLDER == type || ENodeType.SYSTEM_FOLDER == type) {
      moveObject(objectToMove,sourceNode,targetNode,makeRelativeTo);
    }
    CorePlugin.getDefault().refreshDQView(targetNode.getParent());
  }
}
Program: 138009
Project: 138009
Buggy source:
/** 
 * move Source File(close the Source File editor when it's open).
 * @param sourceNode
 * @param targetNode
 * @throws PersistenceException
 */
public void moveSourceFileRepNode(IRepositoryNode sourceNode,IRepositoryNode targetNode) throws PersistenceException {
  if (WorkspaceResourceHelper.sourceFileHasBeenOpened(sourceNode)) {
    MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str",sourceNode.getLabel()));
  }
 else {
    IRepositoryViewObject objectToMove=sourceNode.getObject();
    ERepositoryObjectType targetObjectType=targetNode.getContentType();
    IPath fullPath=ResourceManager.getSourceFileFolder().getFullPath();
    IPath makeRelativeTo=fullPath.makeRelativeTo(ResourceManager.getRootProject().getFullPath());
    ENodeType type=targetNode.getType();
    if (ENodeType.SIMPLE_FOLDER == type || ENodeType.SYSTEM_FOLDER == type) {
      TDQSourceFileItem fileItem=(TDQSourceFileItem)objectToMove.getProperty().getItem();
      String oldPath=ResourceManager.getRootFolderLocation().append(fileItem.eResource().getURI().toPlatformString(true)).toOSString();
      if (oldPath != null) {
        oldPath=StringUtils.removeEnd(oldPath,"String_Node_Str").concat("String_Node_Str");
      }
 else {
        return;
      }
      moveObject(objectToMove,sourceNode,targetNode,makeRelativeTo);
      String newPath=ResourceManager.getRootFolderLocation().append(fileItem.eResource().getURI().toPlatformString(true)).toOSString();
      if (newPath == null) {
        log.error("String_Node_Str");
      }
      File srcFile=new File(oldPath);
      File dtnFile=new File(newPath);
      try {
        FileUtils.copyFileToDirectory(srcFile,dtnFile.getParentFile());
        FileUtils.forceDelete(srcFile);
      }
 catch (      Throwable e) {
        log.error(e.getMessage(),e);
      }
    }
    CorePlugin.getDefault().refreshDQView(targetNode.getParent());
  }
}

Fixed version (ground truth):
/** 
 * move Source File(close the Source File editor when it's open).
 * @param sourceNode
 * @param targetNode
 * @throws PersistenceException
 */
public void moveSourceFileRepNode(IRepositoryNode sourceNode,IRepositoryNode targetNode) throws PersistenceException {
  if (WorkspaceResourceHelper.sourceFileHasBeenOpened(sourceNode)) {
    MessageUI.openWarning(DefaultMessagesImpl.getString("String_Node_Str",sourceNode.getLabel()));
  }
 else {
    IRepositoryViewObject objectToMove=sourceNode.getObject();
    ERepositoryObjectType targetObjectType=targetNode.getContentType();
    IPath fullPath=ResourceManager.getSourceFileFolder().getFullPath();
    IPath makeRelativeTo=fullPath.makeRelativeTo(ResourceManager.getRootProject().getFullPath());
    ENodeType type=targetNode.getType();
    if (ENodeType.SIMPLE_FOLDER == type || ENodeType.SYSTEM_FOLDER == type) {
      moveObject(objectToMove,sourceNode,targetNode,makeRelativeTo);
    }
    CorePlugin.getDefault().refreshDQView(targetNode.getParent());
  }
}
Program: 138011
Project: 138011
Buggy source:
@Override protected void saveReloadResult(){
  Item item=null;
  if (selectedObj instanceof Connection) {
    Connection con=(Connection)selectedObj;
    Property property=PropertyHelper.getProperty(con);
    if (property != null) {
      item=property.getItem();
      if (con.isContextMode()) {
        if (item != null && con instanceof DatabaseConnection) {
          DatabaseConnection dbConn=(DatabaseConnection)ConnectionUtils.getOriginalDatabaseConnection((DatabaseConnection)con);
          String urlStr=DatabaseConnStrUtil.getURLString(dbConn);
          if (urlStr != null) {
            ((DatabaseConnection)con).setURL(urlStr);
            ConnectionHelper.setUsingURL(con,urlStr);
          }
        }
      }
    }
  }
 else   if (selectedObj instanceof IRepositoryViewObject) {
    item=((IRepositoryViewObject)selectedObj).getProperty().getItem();
  }
 else {
    RepositoryNode recursiveFind=RepositoryNodeHelper.recursiveFind(oldDataProvider);
    if (recursiveFind != null) {
      item=recursiveFind.getObject().getProperty().getItem();
    }
  }
  if (item == null) {
    return;
  }
  Project currentProject=ProjectManager.getInstance().getCurrentProject();
  try {
    ProxyRepositoryFactory.getInstance().save(currentProject,item);
  }
 catch (  PersistenceException e) {
    log.error(e,e);
  }
}

Fixed version (ground truth):
@Override protected void saveReloadResult(){
  Item item=null;
  if (selectedObj instanceof Connection) {
    Connection con=(Connection)selectedObj;
    Property property=PropertyHelper.getProperty(con);
    if (property != null) {
      item=property.getItem();
      if (con.isContextMode()) {
        if (item != null && con instanceof DatabaseConnection) {
          DatabaseConnection dbConn=(DatabaseConnection)ConnectionUtils.getOriginalDatabaseConnection((DatabaseConnection)con);
          String urlStr=DatabaseConnStrUtil.getURLString(dbConn);
          if (urlStr != null) {
            if (!dbConn.getDatabaseType().equals(EDatabaseTypeName.GENERAL_JDBC.getDisplayName())) {
              ((DatabaseConnection)con).setURL(urlStr);
            }
            ConnectionHelper.setUsingURL(con,urlStr);
          }
        }
      }
    }
  }
 else   if (selectedObj instanceof IRepositoryViewObject) {
    item=((IRepositoryViewObject)selectedObj).getProperty().getItem();
  }
 else {
    RepositoryNode recursiveFind=RepositoryNodeHelper.recursiveFind(oldDataProvider);
    if (recursiveFind != null) {
      item=recursiveFind.getObject().getProperty().getItem();
    }
  }
  if (item == null) {
    return;
  }
  Project currentProject=ProjectManager.getInstance().getCurrentProject();
  try {
    ProxyRepositoryFactory.getInstance().save(currentProject,item);
  }
 catch (  PersistenceException e) {
    log.error(e,e);
  }
}
Program: 138012
Project: 138012
Buggy source:
/** 
 * Get the original value for context mode.
 * @param connection
 * @param rawValue
 * @return
 */
public static String getOriginalConntextValue(Connection connection,String rawValue){
  String origValu=null;
  if (connection != null && connection.isContextMode()) {
    String contextName=connection.getContextName();
    ContextType contextType=null;
    if (contextName == null) {
      contextType=ConnectionContextHelper.getContextTypeForContextMode(connection,true);
    }
 else {
      contextType=ConnectionContextHelper.getContextTypeForContextMode(null,connection,contextName,false);
    }
    origValu=ConnectionContextHelper.getOriginalValue(contextType,rawValue);
  }
  return origValu == null ? PluginConstant.EMPTY_STRING : origValu;
}

Fixed version (ground truth):
/** 
 * Get the original value for context mode.
 * @param connection
 * @param rawValue
 * @return
 */
public static String getOriginalConntextValue(Connection connection,String rawValue){
  if (rawValue == null) {
    return PluginConstant.EMPTY_STRING;
  }
  String origValu=null;
  if (connection != null && connection.isContextMode()) {
    String contextName=connection.getContextName();
    ContextType contextType=null;
    if (contextName == null) {
      contextType=ConnectionContextHelper.getContextTypeForContextMode(connection,true);
    }
 else {
      contextType=ConnectionContextHelper.getContextTypeForContextMode(null,connection,contextName,false);
    }
    origValu=ConnectionContextHelper.getOriginalValue(contextType,rawValue);
  }
  return origValu == null ? rawValue : origValu;
}
Program: 138013
Project: 138013
Buggy source:
@Override protected boolean saveTextChange(){
  if (connection != null && connection.eIsProxy()) {
    connection=(Connection)EObjectHelper.resolveObject(connection);
  }
  JavaSqlFactory.setUsername(connection,loginText.getText());
  JavaSqlFactory.setPassword(connection,passwordText.getText());
  JavaSqlFactory.setURL(connection,urlText.getText());
  if (super.saveTextChange()) {
    ConnectionUtils.setName(connection,nameText.getText());
    PropertyHelper.getProperty(connection).setLabel(nameText.getText());
  }
 else {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override protected boolean saveTextChange(){
  if (connection != null && connection.eIsProxy()) {
    connection=(Connection)EObjectHelper.resolveObject(connection);
  }
  if (!connection.isContextMode()) {
    JavaSqlFactory.setUsername(connection,loginText.getText());
    JavaSqlFactory.setPassword(connection,passwordText.getText());
  }
  if (super.saveTextChange()) {
    ConnectionUtils.setName(connection,nameText.getText());
    PropertyHelper.getProperty(connection).setLabel(nameText.getText());
  }
 else {
    return false;
  }
  return true;
}
Program: 138014
Project: 138014
Buggy source:
private ReturnCode checkDBConnection(){
  Properties props=new Properties();
  String userName=loginText.getText();
  String password=passwordText.getText();
  String url=urlText.getText();
  if (connection.isContextMode()) {
    userName=ConnectionUtils.getOriginalConntextValue(connection,userName);
    password=ConnectionUtils.getOriginalConntextValue(connection,password);
    url=ConnectionUtils.getOriginalConntextValue(connection,url);
  }
  props.put(TaggedValueHelper.USER,userName);
  props.put(TaggedValueHelper.PASSWORD,password);
  Connection tdDataProvider2=connection;
  if (tdDataProvider2 instanceof MDMConnection) {
    props.put(TaggedValueHelper.UNIVERSE,ConnectionHelper.getUniverse((MDMConnection)tdDataProvider2));
    props.put(TaggedValueHelper.DATA_FILTER,ConnectionHelper.getDataFilter((MDMConnection)tdDataProvider2));
  }
  if (ConnectionUtils.isTeradata(tdDataProvider2)) {
    DatabaseConnection dbConn=(DatabaseConnection)tdDataProvider2;
    props.put(TaggedValueHelper.DBTYPE,dbConn.getDatabaseType());
    props.put(TaggedValueHelper.DBNAME,dbConn.getSID());
  }
  ReturnCode returnCode=ConnectionUtils.isMdmConnection(tdDataProvider2) ? new MdmWebserviceConnection(JavaSqlFactory.getURL(tdDataProvider2),props).checkDatabaseConnection() : ConnectionUtils.checkConnection(url,JavaSqlFactory.getDriverClass(tdDataProvider2),props);
  return returnCode;
}

Fixed version (ground truth):
private ReturnCode checkDBConnection(){
  Properties props=new Properties();
  String userName=loginText.getText();
  String password=passwordText.getText();
  String url=urlText.getText();
  String driverClassName=JavaSqlFactory.getDriverClass(connection);
  if (connection.isContextMode()) {
    userName=ConnectionUtils.getOriginalConntextValue(connection,userName);
    password=ConnectionUtils.getOriginalConntextValue(connection,password);
    url=ConnectionUtils.getOriginalConntextValue(connection,url);
    driverClassName=ConnectionUtils.getOriginalConntextValue(connection,driverClassName);
  }
  props.put(TaggedValueHelper.USER,userName);
  props.put(TaggedValueHelper.PASSWORD,password);
  if (connection instanceof MDMConnection) {
    props.put(TaggedValueHelper.UNIVERSE,ConnectionHelper.getUniverse((MDMConnection)connection));
    props.put(TaggedValueHelper.DATA_FILTER,ConnectionHelper.getDataFilter((MDMConnection)connection));
  }
  if (ConnectionUtils.isTeradata(connection)) {
    DatabaseConnection dbConn=(DatabaseConnection)connection;
    props.put(TaggedValueHelper.DBTYPE,dbConn.getDatabaseType());
    props.put(TaggedValueHelper.DBNAME,dbConn.getSID());
  }
  ReturnCode returnCode=ConnectionUtils.isMdmConnection(connection) ? new MdmWebserviceConnection(JavaSqlFactory.getURL(connection),props).checkDatabaseConnection() : ConnectionUtils.checkConnection(url,driverClassName,props);
  return returnCode;
}
Program: 138016
Project: 138016
Buggy source:
private String getItemFullPath(Property property){
  Item item=property.getItem();
  IPath path=null;
  String fileName=null;
  EElementEName elementEName=EElementEName.getElementEName(item);
  if (elementEName != null) {
    URI uri=EObjectHelper.getURI(property);
    path=new Path(uri.toPlatformString(false));
    path=new Path(path.lastSegment());
    fileName=path.removeFileExtension().addFileExtension(elementEName.getFileExt()).toString();
  }
  IPath typedPath=ResourceManager.getRootProject().getFolder(PropertyHelper.getItemTypedPath(item)).getLocation();
  String fullpath=typedPath.toOSString() + "String_Node_Str" + fileName;
  return fullpath;
}

Fixed version (ground truth):
private String getItemFullPath(TDQSourceFileItem item){
  String statePathStr=null;
  if (item.getState() != null) {
    statePathStr=item.getState().getPath();
    if (!statePathStr.equals("String_Node_Str")) {
      statePathStr="String_Node_Str" + statePathStr;
    }
  }
  String fileName=item.getName() + "String_Node_Str" + item.getProperty().getVersion()+ "String_Node_Str"+ item.getExtension();
  IPath typedPath=ResourceManager.getSourceFileFolder().getLocation();
  String fullpath=typedPath.toOSString() + statePathStr + "String_Node_Str"+ fileName;
  return fullpath;
}
Program: 138017
Project: 138017
Buggy source:
@Override public ReturnCode save(Item item,boolean careDependency){
  ReturnCode rc=new ReturnCode();
  if (!(item instanceof TDQSourceFileItem)) {
    rc.setOk(Boolean.FALSE);
    return rc;
  }
  TDQSourceFileItem sqlItem=(TDQSourceFileItem)item;
  ByteArray byteArray=PropertiesFactory.eINSTANCE.createByteArray();
  InputStream stream=null;
  try {
    File file=new File(this.getItemFullPath(sqlItem.getProperty()));
    stream=file.toURL().openStream();
    byte[] innerContent=new byte[stream.available()];
    stream.read(innerContent);
    byteArray.setInnerContent(innerContent);
  }
 catch (  IOException e) {
    rc.setOk(Boolean.FALSE);
    ExceptionHandler.process(e);
  }
 finally {
    if (stream != null) {
      try {
        stream.close();
      }
 catch (      IOException e) {
        rc.setOk(Boolean.FALSE);
        rc.setMessage(e.getMessage());
      }
    }
  }
  String routineContent=new String(byteArray.getInnerContent());
  byteArray.setInnerContent(routineContent.getBytes());
  sqlItem.getContent().setInnerContent(routineContent.getBytes());
  return rc;
}

Fixed version (ground truth):
@Override public ReturnCode save(Item item,boolean careDependency){
  ReturnCode rc=new ReturnCode();
  if (!(item instanceof TDQSourceFileItem)) {
    rc.setOk(Boolean.FALSE);
    return rc;
  }
  TDQSourceFileItem sqlItem=(TDQSourceFileItem)item;
  ByteArray byteArray=PropertiesFactory.eINSTANCE.createByteArray();
  InputStream stream=null;
  try {
    File file=new File(this.getItemFullPath(sqlItem));
    byteArray.setInnerContentFromFile(file);
  }
 catch (  IOException e) {
    rc.setOk(Boolean.FALSE);
    ExceptionHandler.process(e);
  }
 finally {
    if (stream != null) {
      try {
        stream.close();
      }
 catch (      IOException e) {
        rc.setOk(Boolean.FALSE);
        rc.setMessage(e.getMessage());
      }
    }
  }
  String routineContent=new String(byteArray.getInnerContent());
  byteArray.setInnerContent(routineContent.getBytes());
  sqlItem.getContent().setInnerContent(routineContent.getBytes());
  return rc;
}
Program: 138018
Project: 138018
Buggy source:
@Override public void handle(Object object,String[] rowValues){
  if (duplicateMap.containsKey(object)) {
    duplicateMap.get(object).add(rowValues);
  }
 else {
    List<Object[]> temp=new ArrayList<Object[]>();
    temp.add(rowValues);
    duplicateMap.put(object,temp);
  }
}

Fixed version (ground truth):
public void handle(Object object,String[] rowValues){
  if (duplicateMap.containsKey(object)) {
    duplicateMap.get(object).add(rowValues);
  }
 else {
    List<Object[]> temp=new ArrayList<Object[]>();
    temp.add(rowValues);
    duplicateMap.put(object,temp);
  }
}
Program: 138019
Project: 138019
Buggy source:
@Override public Map<Object,List<Object[]>> getDuplicateMap(){
  return this.duplicateMap;
}

Fixed version (ground truth):
public Map<Object,List<Object[]>> getDuplicateMap(){
  return this.duplicateMap;
}
Program: 138020
Project: 138020
Buggy source:
@Override public boolean storeSqlResults(List<Object[]> objects){
  if (!checkResults(objects,2)) {
    return false;
  }
  String s=String.valueOf(objects.get(0)[0]);
  String c=String.valueOf(objects.get(0)[1]);
  if (!NumberUtils.isNumber(s)) {
    s="String_Node_Str";
  }
  if (!NumberUtils.isNumber(c)) {
    c="String_Node_Str";
  }
  this.setSumStr(s);
  this.setCount(Long.valueOf(c));
  this.setNullCount(Long.valueOf(0));
  return true;
}

Fixed version (ground truth):
@Override public boolean storeSqlResults(List<Object[]> objects){
  if (!checkResults(objects,2)) {
    return false;
  }
  String s=String.valueOf(objects.get(0)[0]);
  String c=String.valueOf(objects.get(0)[1]);
  if (!NumberUtils.isNumber(s)) {
    s="String_Node_Str";
  }
  if (!NumberUtils.isNumber(c)) {
    c="String_Node_Str";
  }
  this.setSumStr(s);
  this.setCount(Long.valueOf(c));
  return true;
}
Program: 138021
Project: 138021
Buggy source:
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public Double getMean(){
  Long c=getCount();
  if (c.compareTo(0L) == 0) {
    return Double.NaN;
  }
  Double sum=null;
  try {
    sum=Double.valueOf(getSumStr());
  }
 catch (  Exception e) {
    return Double.NaN;
  }
  if (sum == null) {
    throw new RuntimeException("String_Node_Str");
  }
  Long nullCount=getNullCount();
  if (nullCount == null) {
    nullCount=0L;
  }
  long nonNULLCount=c.longValue() - nullCount.longValue();
  if (nonNULLCount == 0) {
    return Double.NaN;
  }
  return sum / nonNULLCount;
}

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public Double getMean(){
  Long c=getCount();
  if (c.compareTo(0L) == 0) {
    return Double.NaN;
  }
  Double sum=null;
  try {
    sum=Double.valueOf(getSumStr());
  }
 catch (  Exception e) {
    return Double.NaN;
  }
  if (sum == null) {
    throw new RuntimeException("String_Node_Str");
  }
  return sum / c;
}
Program: 138022
Project: 138022
Buggy source:
@Override public boolean handle(Object data){
  boolean handled=super.handle(data);
  return handled;
}

Fixed version (ground truth):
@Override public boolean handle(Object data){
  if (data == null) {
    nullCount++;
  }
 else {
    count++;
  }
  Boolean handleStatus=handleGenericSum(data);
  return handleStatus;
}
Program: 138023
Project: 138023
Buggy source:
@Override public boolean handle(Object data){
  boolean handled=super.handle(data);
  if (data == null) {
    return false;
  }
  this.getGenericSum(data).sumObject(data);
  return handled;
}

Fixed version (ground truth):
@Override public boolean handle(Object data){
  boolean handled=super.handle(data);
  if (!handled) {
    return handled;
  }
  return handleGenericSum(data);
}
Program: 138024
Project: 138024
Buggy source:
public boolean removeAliasInSQLExplorer(IRepositoryNode children){
  boolean hasDependencyItem=true;
  Item item=children.getObject().getProperty().getItem();
  Object ob=((ConnectionItem)item).getConnection();
  if (item != null && item instanceof ConnectionItem) {
    Connection connection=((ConnectionItem)item).getConnection();
    if (connection instanceof DatabaseConnection || connection instanceof DelimitedFileConnection || connection instanceof MDMConnection) {
      List<ModelElement> dependencyClients=EObjectHelper.getDependencyClients(connection);
      if (!(dependencyClients == null || dependencyClients.isEmpty())) {
        hasDependencyItem=false;
      }
 else {
        CWMPlugin.getDefault().removeAliasInSQLExplorer(connection);
      }
    }
  }
  return hasDependencyItem;
}

Fixed version (ground truth):
public boolean removeAliasInSQLExplorer(IRepositoryNode children){
  boolean hasDependencyItem=true;
  Item item=children.getObject().getProperty().getItem();
  if (item != null && item instanceof ConnectionItem) {
    Connection connection=((ConnectionItem)item).getConnection();
    if (connection instanceof DatabaseConnection || connection instanceof DelimitedFileConnection || connection instanceof MDMConnection) {
      List<ModelElement> dependencyClients=EObjectHelper.getDependencyClients(connection);
      if (!(dependencyClients == null || dependencyClients.isEmpty())) {
        hasDependencyItem=false;
      }
 else {
        CWMPlugin.getDefault().removeAliasInSQLExplorer(connection);
      }
    }
  }
  return hasDependencyItem;
}