nus-yam/ex-repair huggingface dataset:
Program: 118195
Project: 118195
Buggy source:
/** 
 * DOC nrousseau Comment method "setupConnector".
 * @param node
 * @param rootProperty
 * @param paramName
 * @param schemaProperty
 * @param found
 * @return
 */
private boolean setupConnector(final INode node,List<ElementParameter> listParam,String paramName,SchemaProperty schemaProperty,boolean isOutput){
  ComponentProperties rootProperty=node.getComponentProperties();
  boolean found=false;
  for (  Connector connector : rootProperty.getPossibleConnectors(isOutput)) {
    if (!(schemaProperty.getValue() instanceof Schema)) {
      continue;
    }
    Schema schema=(Schema)schemaProperty.getValue();
    if (connector instanceof PropertyPathConnector) {
      String linkedSchema=((PropertyPathConnector)connector).getPropertyPath() + "String_Node_Str";
      if (paramName.equals(linkedSchema)) {
        found=true;
        ElementParameter param=new ElementParameter(node);
        param.setName(paramName);
        param.setFieldType(EParameterFieldType.SCHEMA_REFERENCE);
        if (!isOutput) {
          param.setContext(EConnectionType.FLOW_MAIN.getName());
        }
 else {
          param.setContext(connector.getName());
        }
        param.setCategory(EComponentCategory.TECHNICAL);
        IElementParameterDefaultValue defaultValue=new ElementParameterDefaultValue();
        defaultValue.setDefaultValue(new Schema.Parser().parse(schema.toString()));
        param.getDefaultValues().add(defaultValue);
        listParam.add(param);
      }
    }
  }
  return found;
}

Fixed version (ground truth):
/** 
 * DOC nrousseau Comment method "setupConnector".
 * @param node
 * @param rootProperty
 * @param paramName
 * @param schemaProperty
 * @param found
 * @return
 */
private boolean setupConnector(final INode node,List<ElementParameter> listParam,String paramName,SchemaProperty schemaProperty,boolean isOutput){
  ComponentProperties rootProperty=node.getComponentProperties();
  boolean found=false;
  for (  Connector connector : rootProperty.getPossibleConnectors(isOutput)) {
    if (!(schemaProperty.getValue() instanceof Schema)) {
      continue;
    }
    Schema schema=schemaProperty.getValue();
    if (connector instanceof PropertyPathConnector) {
      String linkedSchema=((PropertyPathConnector)connector).getPropertyPath() + "String_Node_Str";
      if (paramName.equals(linkedSchema)) {
        found=true;
        ElementParameter param=new ElementParameter(node);
        param.setName(paramName);
        param.setFieldType(EParameterFieldType.SCHEMA_REFERENCE);
        param.setShow(false);
        if (!isOutput) {
          param.setContext(EConnectionType.FLOW_MAIN.getName());
        }
 else {
          param.setContext(connector.getName());
        }
        param.setCategory(EComponentCategory.TECHNICAL);
        IElementParameterDefaultValue defaultValue=new ElementParameterDefaultValue();
        defaultValue.setDefaultValue(new Schema.Parser().parse(schema.toString()));
        param.getDefaultValues().add(defaultValue);
        listParam.add(param);
      }
    }
  }
  return found;
}
Program: 118198
Project: 118198
Buggy source:
private Object getGenericRepositoryValue(GenericConnection connection,List<ComponentProperties> componentProperties,String value,IMetadataTable table){
  if (componentProperties != null && value != null) {
    for (    ComponentProperties compPro : componentProperties) {
      Property<?> property=compPro.getValuedProperty(value);
      if (property != null) {
        Object paramValue=property.getStoredValue();
        if (GenericTypeUtils.isStringType(property) || Boolean.valueOf(String.valueOf(property.getTaggedValue(IGenericConstants.DND_ADD_QUOTES)))) {
          if (paramValue != null) {
            return getRepositoryValueOfStringType(connection,paramValue.toString());
          }
 else {
            return TalendQuoteUtils.addQuotes("String_Node_Str");
          }
        }
 else         if (GenericTypeUtils.isEnumType(property) && paramValue != null) {
          return 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) {
    for (    ComponentProperties compPro : componentProperties) {
      Property<?> property=compPro.getValuedProperty(value);
      if (property != null) {
        Object paramValue=property.getStoredValue();
        if (GenericTypeUtils.isStringType(property) || GenericTypeUtils.isObjectType(property)) {
          if (paramValue != null) {
            return getRepositoryValueOfStringType(connection,paramValue.toString());
          }
 else {
            return TalendQuoteUtils.addQuotes("String_Node_Str");
          }
        }
 else         if (GenericTypeUtils.isEnumType(property) && paramValue != null) {
          return 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: 118200
Project: 118200
Buggy source:
protected void setTableMAPPING(){
  if (getConnection() != null) {
    String componentName=node.getComponent().getName();
    for (    IElementParameter parameter : node.getElementParameters()) {
      if (parameter.getFieldType() == EParameterFieldType.TABLE) {
        if (parameter.getRepositoryValue() != null && parameter.getRepositoryValue().equals("String_Node_Str")) {
          List<Map<String,Object>> value2=(List<Map<String,Object>>)parameter.getValue();
          RepositoryToComponentProperty.getTableXMLMappingValue(getConnection(),value2,newOutputMetadata,getColumnRenameMap());
          IElementParameter elementParameter=node.getElementParameter(EParameterName.PROPERTY_TYPE.getName());
          if (elementParameter != null) {
            if (EmfComponent.BUILTIN.equals(elementParameter.getValue())) {
              parameter.setRepositoryValueUsed(false);
            }
 else {
              parameter.setRepositoryValueUsed(true);
            }
          }
        }
 else         if (componentName != null && componentName.startsWith("String_Node_Str") && ("String_Node_Str".equals(parameter.getName()) || "String_Node_Str".equals(parameter.getName()))) {
          Object value=RepositoryToComponentProperty.getColumnMappingValue(connection,newOutputMetadata);
          if (value != null) {
            parameter.setValue(value);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
protected void setTableMAPPING(){
  if (getConnection() != null) {
    String componentName=node.getComponent().getName();
    for (    IElementParameter parameter : node.getElementParameters()) {
      if (parameter.getFieldType() == EParameterFieldType.TABLE) {
        if (parameter.getRepositoryValue() != null && parameter.getRepositoryValue().equals("String_Node_Str")) {
          List<Map<String,Object>> value2=(List<Map<String,Object>>)parameter.getValue();
          RepositoryToComponentProperty.getTableXMLMappingValue(getConnection(),value2,newOutputMetadata,getColumnRenameMap());
          IElementParameter elementParameter=node.getElementParameter(EParameterName.PROPERTY_TYPE.getName());
          if (elementParameter != null) {
            if (EmfComponent.BUILTIN.equals(elementParameter.getValue())) {
              parameter.setRepositoryValueUsed(false);
            }
 else {
              parameter.setRepositoryValueUsed(true);
            }
          }
        }
 else         if (componentName != null && (componentName.startsWith("String_Node_Str") || componentName.startsWith("String_Node_Str")) && ("String_Node_Str".equals(parameter.getName()) || "String_Node_Str".equals(parameter.getName()))) {
          Object value=RepositoryToComponentProperty.getColumnMappingValue(connection,newOutputMetadata);
          if (value != null) {
            parameter.setValue(value);
          }
        }
      }
    }
  }
}
Program: 118201
Project: 118201
Buggy source:
private TableViewerCreatorColumn createConversionFunctionColumn(TableViewerCreator<AutoConversionType> tableViewerCreator){
  TableViewerCreatorColumn column=new TableViewerCreatorColumn(tableViewerCreator);
  column.setTitle(Messages.getString("String_Node_Str"));
  column.setBeanPropertyAccessors(new IBeanPropertyAccessors<AutoConversionType,String>(){
    @Override public String get(    AutoConversionType bean){
      return bean.getConversionFunction();
    }
    @Override public void set(    AutoConversionType bean,    String value){
      bean.setConversionFunction(value);
    }
  }
);
  column.setCellEditor(new TextCellEditor(tableViewerCreator.getTable()));
  column.setModifiable(true);
  column.setWeight(60);
  column.setMinimumWidth(50);
  column.setDefaultInternalValue("String_Node_Str");
  return column;
}

Fixed version (ground truth):
private TableViewerCreatorColumn createConversionFunctionColumn(TableViewerCreator<AutoConversionType> tableViewerCreator){
  TableViewerCreatorColumn column=new TableViewerCreatorColumn(tableViewerCreator);
  column.setTitle(Messages.getString("String_Node_Str"));
  column.setBeanPropertyAccessors(new IBeanPropertyAccessors<AutoConversionType,String>(){
    @Override public String get(    AutoConversionType bean){
      return bean.getConversionFunction();
    }
    @Override public void set(    AutoConversionType bean,    String value){
      bean.setConversionFunction(value);
    }
  }
);
  column.setModifiable(true);
  column.setWeight(60);
  column.setMinimumWidth(50);
  column.setDefaultInternalValue("String_Node_Str");
  AutoConversionProposalProvider functionProposalProvider=new AutoConversionProposalProvider();
  TextCellEditorWithProposal textCellEditor=new TextCellEditorWithProposal(tableViewerCreator.getTable(),column);
  textCellEditor.setContentProposalProvider(functionProposalProvider);
  column.setCellEditor(textCellEditor);
  return column;
}
Program: 118202
Project: 118202
Buggy source:
public static void loadComponents(ComponentService service){
  IComponentsFactory componentsFactory=null;
  if (componentsFactory == null) {
    componentsFactory=ComponentsFactoryProvider.getInstance();
  }
  Set<IComponent> componentsList=componentsFactory.getComponents();
  if (components == null) {
    components=new ArrayList<IComponent>();
  }
 else {
    componentsList.removeAll(components);
  }
  Map<String,IComponent> existComponents=new HashMap<String,IComponent>();
  for (  IComponent component : componentsList) {
    existComponents.put(component.getName(),component);
  }
  Set<ComponentDefinition> componentDefinitions=service.getAllComponents();
  for (  ComponentDefinition componentDefinition : componentDefinitions) {
    try {
      Component currentComponent=new Component(componentDefinition);
      componentsList.add(currentComponent);
    }
 catch (    BusinessException e) {
      ExceptionHandler.process(e);
    }
  }
}

Fixed version (ground truth):
public static void loadComponents(ComponentService service){
  if (service == null) {
    return;
  }
  IComponentsFactory componentsFactory=null;
  if (componentsFactory == null) {
    componentsFactory=ComponentsFactoryProvider.getInstance();
  }
  Set<IComponent> componentsList=componentsFactory.getComponents();
  if (components == null) {
    components=new ArrayList<IComponent>();
  }
 else {
    componentsList.removeAll(components);
  }
  Map<String,IComponent> existComponents=new HashMap<String,IComponent>();
  for (  IComponent component : componentsList) {
    existComponents.put(component.getName(),component);
  }
  Set<ComponentDefinition> componentDefinitions=service.getAllComponents();
  for (  ComponentDefinition componentDefinition : componentDefinitions) {
    try {
      Component currentComponent=new Component(componentDefinition);
      componentsList.add(currentComponent);
    }
 catch (    BusinessException e) {
      ExceptionHandler.process(e);
    }
  }
}
Program: 118206
Project: 118206
Buggy source:
/** 
 * DOC YeXiaowei Comment method "isVirtualNode".
 * @param node
 * @return
 */
private boolean isVirtualNode(final INode node){
  boolean isVirtualNode=false;
  IElementParameter param=node.getElementParameter("String_Node_Str");
  if (param != null) {
    return (Boolean)param.getValue() && param.isRequired(node.getElementParameters());
  }
  if (node.getUniqueName().startsWith("String_Node_Str")) {
    isVirtualNode=CorePlugin.getDefault().getMapperService().isVirtualComponent(node);
  }
 else   if (node.getUniqueName().startsWith("String_Node_Str")) {
    isVirtualNode=CorePlugin.getDefault().getXMLMapperService().isVirtualComponent(node);
  }
 else   if (node.getUniqueName().startsWith("String_Node_Str")) {
    isVirtualNode=CorePlugin.getDefault().getSparkMapperService().isVirtualComponent(node);
  }
 else {
    List<IMultipleComponentManager> multipleComponentManagers=node.getComponent().getMultipleComponentManagers();
    for (    IMultipleComponentManager mcm : multipleComponentManagers) {
      if (!mcm.isLookupMode()) {
        return true;
      }
    }
  }
  if (!isVirtualNode) {
    if (node.getExternalNode() != null) {
      return node.getExternalNode().isGeneratedAsVirtualComponent();
    }
  }
  return isVirtualNode;
}

Fixed version (ground truth):
/** 
 * DOC YeXiaowei Comment method "isVirtualNode".
 * @param node
 * @return
 */
private boolean isVirtualNode(final INode node){
  boolean isVirtualNode=false;
  IElementParameter param=node.getElementParameter("String_Node_Str");
  if (param != null) {
    return (Boolean)param.getValue() && param.isRequired(node.getElementParameters());
  }
  final String componentName=node.getComponent().getName();
  if (componentName.equals("String_Node_Str")) {
    isVirtualNode=CorePlugin.getDefault().getMapperService().isVirtualComponent(node);
  }
 else   if (componentName.equals("String_Node_Str")) {
    isVirtualNode=CorePlugin.getDefault().getXMLMapperService().isVirtualComponent(node);
  }
 else   if (componentName.equals("String_Node_Str")) {
    isVirtualNode=CorePlugin.getDefault().getSparkMapperService().isVirtualComponent(node);
  }
 else {
    List<IMultipleComponentManager> multipleComponentManagers=node.getComponent().getMultipleComponentManagers();
    for (    IMultipleComponentManager mcm : multipleComponentManagers) {
      if (!mcm.isLookupMode()) {
        return true;
      }
    }
  }
  if (!isVirtualNode) {
    if (node.getExternalNode() != null) {
      return node.getExternalNode().isGeneratedAsVirtualComponent();
    }
  }
  return isVirtualNode;
}
Program: 118208
Project: 118208
Buggy source:
/** 
 * DOC YeXiaowei Comment method "isVirtualNode".
 * @param node
 * @return
 */
private boolean isVirtualNode(final INode node){
  boolean isVirtualNode=false;
  IElementParameter param=node.getElementParameter("String_Node_Str");
  if (param != null) {
    return (Boolean)param.getValue() && param.isRequired(node.getElementParameters());
  }
  if (node.getUniqueName().startsWith("String_Node_Str")) {
    isVirtualNode=CorePlugin.getDefault().getMapperService().isVirtualComponent(node);
  }
 else   if (node.getUniqueName().startsWith("String_Node_Str")) {
    isVirtualNode=CorePlugin.getDefault().getXMLMapperService().isVirtualComponent(node);
  }
 else   if (node.getUniqueName().startsWith("String_Node_Str")) {
    isVirtualNode=CorePlugin.getDefault().getSparkMapperService().isVirtualComponent(node);
  }
 else {
    List<IMultipleComponentManager> multipleComponentManagers=node.getComponent().getMultipleComponentManagers();
    for (    IMultipleComponentManager mcm : multipleComponentManagers) {
      if (!mcm.isLookupMode()) {
        return true;
      }
    }
  }
  if (!isVirtualNode) {
    if (node.getExternalNode() != null) {
      return node.getExternalNode().isGeneratedAsVirtualComponent();
    }
  }
  return isVirtualNode;
}

Fixed version (ground truth):
/** 
 * DOC YeXiaowei Comment method "isVirtualNode".
 * @param node
 * @return
 */
private boolean isVirtualNode(final INode node){
  boolean isVirtualNode=false;
  IElementParameter param=node.getElementParameter("String_Node_Str");
  if (param != null) {
    return (Boolean)param.getValue() && param.isRequired(node.getElementParameters());
  }
  final String componentName=node.getComponent().getName();
  if (componentName.equals("String_Node_Str")) {
    isVirtualNode=CorePlugin.getDefault().getMapperService().isVirtualComponent(node);
  }
 else   if (componentName.equals("String_Node_Str")) {
    isVirtualNode=CorePlugin.getDefault().getXMLMapperService().isVirtualComponent(node);
  }
 else   if (componentName.equals("String_Node_Str")) {
    isVirtualNode=CorePlugin.getDefault().getSparkMapperService().isVirtualComponent(node);
  }
 else {
    List<IMultipleComponentManager> multipleComponentManagers=node.getComponent().getMultipleComponentManagers();
    for (    IMultipleComponentManager mcm : multipleComponentManagers) {
      if (!mcm.isLookupMode()) {
        return true;
      }
    }
  }
  if (!isVirtualNode) {
    if (node.getExternalNode() != null) {
      return node.getExternalNode().isGeneratedAsVirtualComponent();
    }
  }
  return isVirtualNode;
}
Program: 118210
Project: 118210
Buggy source:
@Override public Set<IConnParamName> getContextParams(){
  Set<IConnParamName> contextParams=new HashSet<>();
  if (parameters != null) {
    for (    IElementParameter param : parameters) {
      if (param instanceof GenericElementParameter) {
        GenericElementParameter genericElementParameter=(GenericElementParameter)param;
        if (genericElementParameter.getFieldType() == EParameterFieldType.CLOSED_LIST || genericElementParameter.getFieldType() == EParameterFieldType.CHECK) {
          continue;
        }
        if (genericElementParameter.isSupportContext()) {
          GenericConnParamName connParamName=new GenericConnParamName();
          String paramName=genericElementParameter.getName();
          connParamName.setName(paramName);
          connParamName.setContextVar(getValidContextVarName(paramName));
          contextParams.add(connParamName);
        }
      }
    }
  }
  return contextParams;
}

Fixed version (ground truth):
@Override public Set<IConnParamName> getContextParams(){
  Set<IConnParamName> contextParams=new HashSet<>();
  if (parameters != null) {
    for (    IElementParameter param : parameters) {
      if (param instanceof GenericElementParameter) {
        GenericElementParameter genericElementParameter=(GenericElementParameter)param;
        if (genericElementParameter.isSupportContext()) {
          GenericConnParamName connParamName=new GenericConnParamName();
          String paramName=genericElementParameter.getName();
          connParamName.setName(paramName);
          connParamName.setContextVar(getValidContextVarName(paramName));
          contextParams.add(connParamName);
        }
      }
    }
  }
  return contextParams;
}
Program: 118212
Project: 118212
Buggy source:
public static List<IContextParameter> createContextParameters(String prefixName,Connection connection,Set<IConnParamName> paramSet){
  List<IContextParameter> varList=new ArrayList<>();
  if (connection instanceof GenericConnection) {
    GenericConnection conn=(GenericConnection)connection;
    if (conn == null || prefixName == null || paramSet == null || paramSet.isEmpty()) {
      return Collections.emptyList();
    }
    String paramPrefix=prefixName + ConnectionContextHelper.LINE;
    String paramName=null;
    for (    IConnParamName param : paramSet) {
      if (param instanceof GenericConnParamName) {
        GenericConnParamName connParamName=(GenericConnParamName)param;
        String name=connParamName.getName();
        ComponentProperties componentProperties=getComponentProperties((GenericConnection)connection);
        Property<?> property=componentProperties.getValuedProperty(name);
        paramName=paramPrefix + connParamName.getContextVar();
        JavaType type=JavaTypesManager.STRING;
        if (property.isFlag(Property.Flags.ENCRYPT)) {
          type=JavaTypesManager.PASSWORD;
        }
        if (GenericTypeUtils.isIntegerType(property)) {
          type=JavaTypesManager.INTEGER;
        }
        String value=property == null || property.getValue() == null ? null : String.valueOf(property.getValue());
        ConnectionContextHelper.createParameters(varList,paramName,value,type);
      }
    }
  }
  return varList;
}

Fixed version (ground truth):
public static List<IContextParameter> createContextParameters(String prefixName,Connection connection,Set<IConnParamName> paramSet){
  List<IContextParameter> varList=new ArrayList<>();
  if (connection instanceof GenericConnection) {
    GenericConnection conn=(GenericConnection)connection;
    if (conn == null || prefixName == null || paramSet == null || paramSet.isEmpty()) {
      return Collections.emptyList();
    }
    String paramPrefix=prefixName + ConnectionContextHelper.LINE;
    String paramName=null;
    for (    IConnParamName param : paramSet) {
      if (param instanceof GenericConnParamName) {
        GenericConnParamName connParamName=(GenericConnParamName)param;
        String name=connParamName.getName();
        ComponentProperties componentProperties=getComponentProperties((GenericConnection)connection);
        Property<?> property=componentProperties.getValuedProperty(name);
        paramName=paramPrefix + connParamName.getContextVar();
        JavaType type=JavaTypesManager.STRING;
        if (property.isFlag(Property.Flags.ENCRYPT)) {
          type=JavaTypesManager.PASSWORD;
        }
        if (GenericTypeUtils.isIntegerType(property)) {
          type=JavaTypesManager.INTEGER;
        }
        String value=property == null || property.getValue() == null ? null : StringEscapeUtils.escapeJava(String.valueOf(property.getValue()));
        ConnectionContextHelper.createParameters(varList,paramName,value,type);
      }
    }
  }
  return varList;
}
Program: 118217
Project: 118217
Buggy source:
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  if (factory.isUserReadOnlyOnCurrentProject()) {
    canWork=false;
  }
  if (canWork) {
    Object o=selection.getFirstElement();
    RepositoryNode node=(RepositoryNode)o;
switch (node.getType()) {
case REPOSITORY_ELEMENT:
      if (ERepositoryObjectType.PROCESS_STORM != null && node.getObjectType().equals(ERepositoryObjectType.PROCESS_STORM)) {
        canWork=true;
      }
 else       if (ERepositoryObjectType.PROCESS_MR != null && node.getObjectType().equals(ERepositoryObjectType.PROCESS_MR)) {
        canWork=true;
      }
 else       if (node.getObjectType() != ERepositoryObjectType.PROCESS && node.getObjectType() != ERepositoryObjectType.JOBLET) {
        canWork=false;
      }
    break;
default :
  canWork=false;
}
if (canWork && node.getObject() != null && ProxyRepositoryFactory.getInstance().getStatus(node.getObject()) == ERepositoryStatus.DELETED) {
canWork=false;
}
if (canWork && !ProjectManager.getInstance().isInCurrentMainProject(node)) {
canWork=false;
}
if (canWork) {
canWork=isLastVersion(node);
}
}
setEnabled(canWork);
}

Fixed version (ground truth):
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  if (factory.isUserReadOnlyOnCurrentProject()) {
    canWork=false;
  }
  if (canWork) {
    Object o=selection.getFirstElement();
    RepositoryNode node=(RepositoryNode)o;
switch (node.getType()) {
case REPOSITORY_ELEMENT:
      if (ERepositoryObjectType.PROCESS_STORM != null && node.getObjectType().equals(ERepositoryObjectType.PROCESS_STORM)) {
        canWork=true;
      }
 else       if (ERepositoryObjectType.PROCESS_MR != null && node.getObjectType().equals(ERepositoryObjectType.PROCESS_MR)) {
        canWork=true;
      }
 else       if (ERepositoryObjectType.SPARK_JOBLET != null && node.getObjectType().equals(ERepositoryObjectType.SPARK_JOBLET)) {
        canWork=true;
      }
 else       if (ERepositoryObjectType.SPARK_STREAMING_JOBLET != null && node.getObjectType().equals(ERepositoryObjectType.SPARK_STREAMING_JOBLET)) {
        canWork=true;
      }
 else       if (node.getObjectType() != ERepositoryObjectType.PROCESS && node.getObjectType() != ERepositoryObjectType.JOBLET) {
        canWork=false;
      }
    break;
default :
  canWork=false;
}
if (canWork && node.getObject() != null && ProxyRepositoryFactory.getInstance().getStatus(node.getObject()) == ERepositoryStatus.DELETED) {
canWork=false;
}
if (canWork && !ProjectManager.getInstance().isInCurrentMainProject(node)) {
canWork=false;
}
if (canWork) {
canWork=isLastVersion(node);
}
}
setEnabled(canWork);
}
Program: 118218
Project: 118218
Buggy source:
@Override public void refresh(){
  DisplayUtils.getDisplay().syncExec(new Runnable(){
    @Override public void run(){
      operationInThread();
    }
  }
);
}

Fixed version (ground truth):
@Override public void refresh(){
  if (element instanceof FakeElement) {
    DisplayUtils.getDisplay().syncExec(new Runnable(){
      @Override public void run(){
        operationInThread();
      }
    }
);
  }
 else {
    super.refresh();
  }
}
Program: 118220
Project: 118220
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)) {
      ElementParameterType csvOption=ParameterUtilTool.findParameterType(node,"String_Node_Str");
      if (csvOption != null && Boolean.valueOf(String.valueOf(ParameterUtilTool.convertParameterValue(csvOption)))) {
        ElementParameterType csvRowSeparator=ParameterUtilTool.findParameterType(node,"String_Node_Str");
        paramType.setValue(String.valueOf(ParameterUtilTool.convertParameterValue(csvRowSeparator)));
      }
    }
 else     if ("String_Node_Str".equals(paramName) && "String_Node_Str".equals(node.getComponentName())) {
      ElementParameterType useStream=ParameterUtilTool.findParameterType(node,"String_Node_Str");
      if (Boolean.valueOf(String.valueOf(ParameterUtilTool.convertParameterValue(useStream)))) {
        ElementParameterType streamName=ParameterUtilTool.findParameterType(node,"String_Node_Str");
        paramType.setValue(String.valueOf(ParameterUtilTool.convertParameterValue(streamName)));
      }
    }
  }
  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)) {
      if ("String_Node_Str".equals(String.valueOf(value))) {
        ElementParameterType csvRowSeparator=ParameterUtilTool.findParameterType(node,"String_Node_Str");
        ElementParameterType rowSeparator=ParameterUtilTool.findParameterType(node,"String_Node_Str");
        rowSeparator.setValue(String.valueOf(ParameterUtilTool.convertParameterValue(csvRowSeparator)));
      }
    }
 else     if ("String_Node_Str".equals(paramName) && "String_Node_Str".equals(node.getComponentName())) {
      ElementParameterType useStream=ParameterUtilTool.findParameterType(node,"String_Node_Str");
      if (Boolean.valueOf(String.valueOf(ParameterUtilTool.convertParameterValue(useStream)))) {
        ElementParameterType streamName=ParameterUtilTool.findParameterType(node,"String_Node_Str");
        paramType.setValue(String.valueOf(ParameterUtilTool.convertParameterValue(streamName)));
      }
    }
  }
  return paramType;
}
Program: 118222
Project: 118222
Buggy source:
private Object getGenericRepositoryValue(GenericConnection connection,List<ComponentProperties> componentProperties,String value,IMetadataTable table){
  if (componentProperties != null && value != null) {
    for (    ComponentProperties compPro : componentProperties) {
      Property<?> property=compPro.getValuedProperty(value);
      if (property != null) {
        Object paramValue=property.getStoredValue();
        if (GenericTypeUtils.isStringType(property)) {
          if (paramValue != null) {
            return getRepositoryValueOfStringType(connection,paramValue.toString());
          }
 else {
            return TalendQuoteUtils.addQuotes("String_Node_Str");
          }
        }
 else         if (GenericTypeUtils.isEnumType(property) && paramValue != null) {
          return 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) {
    for (    ComponentProperties compPro : componentProperties) {
      Property<?> property=compPro.getValuedProperty(value);
      if (property != null) {
        Object paramValue=property.getStoredValue();
        if (GenericTypeUtils.isStringType(property) || Boolean.valueOf(String.valueOf(property.getTaggedValue(IGenericConstants.DND_ADD_QUOTES)))) {
          if (paramValue != null) {
            return getRepositoryValueOfStringType(connection,paramValue.toString());
          }
 else {
            return TalendQuoteUtils.addQuotes("String_Node_Str");
          }
        }
 else         if (GenericTypeUtils.isEnumType(property) && paramValue != null) {
          return 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: 118223
Project: 118223
Buggy source:
public boolean isSparkStreamingJoblet(){
  boolean isSparkStreamingJoblet=false;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkJobletProviderService.class)) {
    ISparkStreamingJobletProviderService sparkJobletService=(ISparkStreamingJobletProviderService)GlobalServiceRegister.getDefault().getService(ISparkStreamingJobletProviderService.class);
    if (sparkJobletService != null) {
      isSparkStreamingJoblet=sparkJobletService.isSparkStreamingJobletComponent(this);
    }
  }
  return isSparkStreamingJoblet;
}

Fixed version (ground truth):
public boolean isSparkStreamingJoblet(){
  boolean isSparkStreamingJoblet=false;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkStreamingJobletProviderService.class)) {
    ISparkStreamingJobletProviderService sparkJobletService=(ISparkStreamingJobletProviderService)GlobalServiceRegister.getDefault().getService(ISparkStreamingJobletProviderService.class);
    if (sparkJobletService != null) {
      isSparkStreamingJoblet=sparkJobletService.isSparkStreamingJobletComponent(this);
    }
  }
  return isSparkStreamingJoblet;
}
Program: 118227
Project: 118227
Buggy source:
@Override protected IFigure createFigure(){
  SubjobContainer container=(SubjobContainer)this.getModel();
  Boolean isDisplaySubjobs=(container).isDisplayed();
  if (!isDisplaySubjobs) {
    Figure figure=new FreeformLayer();
    figure.setLayoutManager(new FreeformLayout());
    return figure;
  }
  IProcess2 process=container.getProcess();
  Object obj=process.getAdditionalProperties().get("String_Node_Str");
  SubjobContainerFigure subjobContainer=null;
  if ("String_Node_Str".equals(obj)) {
    subjobContainer=new SparkStreamingSubjobContainerFigure(container);
  }
 else {
    subjobContainer=new SubjobContainerFigure(container);
  }
  return subjobContainer;
}

Fixed version (ground truth):
@Override protected IFigure createFigure(){
  SubjobContainer container=(SubjobContainer)this.getModel();
  Boolean isDisplaySubjobs=(container).isDisplayed();
  if (!isDisplaySubjobs) {
    Figure figure=new FreeformLayer();
    figure.setLayoutManager(new FreeformLayout());
    return figure;
  }
  IProcess2 process=container.getProcess();
  Object obj=process.getAdditionalProperties().get("String_Node_Str");
  SubjobContainerFigure subjobContainer=null;
  if ("String_Node_Str".equals(obj) && !(process.getProperty().getItem() instanceof JobletProcessItem)) {
    subjobContainer=new SparkStreamingSubjobContainerFigure(container);
  }
 else {
    subjobContainer=new SubjobContainerFigure(container);
  }
  return subjobContainer;
}
Program: 118228
Project: 118228
Buggy source:
/** 
 * qzhang MetadataSchemaExt constructor comment.
 */
protected MetadataSchemaExt(FunctionManagerExt funManager){
  super();
}

Fixed version (ground truth):
/** 
 * qzhang MetadataSchemaExt constructor comment.
 */
protected MetadataSchemaExt(FunctionManagerExt funManager){
  super();
  this.funManager=funManager;
}
Program: 118235
Project: 118235
Buggy source:
@Override public List<AutoConversionType> getAllAutoConversionTypes(){
  if (beanList.isEmpty()) {
    beanList=AutoConvertTypesUtils.load(AutoConvertTypesUtils.getTypeFile());
  }
  return beanList;
}

Fixed version (ground truth):
@Override public List<AutoConversionType> getAllAutoConversionTypes(){
  return AutoConvertTypesUtils.getAllAutoConversionTypes();
}
Program: 118236
Project: 118236
Buggy source:
public static List<AutoConversionType> load(File file){
  List<AutoConversionType> beanList=new ArrayList<>();
  try {
    DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance();
    DocumentBuilder analyseur=documentBuilderFactory.newDocumentBuilder();
    analyseur.setErrorHandler(new ErrorHandler(){
      @Override public void error(      final SAXParseException exception) throws SAXException {
        throw exception;
      }
      @Override public void fatalError(      final SAXParseException exception) throws SAXException {
        throw exception;
      }
      @Override public void warning(      final SAXParseException exception) throws SAXException {
        throw exception;
      }
    }
);
    Document document=analyseur.parse(file);
    NodeList typeNodes=document.getElementsByTagName("String_Node_Str");
    for (int i=0; i < typeNodes.getLength(); i++) {
      Node typeNode=typeNodes.item(i);
      NamedNodeMap typeAttributes=typeNode.getAttributes();
      AutoConversionType typeObj=new AutoConversionType();
      typeObj.setSourceDataType(typeAttributes.getNamedItem("String_Node_Str").getNodeValue());
      typeObj.setTargetDataType(typeAttributes.getNamedItem("String_Node_Str").getNodeValue());
      typeObj.setConversionFunction(typeAttributes.getNamedItem("String_Node_Str").getNodeValue());
      beanList.add(typeObj);
    }
  }
 catch (  Exception e) {
    return beanList;
  }
  return beanList;
}

Fixed version (ground truth):
public static List<AutoConversionType> load(File file){
  beanList=new ArrayList<>();
  try {
    DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance();
    DocumentBuilder analyseur=documentBuilderFactory.newDocumentBuilder();
    analyseur.setErrorHandler(new ErrorHandler(){
      @Override public void error(      final SAXParseException exception) throws SAXException {
        throw exception;
      }
      @Override public void fatalError(      final SAXParseException exception) throws SAXException {
        throw exception;
      }
      @Override public void warning(      final SAXParseException exception) throws SAXException {
        throw exception;
      }
    }
);
    Document document=analyseur.parse(file);
    NodeList typeNodes=document.getElementsByTagName("String_Node_Str");
    for (int i=0; i < typeNodes.getLength(); i++) {
      Node typeNode=typeNodes.item(i);
      NamedNodeMap typeAttributes=typeNode.getAttributes();
      AutoConversionType typeObj=new AutoConversionType();
      typeObj.setSourceDataType(typeAttributes.getNamedItem("String_Node_Str").getNodeValue());
      typeObj.setTargetDataType(typeAttributes.getNamedItem("String_Node_Str").getNodeValue());
      typeObj.setConversionFunction(typeAttributes.getNamedItem("String_Node_Str").getNodeValue());
      beanList.add(typeObj);
    }
  }
 catch (  Exception e) {
    return beanList;
  }
  return beanList;
}
Program: 118238
Project: 118238
Buggy source:
protected boolean buildJobWithMaven(JobExportType jobExportType,IProgressMonitor monitor){
  String context=(contextCombo == null || contextCombo.isDisposed()) ? processItem.getProcess().getDefaultContext() : contextCombo.getText();
  try {
    String destination=getDestinationValue();
    int separatorIndex=destination.lastIndexOf(File.separator);
    if (separatorIndex == -1) {
      String userDir=System.getProperty("String_Node_Str");
      destination=userDir + File.separator + destination;
    }
    Map<ExportChoice,Object> exportChoiceMap=getExportChoiceMap();
    exportChoiceMap.put(ExportChoice.addStatistics,Boolean.TRUE);
    return BuildJobManager.getInstance().buildJobs(destination,Arrays.asList(getCheckNodes()),getSelectedJobVersion(),context,exportChoiceMap,jobExportType,monitor);
  }
 catch (  Exception e) {
    MessageBoxExceptionHandler.process(e,getShell());
    return false;
  }
}

Fixed version (ground truth):
protected boolean buildJobWithMaven(JobExportType jobExportType,IProgressMonitor monitor){
  String context=(contextCombo == null || contextCombo.isDisposed()) ? processItem.getProcess().getDefaultContext() : contextCombo.getText();
  try {
    String destination=getDestinationValue();
    int separatorIndex=destination.lastIndexOf(File.separator);
    if (separatorIndex == -1) {
      String userDir=System.getProperty("String_Node_Str");
      destination=userDir + File.separator + destination;
    }
    Map<ExportChoice,Object> exportChoiceMap=getExportChoiceMap();
    exportChoiceMap.put(ExportChoice.addStatistics,Boolean.TRUE);
    return BuildJobManager.getInstance().buildJobs(destination,Arrays.asList(getCheckNodes()),getDefaultFileName(),getSelectedJobVersion(),context,exportChoiceMap,jobExportType,monitor);
  }
 catch (  Exception e) {
    MessageBoxExceptionHandler.process(e,getShell());
    return false;
  }
}
Program: 118240
Project: 118240
Buggy source:
public void transform(NodeType node){
  ElementParameterType useExistingConnPara=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
  if (useExistingConnPara == null) {
    ComponentUtilities.addNodeProperty(node,"String_Node_Str","String_Node_Str");
    ComponentUtilities.getNodeProperty(node,"String_Node_Str").setValue("String_Node_Str");
  }
  ElementParameterType elementParaType=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
  if (elementParaType == null) {
    ComponentUtilities.addNodeProperty(node,"String_Node_Str","String_Node_Str");
    ComponentUtilities.getNodeProperty(node,"String_Node_Str").setValue("String_Node_Str");
  }
  if (elementParaType != null && elementParaType.getValue().equalsIgnoreCase("String_Node_Str")) {
    String batchSizeInStr=ComponentUtilities.getNodeProperty(node,"String_Node_Str").getValue();
    if (batchSizeInStr != null && !"String_Node_Str".equals(batchSizeInStr)) {
      int batchSize=Integer.valueOf(batchSizeInStr);
      if (batchSize <= 0) {
        ComponentUtilities.getNodeProperty(node,"String_Node_Str").setValue("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public void transform(NodeType node){
  ElementParameterType useExistingConnPara=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
  if (useExistingConnPara == null) {
    ComponentUtilities.addNodeProperty(node,"String_Node_Str","String_Node_Str");
    ComponentUtilities.getNodeProperty(node,"String_Node_Str").setValue("String_Node_Str");
  }
  ElementParameterType elementParaType=ComponentUtilities.getNodeProperty(node,"String_Node_Str");
  if (elementParaType == null) {
    ComponentUtilities.addNodeProperty(node,"String_Node_Str","String_Node_Str");
    ComponentUtilities.getNodeProperty(node,"String_Node_Str").setValue("String_Node_Str");
  }
  if (elementParaType != null && elementParaType.getValue().equalsIgnoreCase("String_Node_Str")) {
    String batchSizeInStr=ComponentUtilities.getNodeProperty(node,"String_Node_Str").getValue();
    if (batchSizeInStr != null && !"String_Node_Str".equals(batchSizeInStr)) {
      if (batchSizeInStr.matches("String_Node_Str")) {
        int batchSize=Integer.valueOf(batchSizeInStr);
        if (batchSize <= 0) {
          ComponentUtilities.getNodeProperty(node,"String_Node_Str").setValue("String_Node_Str");
        }
      }
    }
  }
}
Program: 118242
Project: 118242
Buggy source:
@Before public void setUp() throws Exception {
  ImportExportHandlersManager importManager=new ImportExportHandlersManager();
  URL testJobURL=FileLocator.find(Platform.getBundle("String_Node_Str"),new Path("String_Node_Str"),null);
  if (testJobURL != null) {
    testJobURL=FileLocator.toFileURL(testJobURL);
  }
  File srcFile=new File(testJobURL.getFile());
  FileResourcesUnityManager fileUnityManager=ResourcesManagerFactory.getInstance().createFileUnityManager(srcFile);
  ResourcesManager resManager=fileUnityManager.doUnify();
  List<ImportItem> projectRecords=importManager.populateImportingItems(resManager,true,new NullProgressMonitor());
  assertTrue(projectRecords.size() > 0);
  importManager.importItemRecords(new NullProgressMonitor(),resManager,projectRecords,true,projectRecords.toArray(new ImportItem[0]),null);
  IRepositoryViewObject obj=ProxyRepositoryFactory.getInstance().getLastVersion("String_Node_Str");
  Item item=obj.getProperty().getItem();
  assertTrue(item instanceof ProcessItem);
  processItem=(ProcessItem)item;
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  bridgeProject=ReponsitoryContextBridge.getProject();
  ReponsitoryContextBridge.setProject(ProjectManager.getInstance().getCurrentProject().getEmfProject());
  ImportExportHandlersManager importManager=new ImportExportHandlersManager();
  URL testJobURL=FileLocator.find(Platform.getBundle("String_Node_Str"),new Path("String_Node_Str"),null);
  if (testJobURL != null) {
    testJobURL=FileLocator.toFileURL(testJobURL);
  }
  File srcFile=new File(testJobURL.getFile());
  FileResourcesUnityManager fileUnityManager=ResourcesManagerFactory.getInstance().createFileUnityManager(srcFile);
  ResourcesManager resManager=fileUnityManager.doUnify();
  List<ImportItem> projectRecords=importManager.populateImportingItems(resManager,true,new NullProgressMonitor());
  assertTrue(projectRecords.size() > 0);
  importManager.importItemRecords(new NullProgressMonitor(),resManager,projectRecords,true,projectRecords.toArray(new ImportItem[0]),null);
  IRepositoryViewObject obj=ProxyRepositoryFactory.getInstance().getLastVersion("String_Node_Str");
  Item item=obj.getProperty().getItem();
  assertTrue(item instanceof ProcessItem);
  processItem=(ProcessItem)item;
}
Program: 118243
Project: 118243
Buggy source:
@After public void tearDown() throws Exception {
  ExportJobUtil.deleteTempFiles();
  File file=new File(destinationPath);
  if (file.exists()) {
    file.delete();
  }
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  ReponsitoryContextBridge.setProject(bridgeProject);
  ExportJobUtil.deleteTempFiles();
  File file=new File(destinationPath);
  if (file.exists()) {
    file.delete();
  }
}
Program: 118244
Project: 118244
Buggy source:
protected Shell getUsableShell(){
  if (usableShell != null) {
    return usableShell;
  }
 else {
    return new Shell(DisplayUtils.getDisplay(),SWT.ON_TOP | SWT.TOP);
  }
}

Fixed version (ground truth):
public Shell getUsableShell(){
  if (usableShell != null) {
    return usableShell;
  }
 else {
    return new Shell(DisplayUtils.getDisplay(),SWT.ON_TOP | SWT.TOP);
  }
}
Program: 118245
Project: 118245
Buggy source:
public void finishPressed(){
  if (LoginHelper.isRestart) {
    loginDialog.okPressed();
  }
 else {
    try {
      saveUpdateStatus(getProject());
    }
 catch (    Exception e) {
      MessageBoxExceptionHandler.process(e,loginHelper.getUsableShell());
    }
    boolean isLogInOk=loginHelper.logIn(getConnection(),getProject());
    if (isLogInOk) {
      LoginHelper.setAlwaysAskAtStartup(alwaysAsk.getSelection());
      loginDialog.okPressed();
    }
 else {
      fillUIProjectListWithBusyCursor();
      revertUpdateStatus();
    }
  }
}

Fixed version (ground truth):
public void finishPressed(){
  if (LoginHelper.isRestart) {
    loginDialog.okPressed();
  }
 else {
    boolean isLogInOk=loginHelper.logIn(getConnection(),getProject());
    if (isLogInOk) {
      LoginHelper.setAlwaysAskAtStartup(alwaysAsk.getSelection());
      loginDialog.okPressed();
    }
 else {
      fillUIProjectListWithBusyCursor();
      revertUpdateStatus();
    }
  }
}
Program: 118248
Project: 118248
Buggy source:
protected String getLibsClasspath() throws ProcessorException {
  final String classPathSeparator=extractClassPathSeparator();
  final String basePathClasspath=getBasePathClasspath();
  final String neededModulesJarStr=getNeededModulesJarStr();
  String libsStr=basePathClasspath + classPathSeparator + neededModulesJarStr.toString();
  if (isExportConfig() || isRunAsExport()) {
    libsStr+=classPathSeparator + getExportJarsStr();
  }
 else {
    File libDir=JavaProcessorUtilities.getJavaProjectLibFolder();
    if (libDir != null) {
      String libFolder=new Path(libDir.getAbsolutePath()).toPortableString();
      libsStr+=classPathSeparator + libFolder;
    }
  }
  if (libsStr.lastIndexOf(classPathSeparator) != libsStr.length() - 1) {
    libsStr+=classPathSeparator;
  }
  return libsStr;
}

Fixed version (ground truth):
protected String getLibsClasspath() throws ProcessorException {
  final String classPathSeparator=extractClassPathSeparator();
  final String basePathClasspath=getBasePathClasspath();
  final String neededModulesJarStr=getNeededModulesJarStr();
  String libsStr=basePathClasspath + classPathSeparator + neededModulesJarStr.toString();
  if (isExportConfig() || isRunAsExport()) {
    libsStr+=classPathSeparator + getExportJarsStr();
  }
 else {
  }
  if (libsStr.lastIndexOf(classPathSeparator) != libsStr.length() - 1) {
    libsStr+=classPathSeparator;
  }
  return libsStr;
}