nus-yam/ex-repair huggingface dataset:
Program: 118518
Project: 118518
Buggy source:
public boolean loginAuto(){
  ConnectionBean connBean=getConnection();
  User user=getUser(connBean);
  setRepositoryContextInContext(connBean,user,null,null);
  boolean isRemoteConnection=LoginHelper.isRemoteConnection(connBean);
  if (isRemoteConnection) {
    boolean isStudioNeedUpdate=false;
    try {
      isStudioNeedUpdate=isStudioNeedUpdate(connBean);
    }
 catch (    SystemException e) {
      isStudioNeedUpdate=false;
    }
    if (isStudioNeedUpdate) {
      return false;
    }
  }
  Project lastUsedProject=getLastUsedProject(getProjects(connBean));
  if (lastUsedProject == null) {
    return false;
  }
  String projectName=lastUsedProject.getTechnicalLabel();
  String projectUrl=svnProviderService.getProjectUrl(lastUsedProject);
  String lastUsedBranch=prefManipulator.getLastSVNBranch(projectUrl,projectName);
  if (isRemoteConnection) {
    List<String> branches=null;
    try {
      branches=getProjectBranches(lastUsedProject);
    }
 catch (    JSONException e) {
      e.printStackTrace();
    }
    if (branches == null || branches.isEmpty()) {
      return false;
    }
    if (!branches.contains(lastUsedBranch)) {
      MessageDialog.openError(getUsableShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
      return false;
    }
  }
 else {
    if (lastUsedBranch == null || lastUsedBranch.trim().isEmpty()) {
      lastUsedBranch=null;
    }
  }
  setRepositoryContextInContext(connBean,user,lastUsedProject,lastUsedBranch);
  return logIn(connBean,lastUsedProject);
}

Fixed version (ground truth):
public boolean loginAuto(){
  ConnectionBean connBean=getConnection();
  User user=getUser(connBean);
  setRepositoryContextInContext(connBean,user,null,null);
  boolean isRemoteConnection=LoginHelper.isRemoteConnection(connBean);
  if (isRemoteConnection) {
    boolean isStudioNeedUpdate=false;
    try {
      isStudioNeedUpdate=isStudioNeedUpdate(connBean);
    }
 catch (    SystemException e) {
      isStudioNeedUpdate=false;
    }
    if (isStudioNeedUpdate) {
      return false;
    }
  }
  Project lastUsedProject=getLastUsedProject(getProjects(connBean));
  if (lastUsedProject == null) {
    return false;
  }
  String lastUsedBranch=null;
  if (isRemoteConnection) {
    if (svnProviderService != null) {
      String projectUrl=svnProviderService.getProjectUrl(lastUsedProject);
      String projectName=lastUsedProject.getTechnicalLabel();
      lastUsedBranch=prefManipulator.getLastSVNBranch(projectUrl,projectName);
    }
    List<String> branches=null;
    try {
      branches=getProjectBranches(lastUsedProject);
    }
 catch (    JSONException e) {
      e.printStackTrace();
    }
    if (branches == null || branches.isEmpty()) {
      return false;
    }
    if (!branches.contains(lastUsedBranch)) {
      MessageDialog.openError(getUsableShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
      return false;
    }
  }
  setRepositoryContextInContext(connBean,user,lastUsedProject,lastUsedBranch);
  return logIn(connBean,lastUsedProject);
}
Program: 118525
Project: 118525
Buggy source:
/** 
 * method "saveQuery" use save inputed Query to EMF's xml File.
 * @param repositoryNode current RepositoryNode
 * @param query need to save Query
 */
@SuppressWarnings("String_Node_Str") private void saveEMFQuery(String id,Query query,String oldQuery){
  DatabaseConnectionItem item=getEMFItem(id);
  if (query != null) {
    Query query3=ConnectionFactory.eINSTANCE.createQuery();
    query3.setComment(query.getComment());
    query3.setLabel(query.getLabel());
    query3.setValue(query.getValue());
    query3.setContextMode(query.isContextMode());
    Connection connection=item.getConnection();
    QueriesConnection queriesConnection=connection.getQueries();
    if (queriesConnection == null) {
      QueriesConnection qc=ConnectionFactory.eINSTANCE.createQueriesConnection();
      qc.setConnection(connection);
      qc.getQuery().add(query3);
      assignQueryId(query3,qc);
    }
 else {
      List<Query> queries=queriesConnection.getQuery();
      boolean isModify=false;
      for (      Query query2 : queries) {
        if (oldQuery != null && (query2.getLabel().equals(oldQuery)) || query2.getLabel().equals(query3.getLabel())) {
          query2.setComment(query3.getComment());
          query2.setId(query3.getId());
          query2.setValue(query3.getValue());
          query2.setLabel(query3.getLabel());
          query2.setContextMode(query3.isContextMode());
          isModify=true;
        }
        assignQueryId(query2,queriesConnection);
      }
      if (!isModify) {
        queriesConnection.getQuery().add(query3);
        assignQueryId(query3,queriesConnection);
      }
    }
  }
  deleteNouseTables(item.getConnection());
  saveMetaData(item);
}

Fixed version (ground truth):
/** 
 * method "saveQuery" use save inputed Query to EMF's xml File.
 * @param repositoryNode current RepositoryNode
 * @param query need to save Query
 */
private void saveEMFQuery(String id,Query query,String oldQuery){
  DatabaseConnectionItem item=getEMFItem(id);
  if (query != null) {
    Connection connection=item.getConnection();
    QueriesConnection queriesConnection=connection.getQueries();
    if (queriesConnection == null) {
      queriesConnection=ConnectionFactory.eINSTANCE.createQueriesConnection();
      queriesConnection.setConnection(connection);
      connection.setQueries(queriesConnection);
    }
    boolean isModify=false;
    List<Query> queries=queriesConnection.getQuery();
    for (    Query query2 : queries) {
      if (oldQuery != null && (query2.getLabel().equals(oldQuery)) || query2.getLabel().equals(query.getLabel())) {
        query2.setLabel(query.getLabel());
        query2.setComment(query.getComment());
        query2.setValue(query.getValue());
        query2.setContextMode(query.isContextMode());
        assignQueryId(query2,queriesConnection);
        isModify=true;
      }
    }
    if (!isModify) {
      assignQueryId(query,queriesConnection);
      queriesConnection.getQuery().add(query);
    }
  }
  deleteNouseTables(item.getConnection());
  saveMetaData(item);
}
Program: 118526
Project: 118526
Buggy source:
@SuppressWarnings("String_Node_Str") public void saveQuery(RepositoryNode repositoryNode,Query query,String oldQuery){
  saveEMFQuery(repositoryNode.getObject().getId(),query,oldQuery);
  DatabaseConnectionItem item=getItem(repositoryNode);
  if (query != null) {
    Connection connection=item.getConnection();
    QueriesConnection queriesConnection=connection.getQueries();
    if (queriesConnection == null) {
      QueriesConnection qc=ConnectionFactory.eINSTANCE.createQueriesConnection();
      qc.setConnection(connection);
      qc.getQuery().add(query);
      assignQueryId(query,qc);
    }
 else {
      List<Query> queries=queriesConnection.getQuery();
      boolean isModify=false;
      for (      Query query2 : queries) {
        if (query2.getLabel().equals(query.getLabel())) {
          query2.setComment(query.getComment());
          query2.setId(query.getId());
          query2.setValue(query.getValue());
          query2.setContextMode(query.isContextMode());
          isModify=true;
        }
        assignQueryId(query2,queriesConnection);
      }
      if (!isModify) {
        queriesConnection.getQuery().add(query);
        assignQueryId(query,queriesConnection);
      }
    }
  }
}

Fixed version (ground truth):
public void saveQuery(RepositoryNode repositoryNode,Query query,String oldQuery){
  saveEMFQuery(repositoryNode.getObject().getId(),query,oldQuery);
}
Program: 118527
Project: 118527
Buggy source:
protected boolean checkNodes(Item item,ProcessType processType) throws Exception {
  boolean modified=false;
  ComponentCategory category=ComponentCategory.getComponentCategoryFromItem(item);
  for (  Object nodeObjectType : processType.getNode()) {
    NodeType nodeType=(NodeType)nodeObjectType;
    IComponent component=ComponentsFactoryProvider.getInstance().get(nodeType.getComponentName(),category.getName());
    if (component == null) {
      continue;
    }
    FakeNode fNode=new FakeNode(component);
    for (    Object paramObjectType : nodeType.getElementParameter()) {
      ElementParameterType param=(ElementParameterType)paramObjectType;
      IElementParameter paramFromEmf=fNode.getElementParameter(param.getName());
      if (paramFromEmf != null) {
        if (EParameterFieldType.PASSWORD.equals(paramFromEmf.getFieldType()) && param.getValue() != null) {
          param.setField(EParameterFieldType.PASSWORD.getName());
          if (reencryptValueIfNeeded(param)) {
            modified=true;
          }
        }
      }
    }
  }
  return modified;
}

Fixed version (ground truth):
protected boolean checkNodes(Item item,ProcessType processType) throws Exception {
  boolean modified=false;
  if (!checkNodesFromEmf(item,processType)) {
    ComponentCategory category=ComponentCategory.getComponentCategoryFromItem(item);
    for (    Object nodeObjectType : processType.getNode()) {
      NodeType nodeType=(NodeType)nodeObjectType;
      IComponent component=ComponentsFactoryProvider.getInstance().get(nodeType.getComponentName(),category.getName());
      if (component == null) {
        continue;
      }
      FakeNode fNode=new FakeNode(component);
      for (      Object paramObjectType : nodeType.getElementParameter()) {
        ElementParameterType param=(ElementParameterType)paramObjectType;
        IElementParameter paramFromEmf=fNode.getElementParameter(param.getName());
        if (paramFromEmf != null) {
          if (EParameterFieldType.PASSWORD.equals(paramFromEmf.getFieldType()) && param.getValue() != null) {
            param.setField(EParameterFieldType.PASSWORD.getName());
            if (reencryptValueIfNeeded(param)) {
              modified=true;
            }
          }
        }
      }
    }
  }
  return modified;
}
Program: 118528
Project: 118528
Buggy source:
/** 
 * same as UnifyPasswordEncryption4ContextMigrationTask to change the encryption.
 */
@SuppressWarnings("String_Node_Str") protected boolean checkContext(Item item,ProcessType processType) throws Exception {
  boolean modified=false;
  EList contextList=processType.getContext();
  for (  Object o : contextList) {
    if (o instanceof ContextType) {
      List<ContextParameterType> paramTypes=((ContextType)o).getContextParameter();
      if (paramTypes != null) {
        for (        ContextParameterType param : paramTypes) {
          String value=param.getValue();
          if (value != null && PasswordEncryptUtil.isPasswordType(param.getType())) {
            try {
              String rawPassword=PasswordEncryptUtil.decryptPassword(value);
              param.setRawValue(rawPassword);
            }
 catch (            Exception e) {
              param.setRawValue(value);
            }
            modified=true;
          }
        }
      }
    }
  }
  return modified;
}

Fixed version (ground truth):
/** 
 * same as UnifyPasswordEncryption4ContextMigrationTask to change the encryption.
 */
@SuppressWarnings("String_Node_Str") protected boolean checkContext(Item item,ProcessType processType) throws Exception {
  boolean modified=false;
  EList contextList=processType.getContext();
  for (  Object o : contextList) {
    if (o instanceof ContextType) {
      List<ContextParameterType> paramTypes=((ContextType)o).getContextParameter();
      if (paramTypes != null) {
        for (        ContextParameterType param : paramTypes) {
          String value=param.getValue();
          if (value != null && (PasswordEncryptUtil.isPasswordType(param.getType()) || PasswordEncryptUtil.isPasswordField(param.getName()))) {
            try {
              String rawPassword=PasswordEncryptUtil.decryptPassword(value);
              param.setRawValue(rawPassword);
            }
 catch (            Exception e) {
              param.setRawValue(value);
            }
            modified=true;
          }
        }
      }
    }
  }
  return modified;
}
Program: 118534
Project: 118534
Buggy source:
private Object getGenericRepositoryValue(GenericConnection connection,List<ComponentProperties> componentProperties,String value,IMetadataTable table){
  if (componentProperties != null && value != null) {
    String seletetedMetadataTableName=getSeletetedMetadataTableName(table);
    for (    ComponentProperties compPro : componentProperties) {
      if (seletetedMetadataTableName != null) {
        if (!compPro.getName().equals(seletetedMetadataTableName)) {
          continue;
        }
      }
      Property property=compPro.getValuedProperty(value);
      if (property != null) {
        Object paramValue=property.getValue();
        if (Property.Type.STRING.equals(property.getType()) && paramValue != null) {
          return getRepositoryValueOfStringType(connection,StringUtils.trimToNull(paramValue.toString()));
        }
        return paramValue;
      }
    }
    if (value.indexOf(IGenericConstants.EXP_SEPARATOR) != -1) {
      return getGenericRepositoryValue(connection,componentProperties,value.substring(value.indexOf(IGenericConstants.EXP_SEPARATOR) + 1),table);
    }
  }
  return null;
}

Fixed version (ground truth):
private Object getGenericRepositoryValue(GenericConnection connection,List<ComponentProperties> componentProperties,String value,IMetadataTable table){
  if (componentProperties != null && value != null) {
    String seletetedMetadataTableName=getSeletetedMetadataTableName(table);
    for (    ComponentProperties compPro : componentProperties) {
      if (seletetedMetadataTableName != null) {
        if (!compPro.getName().equals(seletetedMetadataTableName)) {
          continue;
        }
      }
      Property property=compPro.getValuedProperty(value);
      if (property != null) {
        Object paramValue=property.getValue();
        if (Property.Type.STRING.equals(property.getType()) && paramValue != null) {
          return getRepositoryValueOfStringType(connection,paramValue.toString());
        }
        return paramValue;
      }
    }
    if (value.indexOf(IGenericConstants.EXP_SEPARATOR) != -1) {
      return getGenericRepositoryValue(connection,componentProperties,value.substring(value.indexOf(IGenericConstants.EXP_SEPARATOR) + 1),table);
    }
  }
  return null;
}
Program: 118535
Project: 118535
Buggy source:
private Connector getConnector(){
  if (myConnector == null) {
    Set<? extends Connector> connectors=getParentNode().getComponentProperties().getAvailableConnectors(null,true);
    for (    Connector connector : connectors) {
      if (connector.getName().equals(genericConnectorType)) {
        myConnector=connector;
        break;
      }
    }
  }
  return myConnector;
}

Fixed version (ground truth):
private Connector getConnector(){
  if (myConnector == null) {
    Set<? extends Connector> connectors=getParentNode().getComponentProperties().getAvailableConnectors(null,true);
    if (connectors != null) {
      for (      Connector connector : connectors) {
        if (connector.getName().equals(genericConnectorType)) {
          myConnector=connector;
          break;
        }
      }
    }
  }
  return myConnector;
}
Program: 118545
Project: 118545
Buggy source:
public static void updateComponentSchema(ComponentProperties componentProperties,String schemaPropertyName,IMetadataTable metadataTable,IElementParameter param){
  if (componentProperties == null || schemaPropertyName == null || metadataTable == null) {
    return;
  }
  Schema schema=convertTalendSchemaIntoComponentSchema(ConvertionHelper.convert(metadataTable));
  componentProperties.setValue(schemaPropertyName,schema);
  Map<String,String> additionalProperties=metadataTable.getAdditionalProperties();
  additionalProperties.put(IComponentConstants.COMPONENT_PROPERTIES_TAG,componentProperties.toSerialized());
  additionalProperties.put(IComponentConstants.COMPONENT_SCHEMA_TAG,schemaPropertyName);
  if (param != null) {
    param.setValue(schema.toString());
  }
}

Fixed version (ground truth):
public static void updateComponentSchema(INode node,IMetadataTable metadataTable){
  if (node == null || metadataTable == null || node.getComponentProperties() == null) {
    return;
  }
  Schema schema=convertTalendSchemaIntoComponentSchema(ConvertionHelper.convert(metadataTable));
  INodeConnector connector=node.getConnectorFromName(metadataTable.getAttachedConnector());
  if (connector != null && connector instanceof GenericNodeConnector) {
    node.getComponentProperties().setConnectedSchema(((GenericNodeConnector)connector).getComponentConnector(),schema,true);
    for (    IElementParameter param : node.getElementParameters()) {
      if (EParameterFieldType.SCHEMA_REFERENCE.equals(param.getFieldType()) && connector.getName().equals(param.getContext())) {
        param.setValue(schema);
      }
    }
  }
}
Program: 118551
Project: 118551
Buggy source:
@Override protected ElementParameterType getParameterType(NodeType node,String paramName){
  ElementParameterType paramType=ParameterUtilTool.findParameterType(node,paramName);
  if (node != null && paramType != null) {
    Object value=ParameterUtilTool.convertParameterValue(paramType);
    if ("String_Node_Str".equals(paramName) && "String_Node_Str".equals(value)) {
      paramName="String_Node_Str";
      paramType=ParameterUtilTool.findParameterType(node,paramName);
    }
 else     if ("String_Node_Str".equals(paramName) && value != null && !"String_Node_Str".equals(value)) {
      ElementParameterType useConnection=ParameterUtilTool.findParameterType(node,"String_Node_Str");
      if (useConnection != null && Boolean.valueOf(String.valueOf(ParameterUtilTool.convertParameterValue(useConnection)))) {
        return paramType;
      }
 else {
        return null;
      }
    }
 else     if ("String_Node_Str".equals(paramName)) {
      Object parmValue=ParameterUtilTool.convertParameterValue(paramType);
      if ("String_Node_Str".equals(parmValue)) {
        paramType.setValue("String_Node_Str");
      }
 else {
        paramType.setValue("String_Node_Str");
      }
    }
  }
  return paramType;
}

Fixed version (ground truth):
@Override protected ElementParameterType getParameterType(NodeType node,String paramName){
  ElementParameterType paramType=ParameterUtilTool.findParameterType(node,paramName);
  if (node != null && paramType != null) {
    Object value=ParameterUtilTool.convertParameterValue(paramType);
    if ("String_Node_Str".equals(paramName) && "String_Node_Str".equals(value)) {
      paramName="String_Node_Str";
      paramType=ParameterUtilTool.findParameterType(node,paramName);
    }
 else     if ("String_Node_Str".equals(paramName) && value != null && !"String_Node_Str".equals(value)) {
      ElementParameterType useConnection=ParameterUtilTool.findParameterType(node,"String_Node_Str");
      if (useConnection != null && Boolean.valueOf(String.valueOf(ParameterUtilTool.convertParameterValue(useConnection)))) {
        return paramType;
      }
 else {
        return null;
      }
    }
 else     if ("String_Node_Str".equals(paramName)) {
      if ("String_Node_Str".equals(value)) {
        paramType.setValue("String_Node_Str");
      }
 else {
        paramType.setValue("String_Node_Str");
      }
    }
 else     if ("String_Node_Str".equals(paramName)) {
      if ("String_Node_Str".equals(value)) {
        paramType.setValue("String_Node_Str");
      }
 else       if ("String_Node_Str".equals(value)) {
        paramType.setValue("String_Node_Str");
      }
    }
  }
  return paramType;
}
Program: 118552
Project: 118552
Buggy source:
public static Object convertParameterValue(ElementParameterType paramType){
  String paramName=paramType.getName();
  String paramValue=paramType.getValue();
  if (paramName != null && paramValue != null) {
    if (EParameterFieldType.PASSWORD.getName().equals(paramType.getField())) {
      try {
        return CryptoHelper.getDefault().decrypt(paramValue);
      }
 catch (      Exception e) {
        return paramValue;
      }
    }
    if ("String_Node_Str".equalsIgnoreCase(paramName)) {
      return paramValue=paramValue.substring(0,1).toUpperCase() + paramValue.substring(1).toLowerCase();
    }
 else     if ("String_Node_Str".equalsIgnoreCase(paramName)) {
      return paramValue.toUpperCase();
    }
    if ("String_Node_Str".equalsIgnoreCase(paramValue)) {
      return true;
    }
 else     if ("String_Node_Str".equalsIgnoreCase(paramValue)) {
      return false;
    }
  }
  return paramValue;
}

Fixed version (ground truth):
public static Object convertParameterValue(ElementParameterType paramType){
  String paramName=paramType.getName();
  String paramValue=paramType.getValue();
  if (paramName != null && paramValue != null) {
    if (EParameterFieldType.PASSWORD.getName().equals(paramType.getField())) {
      try {
        return CryptoHelper.getDefault().decrypt(paramValue);
      }
 catch (      Exception e) {
        return paramValue;
      }
    }
    if ("String_Node_Str".equalsIgnoreCase(paramName)) {
      return paramValue.toUpperCase();
    }
    if ("String_Node_Str".equalsIgnoreCase(paramValue)) {
      return true;
    }
 else     if ("String_Node_Str".equalsIgnoreCase(paramValue)) {
      return false;
    }
  }
  return paramValue;
}
Program: 118553
Project: 118553
Buggy source:
@Override public Control createControl(Composite subComposite,IElementParameter param,int numInRow,int nbInRow,int top,Control lastControl){
  Control lastControlUsed=super.createControl(subComposite,param,numInRow,nbInRow,top,lastControl);
  if (labelText != null) {
    labelText.setEchoChar('*');
  }
  FormData data=(FormData)lastControlUsed.getLayoutData();
  if (!param.isRepositoryValueUsed() && !isInWizard()) {
    data.right=new FormAttachment((numInRow * MAX_PERCENT) / nbInRow,-STANDARD_BUTTON_WIDTH);
    lastControlUsed=addButton(subComposite,param,lastControlUsed,numInRow,nbInRow,top);
  }
  return lastControlUsed;
}

Fixed version (ground truth):
@Override public Control createControl(Composite subComposite,IElementParameter param,int numInRow,int nbInRow,int top,Control lastControl){
  if (param.isRepositoryValueUsed() || isInWizard()) {
    String pwd=CryptoHelper.getDefault().decrypt(String.valueOf(param.getValue()));
    if (pwd != null) {
      param.setValue(pwd);
    }
  }
  Control lastControlUsed=super.createControl(subComposite,param,numInRow,nbInRow,top,lastControl);
  if (labelText != null) {
    labelText.setEchoChar('*');
  }
  FormData data=(FormData)lastControlUsed.getLayoutData();
  if (!param.isRepositoryValueUsed() && !isInWizard()) {
    data.right=new FormAttachment((numInRow * MAX_PERCENT) / nbInRow,-STANDARD_BUTTON_WIDTH);
    lastControlUsed=addButton(subComposite,param,lastControlUsed,numInRow,nbInRow,top);
  }
  return lastControlUsed;
}
Program: 118554
Project: 118554
Buggy source:
public String getCodegenValue(Property property,String value){
  if (property.isFlag(Property.Flags.ENCRYPT)) {
    return ElementParameterParser.getEncryptedValue(value);
  }
  if (Boolean.valueOf(String.valueOf(property.getTaggedValue(IGenericConstants.ADD_QUOTES)))) {
    return "String_Node_Str" + value + "String_Node_Str";
  }
  if (property.getType() == Property.Type.ENUM) {
    return "String_Node_Str" + value + "String_Node_Str";
  }
  if (property.getType() == Property.Type.SCHEMA) {
    return "String_Node_Str" + value.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
  }
  return value;
}

Fixed version (ground truth):
public String getCodegenValue(Property property,String value){
  if (property.isFlag(Property.Flags.ENCRYPT)) {
    return ElementParameterParser.getEncryptedValue(value);
  }
  if (Boolean.valueOf(String.valueOf(property.getTaggedValue(IGenericConstants.ADD_QUOTES)))) {
    return "String_Node_Str" + value + "String_Node_Str";
  }
  if (property.getType() == Property.Type.ENUM) {
    if (value.indexOf("String_Node_Str") > -1 || value.indexOf("String_Node_Str") > -1) {
      return value;
    }
 else {
      return "String_Node_Str" + value + "String_Node_Str";
    }
  }
  if (property.getType() == Property.Type.SCHEMA) {
    return "String_Node_Str" + value.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
  }
  return value;
}
Program: 118557
Project: 118557
Buggy source:
@Override public void generateItemFiles(boolean withDependencies,IProgressMonitor monitor) throws Exception {
  IFolder baseFolder=talendProcessJavaProject.getItemsFolder();
  baseFolder=baseFolder.getFolder(JavaResourcesHelper.getJobFolderName(processItem.getProperty().getLabel(),processItem.getProperty().getVersion()));
  if (baseFolder.exists()) {
    talendProcessJavaProject.cleanFolder(monitor,baseFolder);
  }
 else {
    baseFolder.create(true,true,null);
  }
  IFolder itemsFolder=baseFolder.getFolder("String_Node_Str");
  itemsFolder.create(true,true,monitor);
  List<Item> items=new ArrayList<Item>();
  items.add(processItem);
  if (isOptionChoosed(ExportChoice.needJobItem)) {
    ExportItemUtil exportItemUtil=new ExportItemUtil();
    if (withDependencies) {
      Collection<IRepositoryViewObject> allProcessDependencies=ProcessUtils.getAllProcessDependencies(items);
      for (      IRepositoryViewObject repositoryObject : allProcessDependencies) {
        items.add(repositoryObject.getProperty().getItem());
      }
    }
    File destination=new File(itemsFolder.getLocation().toFile().getAbsolutePath());
    exportItemUtil.setProjectNameAsLowerCase(isProjectNameLowerCase());
    exportItemUtil.exportItems(destination,new ArrayList<Item>(items),false,new NullProgressMonitor());
  }
  addDQDependencies(itemsFolder,items);
  addTDMDependencies(itemsFolder,items);
}

Fixed version (ground truth):
@Override public void generateItemFiles(boolean withDependencies,IProgressMonitor monitor) throws Exception {
  IFolder baseFolder=talendProcessJavaProject.getItemsFolder();
  baseFolder=baseFolder.getFolder(JavaResourcesHelper.getJobFolderName(processItem.getProperty().getLabel(),processItem.getProperty().getVersion()));
  if (baseFolder.exists()) {
    talendProcessJavaProject.cleanFolder(monitor,baseFolder);
  }
 else {
    baseFolder.create(true,true,null);
  }
  IFolder itemsFolder=baseFolder.getFolder("String_Node_Str");
  itemsFolder.create(true,true,monitor);
  List<Item> items=new ArrayList<Item>();
  items.add(processItem);
  ExportItemUtil exportItemUtil=new ExportItemUtil();
  if (withDependencies) {
    Collection<IRepositoryViewObject> allProcessDependencies=ProcessUtils.getAllProcessDependencies(items);
    for (    IRepositoryViewObject repositoryObject : allProcessDependencies) {
      items.add(repositoryObject.getProperty().getItem());
    }
  }
  if (isOptionChoosed(ExportChoice.needJobItem)) {
    File destination=new File(itemsFolder.getLocation().toFile().getAbsolutePath());
    exportItemUtil.setProjectNameAsLowerCase(isProjectNameLowerCase());
    exportItemUtil.exportItems(destination,new ArrayList<Item>(items),false,new NullProgressMonitor());
  }
  addDQDependencies(itemsFolder,items);
  addTDMDependencies(itemsFolder,items);
}
Program: 118558
Project: 118558
Buggy source:
protected String getDisplayNameFromValue(IElementParameter param,String value){
  int index=param.getIndexOfItemFromList(value);
  if (index == -1) {
    fastInitializeRepositoryNames(param);
    if (param.getListItemsDisplayName().length == 0) {
      return "String_Node_Str";
    }
    index=param.getIndexOfItemFromList(value);
    if (index == -1) {
      return "String_Node_Str";
    }
  }
  return param.getListItemsDisplayName()[index];
}

Fixed version (ground truth):
protected String getDisplayNameFromValue(IElementParameter param,String value){
  int index=param.getIndexOfItemFromList(value);
  IElementParameter infoObjectParam=param.getElement().getElementParameter("String_Node_Str");
  if (infoObjectParam != null && infoObjectParam.getValue() != null) {
    index=-1;
  }
  if (index == -1) {
    fastInitializeRepositoryNames(param);
    if (param.getListItemsDisplayName().length == 0) {
      return "String_Node_Str";
    }
    index=param.getIndexOfItemFromList(value);
    if (index == -1) {
      return "String_Node_Str";
    }
  }
  return param.getListItemsDisplayName()[index];
}
Program: 118561
Project: 118561
Buggy source:
public DynamicComposite(Composite parentComposite,int styles,EComponentCategory section,Element element,boolean isCompactView,Color backgroundColor,Form form,boolean drivedByForm){
  super(parentComposite,styles,section,element,isCompactView,backgroundColor);
  this.element=element;
  this.form=form;
  this.drivedByForm=drivedByForm;
  checker=new Checker();
  internalService=new GenericWizardInternalService();
  if (drivedByForm) {
    internalService.getComponentService().makeFormCancelable((ComponentProperties)form.getProperties(),form.getName());
  }
}

Fixed version (ground truth):
public DynamicComposite(Composite parentComposite,int styles,EComponentCategory section,Element element,boolean isCompactView,Color backgroundColor,Form form,boolean drivedByForm){
  super(parentComposite,styles,section,element,isCompactView,backgroundColor);
  this.element=element;
  this.form=form;
  this.drivedByForm=drivedByForm;
  checker=new Checker();
  internalService=new GenericWizardInternalService();
  if (drivedByForm) {
    internalService.getComponentService().makeFormCancelable((ComponentProperties)form.getProperties(),form.getName());
  }
  resetParameters();
}
Program: 118562
Project: 118562
Buggy source:
@Override public Object getElementParameterValueFromComponentProperties(INode iNode,IElementParameter param){
  if (iNode != null) {
    ComponentProperties iNodeComponentProperties=iNode.getComponentProperties();
    if (iNodeComponentProperties != null && param instanceof GenericElementParameter) {
      ComponentProperties paramComponentProperties=ComponentsUtils.getCurrentComponentProperties(iNodeComponentProperties,param.getName());
      if (paramComponentProperties != null) {
        ((GenericElementParameter)param).setComponentProperties(paramComponentProperties);
        Property property=iNodeComponentProperties.getValuedProperty(param.getName());
        if (property != null) {
          if (property.getTaggedValue(IGenericConstants.REPOSITORY_VALUE) != null) {
            param.setRepositoryValue(param.getName());
            param.setRepositoryValueUsed(true);
          }
        }
        return ComponentsUtils.getGenericPropertyValue(iNodeComponentProperties,param.getName());
      }
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public Object getElementParameterValueFromComponentProperties(INode iNode,IElementParameter param){
  if (iNode != null) {
    ComponentProperties iNodeComponentProperties=iNode.getComponentProperties();
    if (iNodeComponentProperties != null && param instanceof GenericElementParameter) {
      ComponentProperties paramComponentProperties=ComponentsUtils.getCurrentComponentProperties(iNodeComponentProperties,param.getName());
      if (paramComponentProperties != null) {
        Property property=iNodeComponentProperties.getValuedProperty(param.getName());
        if (property != null) {
          if (property.getTaggedValue(IGenericConstants.REPOSITORY_VALUE) != null) {
            param.setRepositoryValue(param.getName());
            param.setRepositoryValueUsed(true);
          }
        }
        return ComponentsUtils.getGenericPropertyValue(iNodeComponentProperties,param.getName());
      }
    }
  }
  return null;
}
Program: 118563
Project: 118563
Buggy source:
public boolean callBeforePresent(){
  if (widget.isCallBeforePresent() && hasPropertyChangeListener()) {
    return new ComponentServiceCaller(widget.getContent().getDisplayName(),widget.isLongRunning()){
      @Override protected void doWork() throws Throwable {
        componentProperties=componentService.beforePropertyPresent(getParameterName(),componentProperties);
      }
    }
.call();
  }
  return false;
}

Fixed version (ground truth):
public boolean callBeforePresent(){
  if (widget.isCallBeforePresent() && hasPropertyChangeListener()) {
    return new ComponentServiceCaller(widget.getContent().getDisplayName(),widget.isLongRunning()){
      @Override protected void doWork() throws Throwable {
        componentService.beforePropertyPresent(getParameterName(),getSubProperties());
      }
    }
.call();
  }
  return false;
}
Program: 118564
Project: 118564
Buggy source:
private void update(){
  NamedThing property=componentProperties.getProperty(getParameterName());
  if (property != null && property instanceof Property) {
    List<?> values=((Property)property).getPossibleValues();
    if (values != null) {
      this.setPossibleValues(values);
    }
  }
}

Fixed version (ground truth):
private void update(){
  NamedThing property=getSubProperties().getProperty(getParameterName());
  if (property != null && property instanceof Property) {
    List<?> values=((Property)property).getPossibleValues();
    if (values != null) {
      this.setPossibleValues(values);
    }
  }
}
Program: 118565
Project: 118565
Buggy source:
private void updateSchema(){
  IElement element=this.getElement();
  if (element instanceof Node) {
    Node node=(Node)element;
    List<IMetadataTable> metadataList=node.getMetadataList();
    if (metadataList.size() > 0) {
      IMetadataTable oldTable=metadataList.get(0);
      String schemaPropertyName=oldTable.getAdditionalProperties().get(IComponentConstants.COMPONENT_SCHEMA_TAG);
      Object schemaObj=null;
      try {
        schemaObj=ComponentsUtils.getGenericPropertyValue(componentProperties,schemaPropertyName);
        if (schemaObj instanceof String) {
          schemaObj=new Schema.Parser().parse((String)schemaObj);
        }
      }
 catch (      Exception e) {
      }
      if (schemaObj != null && schemaObj instanceof Schema) {
        MetadataTable metadataTable=SchemaUtils.createSchema(oldTable.getTableName(),componentProperties,schemaPropertyName);
        IMetadataTable newTable=MetadataToolHelper.convert(metadataTable);
        if (!newTable.sameMetadataAs(oldTable)) {
          IElementParameter schemaParameter=node.getElementParameterFromField(EParameterFieldType.SCHEMA_REFERENCE);
          ChangeMetadataCommand cmd=new ChangeMetadataCommand(node,schemaParameter,oldTable,newTable,null);
          IProcess process=node.getProcess();
          if (process instanceof org.talend.designer.core.ui.editor.process.Process) {
            CommandStack commandStack=((org.talend.designer.core.ui.editor.process.Process)process).getCommandStack();
            commandStack.execute(cmd);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void updateSchema(){
  IElement element=this.getElement();
  if (element instanceof Node) {
    Node node=(Node)element;
    List<IMetadataTable> metadataList=node.getMetadataList();
    if (metadataList.size() > 0) {
      IMetadataTable oldTable=metadataList.get(0);
      String schemaPropertyName=oldTable.getAdditionalProperties().get(IComponentConstants.COMPONENT_SCHEMA_TAG);
      Object schemaObj=null;
      try {
        schemaObj=ComponentsUtils.getGenericPropertyValue(rootProperties,schemaPropertyName);
        if (schemaObj instanceof String) {
          schemaObj=new Schema.Parser().parse((String)schemaObj);
        }
      }
 catch (      Exception e) {
      }
      if (schemaObj != null && schemaObj instanceof Schema) {
        MetadataTable metadataTable=SchemaUtils.createSchema(oldTable.getTableName(),rootProperties,schemaPropertyName);
        IMetadataTable newTable=MetadataToolHelper.convert(metadataTable);
        if (!newTable.sameMetadataAs(oldTable)) {
          IElementParameter schemaParameter=node.getElementParameterFromField(EParameterFieldType.SCHEMA_REFERENCE);
          ChangeMetadataCommand cmd=new ChangeMetadataCommand(node,schemaParameter,oldTable,newTable,null);
          IProcess process=node.getProcess();
          if (process instanceof org.talend.designer.core.ui.editor.process.Process) {
            CommandStack commandStack=((org.talend.designer.core.ui.editor.process.Process)process).getCommandStack();
            commandStack.execute(cmd);
          }
        }
      }
    }
  }
}
Program: 118566
Project: 118566
Buggy source:
private boolean callValidate(){
  if (widget.isCallValidate() && hasPropertyChangeListener()) {
    return new ComponentServiceCaller(widget.getContent().getDisplayName(),widget.isLongRunning()){
      @Override protected void doWork() throws Throwable {
        componentProperties=componentService.validateProperty(getParameterName(),componentProperties);
      }
    }
.call();
  }
  return false;
}

Fixed version (ground truth):
private boolean callValidate(){
  if (widget.isCallValidate() && hasPropertyChangeListener()) {
    return new ComponentServiceCaller(widget.getContent().getDisplayName(),widget.isLongRunning()){
      @Override protected void doWork() throws Throwable {
        componentService.validateProperty(getParameterName(),getSubProperties());
      }
    }
.call();
  }
  return false;
}
Program: 118567
Project: 118567
Buggy source:
private void updateProperty(Object newValue){
  if (componentProperties == null) {
    return;
  }
  NamedThing widgetProperty=widget.getContent();
  if (widgetProperty instanceof Property) {
    Property se=(Property)widgetProperty;
    Object oldValue=se.getValue();
    if (newValue != null && !newValue.equals(oldValue)) {
      se=(Property)componentProperties.getProperty(se.getName());
      if (isDrivedByForm()) {
        form.setValue(se.getName(),newValue);
      }
 else {
        if (newValue instanceof List && WidgetType.TABLE.equals(widget.getWidgetType())) {
          setTableValues(se,(List<Map<String,Object>>)newValue);
        }
 else {
          se.setValue(newValue);
        }
      }
      fireConnectionPropertyChangedEvent(newValue);
    }
  }
 else   if (widgetProperty instanceof PresentationItem) {
    PresentationItem pi=(PresentationItem)widgetProperty;
    Form formtoShow=pi.getFormtoShow();
    if (formtoShow != null) {
      fireShowDialogEvent(componentProperties.getForm(formtoShow.getName()));
    }
  }
}

Fixed version (ground truth):
private void updateProperty(Object newValue){
  if (getSubProperties() == null) {
    return;
  }
  NamedThing widgetProperty=widget.getContent();
  if (widgetProperty instanceof Property) {
    Property se=(Property)widgetProperty;
    Object oldValue=se.getValue();
    if (newValue != null && !newValue.equals(oldValue)) {
      se=(Property)getSubProperties().getProperty(se.getName());
      if (isDrivedByForm()) {
        form.setValue(se.getName(),newValue);
      }
 else {
        if (newValue instanceof List && WidgetType.TABLE.equals(widget.getWidgetType())) {
          setTableValues(se,(List<Map<String,Object>>)newValue);
        }
 else {
          se.setValue(newValue);
        }
      }
      fireConnectionPropertyChangedEvent(newValue);
    }
  }
 else   if (widgetProperty instanceof PresentationItem) {
    PresentationItem pi=(PresentationItem)widgetProperty;
    Form formtoShow=pi.getFormtoShow();
    if (formtoShow != null) {
      fireShowDialogEvent(getSubProperties().getForm(formtoShow.getName()));
    }
  }
}
Program: 118568
Project: 118568
Buggy source:
public GenericElementParameter(IElement element,ComponentProperties componentProperties,Form form,Widget widget,ComponentService componentService){
  super(element);
  this.componentProperties=componentProperties;
  this.form=form;
  this.widget=widget;
  this.componentService=componentService;
  isFirstCall=true;
  NamedThing widgetProperty=widget.getContent();
  setName(widgetProperty.getName());
  setDisplayName(widgetProperty.getDisplayName());
}

Fixed version (ground truth):
public GenericElementParameter(IElement element,ComponentProperties rootProperties,Form form,Widget widget,ComponentService componentService){
  super(element);
  this.rootProperties=rootProperties;
  this.form=form;
  this.widget=widget;
  this.componentService=componentService;
  isFirstCall=true;
  NamedThing widgetProperty=widget.getContent();
  setName(widgetProperty.getName());
  setDisplayName(widgetProperty.getDisplayName());
}
Program: 118569
Project: 118569
Buggy source:
private void fireValidateStatusEvent(){
  if (hasPropertyChangeListener()) {
    this.pcs.firePropertyChange(IElementParameterEventProperties.EVENT_VALIDATE_RESULT_UPDATE,null,componentProperties.getValidationResult());
  }
}

Fixed version (ground truth):
private void fireValidateStatusEvent(){
  if (hasPropertyChangeListener()) {
    this.pcs.firePropertyChange(IElementParameterEventProperties.EVENT_VALIDATE_RESULT_UPDATE,null,getSubProperties().getValidationResult());
  }
}
Program: 118570
Project: 118570
Buggy source:
public boolean callBeforeActivate(){
  if (widget.isCallBeforeActivate() && hasPropertyChangeListener()) {
    return new ComponentServiceCaller(widget.getContent().getDisplayName(),widget.isLongRunning()){
      @Override protected void doWork() throws Throwable {
        componentProperties=componentService.beforePropertyActivate(getParameterName(),componentProperties);
        update();
      }
    }
.call();
  }
  return false;
}

Fixed version (ground truth):
public boolean callBeforeActivate(){
  if (widget.isCallBeforeActivate() && hasPropertyChangeListener()) {
    return new ComponentServiceCaller(widget.getContent().getDisplayName(),widget.isLongRunning()){
      @Override protected void doWork() throws Throwable {
        componentService.beforePropertyActivate(getParameterName(),getSubProperties());
        update();
      }
    }
.call();
  }
  return false;
}
Program: 118571
Project: 118571
Buggy source:
private boolean callAfter(){
  if (widget.isCallAfter() && hasPropertyChangeListener()) {
    return new ComponentServiceCaller(widget.getContent().getDisplayName(),widget.isLongRunning()){
      @Override protected void doWork() throws Throwable {
        componentProperties=componentService.afterProperty(getParameterName(),componentProperties);
        updateSchema();
      }
    }
.call();
  }
  return false;
}

Fixed version (ground truth):
private boolean callAfter(){
  if (widget.isCallAfter() && hasPropertyChangeListener()) {
    return new ComponentServiceCaller(widget.getContent().getDisplayName(),widget.isLongRunning()){
      @Override protected void doWork() throws Throwable {
        componentService.afterProperty(getParameterName(),getSubProperties());
        updateSchema();
      }
    }
.call();
  }
  return false;
}
Program: 118572
Project: 118572
Buggy source:
private void fireValueChangedEvent(){
  if (hasPropertyChangeListener()) {
    List<Form> forms=componentProperties.getForms();
    for (    Form f : forms) {
      if (f.isRefreshUI()) {
        this.pcs.firePropertyChange(IElementParameterEventProperties.EVENT_PROPERTY_VALUE_CHANGED,null,null);
        return;
      }
    }
  }
}

Fixed version (ground truth):
private void fireValueChangedEvent(){
  if (hasPropertyChangeListener()) {
    List<Form> forms=getSubProperties().getForms();
    for (    Form f : forms) {
      if (f.isRefreshUI()) {
        this.pcs.firePropertyChange(IElementParameterEventProperties.EVENT_PROPERTY_VALUE_CHANGED,null,null);
        return;
      }
    }
  }
}
Program: 118573
Project: 118573
Buggy source:
/** 
 * DOC ycbai Comment method "getRelatedParameters". <p> Get all element parameters related to the <code>parameter<code>. For example the paramters from the form associated with PresentationItem type.
 * @param parameters
 * @return
 */
public static List<ElementParameter> getRelatedParameters(GenericElementParameter parameter){
  List<ElementParameter> params=new ArrayList<>();
  if (parameter == null) {
    return params;
  }
  Widget widget=parameter.getWidget();
  NamedThing content=widget.getContent();
  if (content instanceof PresentationItem) {
    PresentationItem pi=(PresentationItem)content;
    Form formtoShow=pi.getFormtoShow();
    List<ElementParameter> parametersFromForm=getParametersFromForm(parameter.getElement(),parameter.getCategory(),parameter.getComponentProperties(),formtoShow);
    params.addAll(parametersFromForm);
  }
  return params;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "getRelatedParameters". <p> Get all element parameters related to the <code>parameter<code>. For example the paramters from the form associated with PresentationItem type.
 * @param parameters
 * @return
 */
public static List<ElementParameter> getRelatedParameters(GenericElementParameter parameter){
  List<ElementParameter> params=new ArrayList<>();
  if (parameter == null) {
    return params;
  }
  Widget widget=parameter.getWidget();
  NamedThing content=widget.getContent();
  if (content instanceof PresentationItem) {
    PresentationItem pi=(PresentationItem)content;
    Form formtoShow=pi.getFormtoShow();
    List<ElementParameter> parametersFromForm=getParametersFromForm(parameter.getElement(),parameter.getCategory(),parameter.getRootProperties(),formtoShow);
    params.addAll(parametersFromForm);
  }
  return params;
}
Program: 118574
Project: 118574
Buggy source:
public static ComponentProperties getCurrentComponentPropertiesSpecial(ComponentProperties componentProperties,String paramName){
  ComponentProperties currentComponentProperties=null;
  if (componentProperties == null || paramName == null) {
    return null;
  }
  List<NamedThing> allProps=componentProperties.getProperties();
  for (  NamedThing namedThing : allProps) {
    if (paramName.equals(namedThing.getName())) {
      currentComponentProperties=componentProperties;
      break;
    }
    if (namedThing instanceof ComponentProperties) {
      ComponentProperties childComponentProperties=(ComponentProperties)namedThing;
      currentComponentProperties=getCurrentComponentProperties(childComponentProperties,paramName);
    }
    if (currentComponentProperties != null) {
      break;
    }
  }
  return currentComponentProperties;
}

Fixed version (ground truth):
private static ComponentProperties getCurrentComponentPropertiesSpecial(ComponentProperties componentProperties,String paramName){
  ComponentProperties currentComponentProperties=null;
  if (componentProperties == null || paramName == null) {
    return null;
  }
  List<NamedThing> allProps=componentProperties.getProperties();
  for (  NamedThing namedThing : allProps) {
    if (paramName.equals(namedThing.getName())) {
      currentComponentProperties=componentProperties;
      break;
    }
    if (namedThing instanceof ComponentProperties) {
      ComponentProperties childComponentProperties=(ComponentProperties)namedThing;
      currentComponentProperties=getCurrentComponentProperties(childComponentProperties,paramName);
    }
    if (currentComponentProperties != null) {
      break;
    }
  }
  return currentComponentProperties;
}
Program: 118576
Project: 118576
Buggy source:
private void setGenericRepositoryValue(GenericConnection connection,INode node,IElementParameter param){
  if (connection != null && param != null && param instanceof GenericElementParameter) {
    if (connection.getCompProperties() == null) {
      GenericElementParameter genericParam=(GenericElementParameter)param;
      connection.setCompProperties(genericParam.getComponentProperties().toSerialized());
    }
  }
}

Fixed version (ground truth):
private void setGenericRepositoryValue(GenericConnection connection,INode node,IElementParameter param){
  if (connection != null && param != null && param instanceof GenericElementParameter) {
    if (connection.getCompProperties() == null) {
      GenericElementParameter genericParam=(GenericElementParameter)param;
      connection.setCompProperties(genericParam.getRootProperties().toSerialized());
    }
  }
}