nus-yam/ex-repair huggingface dataset:
Program: 138749
Project: 138749
Buggy source:
/** 
 * DOC scorreia Comment method "getConnection".
 * @param analysis
 * @param schema
 * @return
 */
protected TypedReturnCode<java.sql.Connection> getConnection(Analysis analysis){
  TypedReturnCode<java.sql.Connection> rc=new TypedReturnCode<java.sql.Connection>();
  DataManager datamanager=analysis.getContext().getConnection();
  if (datamanager == null) {
    rc.setReturnCode(Messages.getString("String_Node_Str",analysis.getName()),false);
    return rc;
  }
  Connection dataprovider=SwitchHelpers.CONNECTION_SWITCH.doSwitch(datamanager);
  if (dataprovider == null) {
    rc.setReturnCode(Messages.getString("String_Node_Str",datamanager.getName(),analysis.getName()),false);
    return rc;
  }
  TypedReturnCode<java.sql.Connection> connection=JavaSqlFactory.createConnection(dataprovider);
  if (!connection.isOk()) {
    rc.setReturnCode(connection.getMessage(),false);
    return rc;
  }
  rc.setObject(connection.getObject());
  return rc;
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "getConnection".
 * @param analysis
 * @param schema
 * @return
 */
protected TypedReturnCode<java.sql.Connection> getConnection(Analysis analysis){
  TypedReturnCode<java.sql.Connection> rc=new TypedReturnCode<java.sql.Connection>();
  DataManager datamanager=analysis.getContext().getConnection();
  if (datamanager == null) {
    rc.setReturnCode(Messages.getString("String_Node_Str",analysis.getName()),false);
    return rc;
  }
  if (datamanager != null && datamanager.eIsProxy()) {
    datamanager=(DataManager)EObjectHelper.resolveObject(datamanager);
  }
  Connection dataprovider=SwitchHelpers.CONNECTION_SWITCH.doSwitch(datamanager);
  if (dataprovider == null) {
    rc.setReturnCode(Messages.getString("String_Node_Str",datamanager.getName(),analysis.getName()),false);
    return rc;
  }
  TypedReturnCode<java.sql.Connection> connection=JavaSqlFactory.createConnection(dataprovider);
  if (!connection.isOk()) {
    rc.setReturnCode(connection.getMessage(),false);
    return rc;
  }
  rc.setObject(connection.getObject());
  return rc;
}
Program: 138750
Project: 138750
Buggy source:
/** 
 * Method "getQuotedTableName".
 * @param column
 * @return the quoted table name
 */
protected String getQuotedTableName(TdColumn column){
  String table=quote(ColumnHelper.getColumnSetFullName(column));
  return table;
}

Fixed version (ground truth):
/** 
 * Method "getQuotedTableName".
 * @param column
 * @return the quoted table name
 */
protected String getQuotedTableName(TdColumn column){
  if (column != null && column.eIsProxy()) {
    column=(TdColumn)EObjectHelper.resolveObject(column);
  }
  String table=quote(ColumnHelper.getColumnSetFullName(column));
  return table;
}
Program: 138752
Project: 138752
Buggy source:
/** 
 * DOC scorreia Comment method "getTableName".
 * @param columnSetA
 * @return
 */
private String getTableName(EList<TdColumn> columnSetA){
  String tableName=null;
  for (  TdColumn column : columnSetA) {
    if (belongToSameSchemata((TdColumn)column)) {
      ColumnSet columnSetOwner=ColumnHelper.getColumnSetOwner(column);
      if (columnSetOwner == null) {
        log.error("String_Node_Str" + column.getName() + "String_Node_Str");
        continue;
      }
 else {
        String schemaName=getQuotedSchemaName(columnSetOwner);
        String table=getQuotedTableName(column);
        String catalogName=getQuotedCatalogName(columnSetOwner);
        if (catalogName == null && schemaName != null) {
          final Schema parentSchema=SchemaHelper.getParentSchema(columnSetOwner);
          final Catalog parentCatalog=CatalogHelper.getParentCatalog(parentSchema);
          catalogName=parentCatalog != null ? parentCatalog.getName() : null;
        }
        if (ConnectionUtils.isSybaseeDBProducts(dbms().getDbmsName())) {
          schemaName=ColumnSetHelper.getTableOwner(columnSetOwner);
        }
        tableName=dbms().toQualifiedName(catalogName,schemaName,table);
        this.catalogOrSchema=getCatalogOrSchemaName(column);
        break;
      }
    }
 else {
      log.error(this.errorMessage);
    }
  }
  return quote(tableName);
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "getTableName".
 * @param columnSetA
 * @return
 */
private String getTableName(EList<TdColumn> columnSetA){
  String tableName=null;
  for (  TdColumn column : columnSetA) {
    if (column != null && column.eIsProxy()) {
      column=(TdColumn)EObjectHelper.resolveObject(column);
    }
    if (belongToSameSchemata((TdColumn)column)) {
      ColumnSet columnSetOwner=ColumnHelper.getColumnSetOwner(column);
      if (columnSetOwner == null) {
        log.error("String_Node_Str" + column.getName() + "String_Node_Str");
        continue;
      }
 else {
        String schemaName=getQuotedSchemaName(columnSetOwner);
        String table=getQuotedTableName(column);
        String catalogName=getQuotedCatalogName(columnSetOwner);
        if (catalogName == null && schemaName != null) {
          final Schema parentSchema=SchemaHelper.getParentSchema(columnSetOwner);
          final Catalog parentCatalog=CatalogHelper.getParentCatalog(parentSchema);
          catalogName=parentCatalog != null ? parentCatalog.getName() : null;
        }
        if (ConnectionUtils.isSybaseeDBProducts(dbms().getDbmsName())) {
          schemaName=ColumnSetHelper.getTableOwner(columnSetOwner);
        }
        tableName=dbms().toQualifiedName(catalogName,schemaName,table);
        this.catalogOrSchema=getCatalogOrSchemaName(column);
        break;
      }
    }
 else {
      log.error(this.errorMessage);
    }
  }
  return quote(tableName);
}
Program: 138753
Project: 138753
Buggy source:
/** 
 * Method "getAnalyzedTable".
 * @param indicator
 * @return the table name (within quotes)
 */
private String getAnalyzedTable(Indicator indicator){
  String analyzedTableName=null;
  ColumnSet columnSetOwner=(ColumnSet)indicator.getAnalyzedElement();
  if (columnSetOwner == null) {
    log.error("String_Node_Str" + indicator.getName());
  }
 else {
    String schemaName=getQuotedSchemaName(columnSetOwner);
    String table=quote(columnSetOwner.getName());
    String catalogName=getQuotedCatalogName(columnSetOwner);
    if (catalogName == null && schemaName != null) {
      final Schema parentSchema=SchemaHelper.getParentSchema(columnSetOwner);
      final Catalog parentCatalog=CatalogHelper.getParentCatalog(parentSchema);
      catalogName=parentCatalog != null ? parentCatalog.getName() : null;
    }
    if (ConnectionUtils.isSybaseeDBProducts(dbms().getDbmsName())) {
      schemaName=ColumnSetHelper.getTableOwner(columnSetOwner);
    }
    analyzedTableName=dbms().toQualifiedName(catalogName,schemaName,table);
  }
  return analyzedTableName;
}

Fixed version (ground truth):
/** 
 * Method "getAnalyzedTable".
 * @param indicator
 * @return the table name (within quotes)
 */
private String getAnalyzedTable(Indicator indicator){
  String analyzedTableName=null;
  ColumnSet columnSetOwner=(ColumnSet)indicator.getAnalyzedElement();
  if (columnSetOwner == null) {
    log.error("String_Node_Str" + indicator.getName());
  }
 else {
    if (columnSetOwner.eIsProxy()) {
      columnSetOwner=(ColumnSet)EObjectHelper.resolveObject(columnSetOwner);
    }
    String schemaName=getQuotedSchemaName(columnSetOwner);
    String table=quote(columnSetOwner.getName());
    String catalogName=getQuotedCatalogName(columnSetOwner);
    if (catalogName == null && schemaName != null) {
      final Schema parentSchema=SchemaHelper.getParentSchema(columnSetOwner);
      final Catalog parentCatalog=CatalogHelper.getParentCatalog(parentSchema);
      catalogName=parentCatalog != null ? parentCatalog.getName() : null;
    }
    if (ConnectionUtils.isSybaseeDBProducts(dbms().getDbmsName())) {
      schemaName=ColumnSetHelper.getTableOwner(columnSetOwner);
    }
    analyzedTableName=dbms().toQualifiedName(catalogName,schemaName,table);
  }
  return analyzedTableName;
}
Program: 138754
Project: 138754
Buggy source:
/** 
 * DOC bZhou Comment method "getProperty".
 * @param element
 * @return
 */
public static Property getProperty(ModelElement element){
  URI uri=element.eResource().getURI();
  if (uri.isPlatform()) {
    IFile propertyFile=PropertyHelper.getPropertyFile(element);
    return getProperty(propertyFile);
  }
 else {
    File file=new Path(uri.toFileString()).removeFileExtension().addFileExtension(FactoriesUtil.PROPERTIES_EXTENSION).toFile();
    return getProperty(file);
  }
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "getProperty".
 * @param element
 * @return
 */
public static Property getProperty(ModelElement element){
  if (element != null && element.eIsProxy()) {
    element=(ModelElement)EObjectHelper.resolveObject(element);
  }
  URI uri=element.eResource().getURI();
  if (uri.isPlatform()) {
    IFile propertyFile=PropertyHelper.getPropertyFile(element);
    return getProperty(propertyFile);
  }
 else {
    File file=new Path(uri.toFileString()).removeFileExtension().addFileExtension(FactoriesUtil.PROPERTIES_EXTENSION).toFile();
    return getProperty(file);
  }
}
Program: 138755
Project: 138755
Buggy source:
/** 
 * DOC yyi Get all metadata connections.
 * @return
 */
public static List<Connection> getAllMetadataConnections(boolean excludeRecycleBin){
  List<Connection> connections=new ArrayList<Connection>();
  if (excludeRecycleBin) {
    for (    Connection con : getAllMetadataConnections()) {
      if (null == con.eResource()) {
        con=(Connection)EObjectHelper.resolveObject(con);
      }
      if (null != con.eResource() && !PropertyHelper.getProperty(con).getItem().getState().isDeleted()) {
        connections.add(con);
      }
    }
  }
  return connections;
}

Fixed version (ground truth):
/** 
 * DOC yyi Get all metadata connections.modEleToReposObjMap
 * @return
 */
public static List<Connection> getAllMetadataConnections(boolean excludeRecycleBin){
  List<Connection> connections=new ArrayList<Connection>();
  if (excludeRecycleBin) {
    for (    Connection con : getAllMetadataConnections()) {
      ConnectionItem item=(ConnectionItem)getRepositoryViewObject(con).getProperty().getItem();
      if (null != item && !item.getState().isDeleted()) {
        connections.add(con);
      }
    }
  }
  return connections;
}
Program: 138756
Project: 138756
Buggy source:
/** 
 * Method "getCatalogName".
 * @param analyzedElement
 * @return the catalog or schema quoted name
 */
protected String getCatalogOrSchemaName(ModelElement analyzedElement){
  Package schema=super.schemata.get(analyzedElement);
  if (schema == null) {
    log.error("String_Node_Str" + analyzedElement.getName());
    return null;
  }
  if (RelationalPackage.eINSTANCE.getSchema().equals(schema.eClass())) {
    final Catalog parentCatalog=CatalogHelper.getParentCatalog(schema);
    if (parentCatalog != null) {
      return parentCatalog.getName();
    }
  }
  return schema.getName();
}

Fixed version (ground truth):
/** 
 * Method "getCatalogName".
 * @param analyzedElement
 * @return the catalog or schema quoted name
 */
protected String getCatalogOrSchemaName(ModelElement analyzedElement){
  Package schema=super.schemata.get(analyzedElement);
  if (schema == null) {
    log.error("String_Node_Str" + ((analyzedElement != null) ? analyzedElement.getName() : "String_Node_Str"));
    return null;
  }
  if (RelationalPackage.eINSTANCE.getSchema().equals(schema.eClass())) {
    final Catalog parentCatalog=CatalogHelper.getParentCatalog(schema);
    if (parentCatalog != null) {
      return parentCatalog.getName();
    }
  }
  return schema.getName();
}
Program: 138757
Project: 138757
Buggy source:
/** 
 * DOC mzhao Get indicator definition by definition id (xmi id)
 * @param definitionId
 * @return
 */
public IndicatorDefinition getDefinitionById(String definitionId){
  for (  IndicatorDefinition indDef : indicatorDefinitions) {
    CwmResource resource=(CwmResource)indDef.eResource();
    EObject object=resource.getEObject(definitionId);
    if (object != null && DefinitionPackage.eINSTANCE.getIndicatorDefinition().equals(object.eClass())) {
      return (IndicatorDefinition)object;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * DOC mzhao Get indicator definition by definition id (xmi id).
 * @param definitionId
 * @return
 */
public IndicatorDefinition getDefinitionById(String definitionId){
  for (  IndicatorDefinition indDef : indicatorDefinitions) {
    CwmResource resource=(CwmResource)indDef.eResource();
    EObject object=resource.getEObject(definitionId);
    if (object != null && DefinitionPackage.eINSTANCE.getIndicatorDefinition().equals(object.eClass())) {
      return (IndicatorDefinition)object;
    }
  }
  return null;
}
Program: 138758
Project: 138758
Buggy source:
private void updateIndDefinition(Indicator ind){
  if (ind == null || ind.getIndicatorDefinition() == null) {
    return;
  }
  if (ind instanceof UserDefIndicator) {
    return;
  }
  CwmResource indDefResource=(CwmResource)ind.getIndicatorDefinition().eResource();
  IndicatorDefinition updatedDefinition=DefinitionHandler.getInstance().getDefinitionById(indDefResource.getID(ind.getIndicatorDefinition()));
  ind.setIndicatorDefinition(updatedDefinition);
}

Fixed version (ground truth):
private void updateIndDefinition(Indicator ind){
  if (ind == null) {
    return;
  }
  IndicatorDefinition indicatorDefinition=ind.getIndicatorDefinition();
  if (indicatorDefinition == null) {
    return;
  }
  if (ind instanceof UserDefIndicator) {
    return;
  }
  CwmResource indDefResource=(CwmResource)indicatorDefinition.eResource();
  if (indDefResource == null) {
    if (DefinitionHandler.getInstance().setDefaultIndicatorDefinition(ind)) {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + indicatorDefinition.getName() + "String_Node_Str"+ ind.getName()+ "String_Node_Str"+ ind.eResource());
      }
    }
 else {
      log.error("String_Node_Str" + indicatorDefinition.getName() + "String_Node_Str"+ ind.getName()+ "String_Node_Str"+ ind.eResource());
    }
  }
 else {
    IndicatorDefinition updatedDefinition=DefinitionHandler.getInstance().getDefinitionById(indDefResource.getID(ind.getIndicatorDefinition()));
    ind.setIndicatorDefinition(updatedDefinition);
  }
}
Program: 138761
Project: 138761
Buggy source:
private File backUPWorksapce(IPath workspacePath){
  try {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + workspacePath.toOSString());
    }
    ProductVersion version=WorkspaceVersionHelper.getVesion(new Path(versionFile.getAbsolutePath()));
    ProductVersion version410=new ProductVersion(4,1,0);
    if (version != null && VersionComparator.isLower(version,version410)) {
      File temporaryFolder=workspacePath.removeLastSegments(1).append("String_Node_Str" + EcoreUtil.generateUUID()).toFile();
      if (!temporaryFolder.exists()) {
        temporaryFolder.mkdir();
      }
      FileUtils.copyDirectory(workspacePath.toFile(),temporaryFolder);
      return temporaryFolder;
    }
  }
 catch (  IOException e) {
    log.error(e);
  }
  return null;
}

Fixed version (ground truth):
protected File backUPWorksapce(IPath workspacePath){
  try {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + workspacePath.toOSString());
    }
    File temporaryFolder=workspacePath.removeLastSegments(1).append("String_Node_Str" + EcoreUtil.generateUUID()).toFile();
    if (!temporaryFolder.exists()) {
      temporaryFolder.mkdir();
    }
    FileUtils.copyDirectory(workspacePath.toFile(),temporaryFolder);
    return temporaryFolder;
  }
 catch (  IOException e) {
    log.error(e);
  }
  return null;
}
Program: 138763
Project: 138763
Buggy source:
public List<String> check(){
  List<String> errors=new ArrayList<String>();
  if (!checkBasePath()) {
    errors.add("String_Node_Str");
  }
 else   if (!checkVersion()) {
    errors.add("String_Node_Str");
  }
 else   if (!checkProject()) {
    errors.add("String_Node_Str");
  }
  return errors;
}

Fixed version (ground truth):
public List<String> check(){
  List<String> errors=new ArrayList<String>();
  if (!checkBasePath()) {
    errors.add("String_Node_Str");
  }
 else   if (!checkVersion()) {
    errors.add("String_Node_Str");
  }
 else   if (!checkProject()) {
    errors.add("String_Node_Str");
  }
 else   if (!checkTempPath()) {
    errors.add("String_Node_Str");
  }
  return errors;
}
Program: 138764
Project: 138764
Buggy source:
public ItemRecord computeInput(IPath path){
  if (path != null) {
    versionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(VERSION_FILE_NAME).toFile();
    definitionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(DEFINITION_FILE_NAME).toFile();
    if (!versionFile.exists()) {
      return null;
    }
    tempFolder=backUPWorksapce(path);
    if (tempFolder == null) {
      throw new RuntimeException("String_Node_Str" + path + "String_Node_Str");
    }
    IPath tempBasePath=new Path(tempFolder.getAbsolutePath());
    IPath projPath=tempBasePath.append("String_Node_Str");
    setBasePath(tempBasePath);
    if (projPath.toFile().exists()) {
      Object projOBJ=EObjectHelper.retrieveEObject(projPath,PropertiesPackage.eINSTANCE.getProject());
      if (projOBJ != null) {
        Project project=(Project)projOBJ;
        projectName=project.getTechnicalLabel();
      }
    }
 else {
      projectName=ReponsitoryContextBridge.getProjectName();
    }
    return new ItemRecord(tempFolder);
  }
  return null;
}

Fixed version (ground truth):
public ItemRecord computeInput(IPath path){
  if (path != null) {
    versionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(VERSION_FILE_NAME).toFile();
    definitionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(DEFINITION_FILE_NAME).toFile();
    if (!versionFile.exists()) {
      return null;
    }
    tempFolder=backUPWorksapce(path);
    if (tempFolder == null) {
      return null;
    }
    IPath tempBasePath=new Path(tempFolder.getAbsolutePath());
    IPath projPath=tempBasePath.append("String_Node_Str");
    setBasePath(tempBasePath);
    if (projPath.toFile().exists()) {
      Object projOBJ=EObjectHelper.retrieveEObject(projPath,PropertiesPackage.eINSTANCE.getProject());
      if (projOBJ != null) {
        Project project=(Project)projOBJ;
        projectName=project.getTechnicalLabel();
      }
    }
 else {
      projectName=ReponsitoryContextBridge.getProjectName();
    }
    return new ItemRecord(tempFolder);
  }
  return null;
}
Program: 138765
Project: 138765
Buggy source:
@Override public ItemRecord computeInput(IPath path){
  sourcePath=path.removeFileExtension();
  try {
    FilesUtils.createFolder(sourcePath.toFile());
    FilesUtils.unzip(path.toOSString(),sourcePath.toOSString());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return super.computeInput(sourcePath.append(sourcePath.lastSegment()));
}

Fixed version (ground truth):
@Override public ItemRecord computeInput(IPath path){
  sourcePath=path.removeFileExtension();
  try {
    FilesUtils.createFolder(sourcePath.toFile());
    FilesUtils.unzip(path.toOSString(),sourcePath.toOSString());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  String curProjectLabel=ResourceManager.getRootProjectName();
  return super.computeInput(sourcePath.append(sourcePath.lastSegment()).append(curProjectLabel));
}
Program: 138766
Project: 138766
Buggy source:
protected void createTempConnectionFile() throws ReloadCompareException {
  IFile findCorrespondingFile=PrvResourceFileHelper.getInstance().findCorrespondingFile(oldDataProvider);
  if (findCorrespondingFile == null) {
    throw new ReloadCompareException(DefaultMessagesImpl.getString("String_Node_Str",oldDataProvider.getName()));
  }
  IFile tempConnectionFile=DQStructureComparer.copyedToDestinationFile(findCorrespondingFile,DQStructureComparer.getTempRefreshFile());
  URI uri=URI.createPlatformResourceURI(tempConnectionFile.getFullPath().toString(),false);
  Resource resource=EMFSharedResources.getInstance().getResource(uri,true);
  Collection<Connection> tdDataProviders=DataProviderHelper.getTdDataProviders(resource.getContents());
  if (tdDataProviders.isEmpty()) {
    throw new ReloadCompareException(DefaultMessagesImpl.getString("String_Node_Str",tempConnectionFile.getLocation().toFile().getAbsolutePath()));
  }
  if (tdDataProviders.size() > 1) {
    throw new ReloadCompareException(DefaultMessagesImpl.getString("String_Node_Str",tdDataProviders.size(),tempConnectionFile.getLocation().toFile().getAbsolutePath()));
  }
  tempReloadProvider=tdDataProviders.iterator().next();
}

Fixed version (ground truth):
protected void createTempConnectionFile() throws ReloadCompareException {
  if (oldDataProvider != null && oldDataProvider.eIsProxy()) {
    oldDataProvider=(Connection)EObjectHelper.resolveObject(oldDataProvider);
  }
  IFile findCorrespondingFile=PrvResourceFileHelper.getInstance().findCorrespondingFile(oldDataProvider);
  if (findCorrespondingFile == null) {
    throw new ReloadCompareException(DefaultMessagesImpl.getString("String_Node_Str",oldDataProvider.getName()));
  }
  IFile tempConnectionFile=DQStructureComparer.copyedToDestinationFile(findCorrespondingFile,DQStructureComparer.getTempRefreshFile());
  URI uri=URI.createPlatformResourceURI(tempConnectionFile.getFullPath().toString(),false);
  Resource resource=EMFSharedResources.getInstance().getResource(uri,true);
  Collection<Connection> tdDataProviders=DataProviderHelper.getTdDataProviders(resource.getContents());
  if (tdDataProviders.isEmpty()) {
    throw new ReloadCompareException(DefaultMessagesImpl.getString("String_Node_Str",tempConnectionFile.getLocation().toFile().getAbsolutePath()));
  }
  if (tdDataProviders.size() > 1) {
    throw new ReloadCompareException(DefaultMessagesImpl.getString("String_Node_Str",tdDataProviders.size(),tempConnectionFile.getLocation().toFile().getAbsolutePath()));
  }
  tempReloadProvider=tdDataProviders.iterator().next();
}
Program: 138767
Project: 138767
Buggy source:
@Override protected boolean doExecute() throws Exception {
  boolean result=true;
  Map<File,File> folderMap=initStructure();
  for (  File folder : folderMap.keySet()) {
    try {
      if (isWorksapcePath()) {
        tansferFile(folder);
      }
 else {
        if (folder.exists()) {
          FileUtils.copyDirectory(folder,folderMap.get(folder));
        }
      }
    }
 catch (    Exception e) {
      log.error(e,e);
    }
  }
  File tdqMetadataFile=getWorkspacePath().append(OLD_MEATADATA_FOLDER_NAME).toFile();
  if (tdqMetadataFile.exists()) {
    FileUtils.deleteDirectory(tdqMetadataFile);
  }
  File fileAnalysis=getWorkspacePath().append(EResourceConstant.ANALYSIS.getPath()).toFile();
  File fileRule=getWorkspacePath().append(EResourceConstant.RULES.getPath()).toFile();
  try {
    String[] anaFileExtentionNames={FactoriesUtil.ANA};
    String[] rulesFileEctentionNames={FactoriesUtil.DQRULE};
    result&=FilesUtils.migrateFolder(fileAnalysis,anaFileExtentionNames,this.getReplaceStringMap(),log) && FilesUtils.migrateFolder(fileRule,rulesFileEctentionNames,this.getReplaceStringMap(),log);
    AnaResourceFileHelper.getInstance().clear();
    ResourceService.refreshStructure();
  }
 catch (  Exception e) {
    result=false;
    log.error(e,e);
  }
  return result;
}

Fixed version (ground truth):
@Override protected boolean doExecute() throws Exception {
  boolean result=true;
  folderMap=initStructure();
  for (  File folder : folderMap.keySet()) {
    try {
      tansferFile(folder);
    }
 catch (    Exception e) {
      log.error(e,e);
    }
  }
  File tdqMetadataFile=getWorkspacePath().append(OLD_MEATADATA_FOLDER_NAME).toFile();
  if (tdqMetadataFile.exists()) {
    FileUtils.deleteDirectory(tdqMetadataFile);
  }
  File fileAnalysis=getWorkspacePath().append(EResourceConstant.ANALYSIS.getPath()).toFile();
  File fileRule=getWorkspacePath().append(EResourceConstant.RULES.getPath()).toFile();
  try {
    String[] anaFileExtentionNames={FactoriesUtil.ANA};
    String[] rulesFileEctentionNames={FactoriesUtil.DQRULE};
    result&=FilesUtils.migrateFolder(fileAnalysis,anaFileExtentionNames,this.getReplaceStringMap(),log) && FilesUtils.migrateFolder(fileRule,rulesFileEctentionNames,this.getReplaceStringMap(),log);
    AnaResourceFileHelper.getInstance().clear();
    ResourceService.refreshStructure();
  }
 catch (  Exception e) {
    result=false;
    log.error(e,e);
  }
  return result;
}
Program: 138770
Project: 138770
Buggy source:
/** 
 * DOC bZhou Comment method "update".
 * @param desFile
 * @throws IOException
 */
private void update(File desFile) throws IOException {
  String curProjectLabel=ResourceManager.getRootProjectName();
  if (!StringUtils.equals(projectName,curProjectLabel)) {
    String content=FileUtils.readFileToString(desFile,"String_Node_Str");
    content=StringUtils.replace(content,"String_Node_Str" + projectName + "String_Node_Str","String_Node_Str" + curProjectLabel + "String_Node_Str");
    FileUtils.writeStringToFile(desFile,content,"String_Node_Str");
  }
  if (desFile.getName().endsWith(FactoriesUtil.PROPERTIES_EXTENSION)) {
    Property property=PropertyHelper.getProperty(desFile);
    User user=ReponsitoryContextBridge.getUser();
    if (user != null) {
      property.setAuthor(user);
    }
    EMFSharedResources.getInstance().saveResource(property.eResource());
  }
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "update".
 * @param desFile
 * @throws IOException
 * @throws PersistenceException
 */
private void update(File desFile) throws IOException, PersistenceException {
  String curProjectLabel=ResourceManager.getRootProjectName();
  if (!StringUtils.equals(projectName,curProjectLabel)) {
    String content=FileUtils.readFileToString(desFile,"String_Node_Str");
    content=StringUtils.replace(content,"String_Node_Str" + projectName + "String_Node_Str","String_Node_Str" + curProjectLabel + "String_Node_Str");
    FileUtils.writeStringToFile(desFile,content,"String_Node_Str");
  }
  if (desFile.getName().endsWith(FactoriesUtil.PROPERTIES_EXTENSION)) {
    Property property=PropertyHelper.getProperty(desFile);
    User user=ReponsitoryContextBridge.getUser();
    if (user != null) {
      property.setAuthor(user);
    }
    EMFSharedResources.getInstance().saveResource(property.eResource());
  }
  if (desFile.getName().endsWith(FactoriesUtil.ITEM_EXTENSION)) {
    File propFile=new Path(desFile.getAbsolutePath()).removeFileExtension().addFileExtension(FactoriesUtil.PROPERTIES_EXTENSION).toFile();
    Property property=PropertyHelper.getProperty(propFile);
    if (property.getItem() instanceof ConnectionItem) {
      Connection connection=((ConnectionItem)property.getItem()).getConnection();
      TdSoftwareSystem softwareSystem=SoftwareSystemManager.getInstance().getSoftwareSystem(connection);
      if (softwareSystem != null) {
        ConnectionHelper.setSoftwareSystem(connection,softwareSystem);
      }
      ProxyRepositoryFactory.getInstance().save(property.getItem(),true);
      IRepositoryViewObject object=new RepositoryViewObject(property);
      ProxyRepositoryViewObject.registerReposViewObj(connection,object);
    }
  }
}
Program: 138771
Project: 138771
Buggy source:
public ItemRecord computeInput(IPath path){
  setBasePath(path);
  if (path != null) {
    versionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(VERSION_FILE_NAME).toFile();
    definitionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(DEFINITION_FILE_NAME).toFile();
    if (!versionFile.exists()) {
      return null;
    }
    IPath projPath=path.append("String_Node_Str");
    if (projPath.toFile().exists()) {
      Object projOBJ=EObjectHelper.retrieveEObject(projPath,PropertiesPackage.eINSTANCE.getProject());
      if (projOBJ != null) {
        Project project=(Project)projOBJ;
        projectName=project.getTechnicalLabel();
      }
    }
 else {
      projectName=ReponsitoryContextBridge.getProjectName();
    }
  }
  return new ItemRecord(path.toFile());
}

Fixed version (ground truth):
public ItemRecord computeInput(IPath path){
  setBasePath(path);
  if (path != null) {
    versionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(VERSION_FILE_NAME).toFile();
    definitionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(DEFINITION_FILE_NAME).toFile();
    if (!versionFile.exists()) {
      return null;
    }
    backUPWorksapce();
    IPath projPath=path.append("String_Node_Str");
    if (projPath.toFile().exists()) {
      Object projOBJ=EObjectHelper.retrieveEObject(projPath,PropertiesPackage.eINSTANCE.getProject());
      if (projOBJ != null) {
        Project project=(Project)projOBJ;
        projectName=project.getTechnicalLabel();
      }
    }
 else {
      projectName=ReponsitoryContextBridge.getProjectName();
    }
  }
  return new ItemRecord(path.toFile());
}
Program: 138772
Project: 138772
Buggy source:
public void migration(IProgressMonitor monitor){
  List<IMigrationTask> modelTasks=new ArrayList<IMigrationTask>();
  if (versionFile != null && versionFile.exists()) {
    ProductVersion version=WorkspaceVersionHelper.getVesion(new Path(versionFile.getAbsolutePath()));
    List<IMigrationTask> taskList=MigrationTaskManager.findWorkspaceTaskByType(MigrationTaskType.FILE,version);
    if (!taskList.isEmpty()) {
      for (      IMigrationTask task : taskList) {
        if (isModelTask(task)) {
          ((AbstractWorksapceUpdateTask)task).setWorkspacePath(basePath);
          modelTasks.add(task);
        }
 else {
          commTasks.add(task);
        }
      }
    }
  }
  File file=basePath.append(EResourceConstant.LIBRARIES.getPath()).append("String_Node_Str").toFile();
  if (!modelTasks.isEmpty() && !file.exists()) {
    MigrationTaskManager.doMigrationTask(modelTasks,monitor);
    try {
      file.createNewFile();
    }
 catch (    IOException e) {
      ExceptionHandler.process(e);
    }
  }
}

Fixed version (ground truth):
public void migration(IProgressMonitor monitor){
  List<IMigrationTask> modelTasks=new ArrayList<IMigrationTask>();
  if (versionFile != null && versionFile.exists()) {
    ProductVersion version=WorkspaceVersionHelper.getVesion(new Path(versionFile.getAbsolutePath()));
    List<IMigrationTask> taskList=MigrationTaskManager.findWorkspaceTaskByType(MigrationTaskType.FILE,version);
    if (!taskList.isEmpty()) {
      for (      IMigrationTask task : taskList) {
        if (isModelTask(task)) {
          ((AbstractWorksapceUpdateTask)task).setWorkspacePath(basePath);
          modelTasks.add(task);
        }
 else {
          commTasks.add(task);
        }
      }
    }
  }
  if (!modelTasks.isEmpty()) {
    MigrationTaskManager.doMigrationTask(modelTasks,monitor);
  }
}
Program: 138773
Project: 138773
Buggy source:
public void finish(ItemRecord[] records,IProgressMonitor monitor) throws IOException, CoreException {
  ItemRecord.clear();
  IFile defFile=ResourceManager.getLibrariesFolder().getFile(DEFINITION_FILE_NAME);
  if (definitionFile != null && definitionFile.exists()) {
    File defintionFile=defFile.getLocation().toFile();
    FilesUtils.copyFile(definitionFile,defintionFile);
  }
  ResourceService.refreshStructure();
  if (!commTasks.isEmpty() && monitor != null) {
    MigrationTaskManager.doMigrationTask(commTasks,monitor);
  }
  ProxyRepositoryViewObject.fetchAllRepositoryViewObjects(true);
}

Fixed version (ground truth):
public void finish(ItemRecord[] records,IProgressMonitor monitor) throws IOException, CoreException {
  ItemRecord.clear();
  IFile defFile=ResourceManager.getLibrariesFolder().getFile(DEFINITION_FILE_NAME);
  if (definitionFile != null && definitionFile.exists()) {
    File defintionFile=defFile.getLocation().toFile();
    FilesUtils.copyFile(definitionFile,defintionFile);
  }
  ResourceService.refreshStructure();
  if (!commTasks.isEmpty() && monitor != null) {
    MigrationTaskManager.doMigrationTask(commTasks,monitor);
  }
  if (tempFolder != null && tempFolder.exists()) {
    log.info("String_Node_Str");
    FileUtils.copyDirectory(tempFolder,basePath.toFile());
    FileUtils.deleteDirectory(tempFolder);
  }
}
Program: 138774
Project: 138774
Buggy source:
public void write(ItemRecord[] records,IProgressMonitor monitor){
  if (monitor == null) {
    monitor=new NullProgressMonitor();
  }
  try {
    for (    ItemRecord record : records) {
      if (monitor.isCanceled()) {
        break;
      }
      Map<IPath,IPath> toImportMap=mapping(record);
      monitor.subTask("String_Node_Str" + record.getName());
      if (record.isValid()) {
        log.info("String_Node_Str" + record.getFile().getAbsolutePath());
        ModelElement element=record.getElement();
        if (element != null && element instanceof Connection) {
          Property property=record.getProperty();
          IPath statePath;
          ItemState state=property.getItem().getState();
          if (state != null && state.getPath() != null) {
            statePath=new Path(state.getPath());
          }
 else {
            statePath=Path.EMPTY;
          }
          ProxyRepositoryFactory.getInstance().create(property.getItem(),statePath);
        }
 else {
          for (          IPath resPath : toImportMap.keySet()) {
            IPath desPath=toImportMap.get(resPath);
            write(resPath,desPath);
          }
        }
      }
 else {
        for (        String error : record.getErrors()) {
          log.error(error);
        }
      }
      monitor.worked(1);
    }
    finish(records,monitor);
  }
 catch (  Exception e) {
    log.error(e,e);
  }
}

Fixed version (ground truth):
public void write(ItemRecord[] records,IProgressMonitor monitor){
  if (monitor == null) {
    monitor=new NullProgressMonitor();
  }
  try {
    for (    ItemRecord record : records) {
      if (monitor.isCanceled()) {
        break;
      }
      Map<IPath,IPath> toImportMap=mapping(record);
      monitor.subTask("String_Node_Str" + record.getName());
      if (record.isValid()) {
        log.info("String_Node_Str" + record.getFile().getAbsolutePath());
        for (        IPath resPath : toImportMap.keySet()) {
          IPath desPath=toImportMap.get(resPath);
          write(resPath,desPath);
        }
      }
 else {
        for (        String error : record.getErrors()) {
          log.error(error);
        }
      }
      monitor.worked(1);
    }
    finish(records,monitor);
  }
 catch (  Exception e) {
    log.error(e,e);
  }
}
Program: 138775
Project: 138775
Buggy source:
/** 
 * DOC xqliu Comment method "getDriverClass".
 * @param conn
 * @return driver class name of the connection or null
 */
public static String getDriverClass(Connection conn){
  DatabaseConnection dbConn=SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(conn);
  if (dbConn != null) {
    return dbConn.getDriverClass();
  }
  MDMConnection mdmConn=SwitchHelpers.MDMCONNECTION_SWITCH.doSwitch(conn);
  if (mdmConn != null) {
    return "String_Node_Str";
  }
  return null;
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "getDriverClass".
 * @param conn
 * @return driver class name of the connection or null
 */
public static String getDriverClass(Connection conn){
  DatabaseConnection dbConn=SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(conn);
  if (dbConn != null) {
    String driverClassName=dbConn.getDriverClass();
    if (driverClassName == null) {
      SupportDBUrlType dbType=SupportDBUrlStore.getInstance().findDBTypeByName(dbConn.getDatabaseType());
      if (dbType != null) {
        driverClassName=dbType.getDbDriver();
      }
    }
    return driverClassName;
  }
  MDMConnection mdmConn=SwitchHelpers.MDMCONNECTION_SWITCH.doSwitch(conn);
  if (mdmConn != null) {
    return "String_Node_Str";
  }
  return null;
}
Program: 138776
Project: 138776
Buggy source:
@Override public boolean hasChildren(Object element){
  if (element instanceof IEcosCategory) {
    return true;
  }
  if (element instanceof IFolder) {
    List<Object> obsLs=Arrays.asList(super.getChildren(element));
    if (obsLs.size() == 1) {
      Object obj=(Object)obsLs.get(0);
      if (obj instanceof IFolder && ((IFolder)obj).getName().equals(PluginConstant.SVN_SUFFIX))       return false;
    }
  }
 else   if (element instanceof DQRecycleBinNode) {
    DQRecycleBinNode rbn=(DQRecycleBinNode)element;
    Object obj=rbn.getObject();
    if (obj instanceof IFolder) {
      try {
        return ((IFolder)obj).members().length > 0;
      }
 catch (      CoreException e) {
        log.error(e);
      }
    }
    return false;
  }
  return super.hasChildren(element);
}

Fixed version (ground truth):
@Override public boolean hasChildren(Object element){
  if (element instanceof IEcosCategory) {
    return true;
  }
  if (element instanceof IFolder) {
    if (ResourceManager.isExchangeFolder((IFolder)element)) {
      return true;
    }
    List<Object> obsLs=Arrays.asList(super.getChildren(element));
    if (obsLs.size() == 1) {
      Object obj=(Object)obsLs.get(0);
      if (obj instanceof IFolder && ((IFolder)obj).getName().equals(PluginConstant.SVN_SUFFIX))       return false;
    }
  }
 else   if (element instanceof DQRecycleBinNode) {
    DQRecycleBinNode rbn=(DQRecycleBinNode)element;
    Object obj=rbn.getObject();
    if (obj instanceof IFolder) {
      try {
        return ((IFolder)obj).members().length > 0;
      }
 catch (      CoreException e) {
        log.error(e);
      }
    }
    return false;
  }
  return super.hasChildren(element);
}
Program: 138777
Project: 138777
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public boolean storeSqlResults(List<Object[]> objects){
  int nbColumns=2;
  if (hasDateGrainParameter()) {
    DateGrain dategrain=getParameters().getDateParameters().getDateAggregationType();
switch (dategrain) {
case DAY:
      nbColumns++;
case WEEK:
    nbColumns++;
case MONTH:
  nbColumns++;
case QUARTER:
nbColumns++;
case YEAR:
break;
default :
break;
}
}
if (objects.isEmpty()) {
if (log.isInfoEnabled()) {
log.info("String_Node_Str" + "String_Node_Str");
}
this.setValueToFreq(new HashMap<Object,Long>());
return true;
}
if (!checkResults(objects,nbColumns)) {
return false;
}
HashMap<Object,Long> mapVal2Freq=new HashMap<Object,Long>();
boolean debug=log.isDebugEnabled();
StringBuffer matrix=debug ? new StringBuffer() : null;
for (Object[] value2freq : objects) {
if (value2freq.length != nbColumns) {
log.error("String_Node_Str");
return false;
}
Object value=getValueFields(value2freq);
Long freq=Long.valueOf(String.valueOf(value2freq[nbColumns - 1]));
mapVal2Freq.put(value,freq);
if (debug) {
matrix.append("String_Node_Str").append("String_Node_Str").append(value).append("String_Node_Str").append("String_Node_Str").append(freq);
}
}
if (debug) {
log.debug(matrix);
}
this.setValueToFreq(mapVal2Freq);
return true;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public boolean storeSqlResults(List<Object[]> objects){
  int nbColumns=2;
  if (hasDateGrainParameter()) {
    DateGrain dategrain=getParameters().getDateParameters().getDateAggregationType();
switch (dategrain) {
case DAY:
      nbColumns++;
case WEEK:
    nbColumns++;
case MONTH:
  nbColumns++;
case QUARTER:
nbColumns++;
case YEAR:
break;
default :
break;
}
}
if (objects.isEmpty()) {
if (log.isInfoEnabled()) {
log.info("String_Node_Str" + "String_Node_Str");
}
this.setValueToFreq(new HashMap<Object,Long>());
return true;
}
if (!checkResults(objects,nbColumns)) {
return false;
}
HashMap<Object,Long> mapVal2Freq=new HashMap<Object,Long>();
boolean debug=log.isDebugEnabled();
StringBuffer matrix=debug ? new StringBuffer() : null;
Long count=0l;
for (Object[] value2freq : objects) {
if (value2freq.length != nbColumns) {
log.error("String_Node_Str");
return false;
}
Object value=getValueFields(value2freq);
Long freq=Long.valueOf(String.valueOf(value2freq[nbColumns - 1]));
mapVal2Freq.put(value,freq);
if (debug) {
matrix.append("String_Node_Str").append("String_Node_Str").append(value).append("String_Node_Str").append("String_Node_Str").append(freq);
}
count=count + freq;
}
if (debug) {
log.debug(matrix);
}
this.setCount(count);
this.setValueToFreq(mapVal2Freq);
return true;
}
Program: 138778
Project: 138778
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public boolean storeSqlResults(List<Object[]> objects){
  int nbColumns=2;
  if (hasDateGrainParameter()) {
    DateGrain dategrain=getParameters().getDateParameters().getDateAggregationType();
switch (dategrain) {
case DAY:
      nbColumns++;
case WEEK:
    nbColumns++;
case MONTH:
  nbColumns++;
case QUARTER:
nbColumns++;
case YEAR:
break;
default :
break;
}
}
if (objects.isEmpty()) {
if (log.isInfoEnabled()) {
log.info("String_Node_Str" + "String_Node_Str");
}
this.setValueToFreq(new HashMap<Object,Long>());
return true;
}
if (!checkResults(objects,nbColumns)) {
return false;
}
HashMap<Object,Long> mapVal2Freq=new HashMap<Object,Long>();
boolean debug=log.isDebugEnabled();
StringBuffer matrix=debug ? new StringBuffer() : null;
Long count=0l;
for (Object[] value2freq : objects) {
if (value2freq.length != nbColumns) {
log.error("String_Node_Str");
return false;
}
Object value=getValueFields(value2freq);
Long freq=Long.valueOf(String.valueOf(value2freq[nbColumns - 1]));
mapVal2Freq.put(value,freq);
if (debug) {
matrix.append("String_Node_Str").append("String_Node_Str").append(value).append("String_Node_Str").append("String_Node_Str").append(freq);
}
count=count + freq;
}
if (debug) {
log.debug(matrix);
}
this.setCount(count);
this.setValueToFreq(mapVal2Freq);
return true;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public boolean storeSqlResults(List<Object[]> objects){
  int nbColumns=2;
  if (hasDateGrainParameter()) {
    DateGrain dategrain=getParameters().getDateParameters().getDateAggregationType();
switch (dategrain) {
case DAY:
      nbColumns++;
case WEEK:
    nbColumns++;
case MONTH:
  nbColumns++;
case QUARTER:
nbColumns++;
case YEAR:
break;
default :
break;
}
}
if (objects.isEmpty()) {
if (log.isInfoEnabled()) {
log.info("String_Node_Str" + "String_Node_Str");
}
this.setValueToFreq(new HashMap<Object,Long>());
return true;
}
if (!checkResults(objects,nbColumns)) {
return false;
}
HashMap<Object,Long> mapVal2Freq=new HashMap<Object,Long>();
boolean debug=log.isDebugEnabled();
StringBuffer matrix=debug ? new StringBuffer() : null;
for (Object[] value2freq : objects) {
if (value2freq.length != nbColumns) {
log.error("String_Node_Str");
return false;
}
Object value=getValueFields(value2freq);
Long freq=Long.valueOf(String.valueOf(value2freq[nbColumns - 1]));
mapVal2Freq.put(value,freq);
if (debug) {
matrix.append("String_Node_Str").append("String_Node_Str").append(value).append("String_Node_Str").append("String_Node_Str").append(freq);
}
}
if (debug) {
log.debug(matrix);
}
this.setValueToFreq(mapVal2Freq);
return true;
}
Program: 138779
Project: 138779
Buggy source:
/** 
 * DOC bZhou Comment method "retrieveEObject".
 * @param filePath
 * @param classfier
 * @return
 */
public static Object retrieveEObject(IPath filePath,EClass classfier){
  URI uri=URI.createFileURI(filePath.toOSString());
  Resource res=new ResourceSetImpl().getResource(uri,true);
  return EcoreUtil.getObjectByType(res.getContents(),classfier);
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "retrieveEObject".
 * @param filePath
 * @param classfier
 * @return
 */
public static Object retrieveEObject(IPath filePath,EClass classfier){
  if (isEObjectPathExited(filePath)) {
    URI uri;
    if (filePath.isAbsolute()) {
      uri=URI.createFileURI(filePath.toOSString());
    }
 else {
      uri=URI.createPlatformResourceURI(filePath.toOSString(),false);
    }
    Resource res=new ResourceSetImpl().getResource(uri,true);
    return EcoreUtil.getObjectByType(res.getContents(),classfier);
  }
  return null;
}
Program: 138780
Project: 138780
Buggy source:
/** 
 * DOC bZhou Comment method "extractProjectLabel". This method is to extract the project technical label.
 * @param property
 * @return
 */
public static String extractProjectLabel(Property property){
  User author=property.getAuthor();
  if (author != null && !author.eIsProxy()) {
    InternalEObject iAuthor=(InternalEObject)property.getAuthor();
    Resource projResource=iAuthor.eResource();
    if (projResource != null) {
      IPath projectPath=new Path(projResource.getURI().toFileString());
      if (projectPath.toFile().exists()) {
        Object projOBJ=EObjectHelper.retrieveEObject(projectPath,PropertiesPackage.eINSTANCE.getProject());
        if (projOBJ != null) {
          Project project=(Project)projOBJ;
          return project.getTechnicalLabel();
        }
      }
    }
  }
  return ReponsitoryContextBridge.PROJECT_DEFAULT_NAME;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "extractProjectLabel". This method is to extract the project technical label.
 * @param property
 * @return
 */
public static String extractProjectLabel(Property property){
  User author=property.getAuthor();
  if (author != null && !author.eIsProxy()) {
    InternalEObject iAuthor=(InternalEObject)property.getAuthor();
    Resource projResource=iAuthor.eResource();
    if (projResource != null) {
      URI uri=projResource.getURI();
      String pathString=uri.isPlatform() ? uri.toPlatformString(false) : uri.toFileString();
      IPath projectPath=new Path(pathString);
      Object projOBJ=EObjectHelper.retrieveEObject(projectPath,PropertiesPackage.eINSTANCE.getProject());
      if (projOBJ != null) {
        Project project=(Project)projOBJ;
        return project.getTechnicalLabel();
      }
    }
  }
  return ReponsitoryContextBridge.PROJECT_DEFAULT_NAME;
}
Program: 138781
Project: 138781
Buggy source:
private void setPropertyMetadata(ModelElement modelElement,Property property){
  User user=ReponsitoryContextBridge.getUser();
  if (user != null) {
    property.setAuthor(user);
  }
  String purpose=MetadataHelper.getPurpose(modelElement);
  String description=MetadataHelper.getDescription(modelElement);
  String version=MetadataHelper.getVersion(modelElement);
  String status=MetadataHelper.getDevStatus(modelElement);
  property.setId(EcoreUtil.generateUUID());
  property.setLabel(modelElement.getName());
  property.setPurpose(purpose);
  property.setDescription(description);
  property.setStatusCode(status);
  property.setVersion(version);
  EList<Information> informations=property.getInformations();
  InformationLevel maxLevel=null;
  for (  Information information : informations) {
    int value=information.getLevel().getValue();
    if (maxLevel == null || value > maxLevel.getValue()) {
      maxLevel=information.getLevel();
    }
  }
  property.setMaxInformationLevel(maxLevel);
}

Fixed version (ground truth):
private void setPropertyMetadata(ModelElement modelElement,Property property){
  String purpose=MetadataHelper.getPurpose(modelElement);
  String description=MetadataHelper.getDescription(modelElement);
  String version=MetadataHelper.getVersion(modelElement);
  String status=MetadataHelper.getDevStatus(modelElement);
  property.setId(EcoreUtil.generateUUID());
  property.setLabel(modelElement.getName());
  property.setPurpose(purpose);
  property.setDescription(description);
  property.setStatusCode(status);
  property.setVersion(version);
  EList<Information> informations=property.getInformations();
  InformationLevel maxLevel=null;
  for (  Information information : informations) {
    int value=information.getLevel().getValue();
    if (maxLevel == null || value > maxLevel.getValue()) {
      maxLevel=information.getLevel();
    }
  }
  property.setMaxInformationLevel(maxLevel);
}