nus-yam/ex-repair huggingface dataset:
Program: 118460
Project: 118460
Buggy source:
@Test public void testGetParametersFromForm(){
  ComponentProperties props=(ComponentProperties)new TestProperties("String_Node_Str").init();
  Form form=props.getForm(Form.MAIN);
  Element element=new FakeElement(form.getName());
  List<ElementParameter> parameters=ComponentsUtils.getParametersFromForm(element,null,props,form);
  for (  ElementParameter parameter : parameters) {
    assertFalse(parameter.isReadOnly());
  }
  element.setReadOnly(true);
  parameters=ComponentsUtils.getParametersFromForm(element,null,props,form);
  for (  ElementParameter parameter : parameters) {
    assertTrue(parameter.isReadOnly());
  }
}

Fixed version (ground truth):
@Test public void testGetParametersFromForm(){
  ComponentProperties props=(ComponentProperties)new TestProperties("String_Node_Str").init();
  Form form=props.getForm(Form.MAIN);
  Element element=new FakeElement(form.getName());
  List<ElementParameter> parameters=ComponentsUtils.getParametersFromForm(element,false,null,props,form);
  for (  ElementParameter parameter : parameters) {
    assertFalse(parameter.isReadOnly());
  }
  element.setReadOnly(true);
  parameters=ComponentsUtils.getParametersFromForm(element,false,null,props,form);
  for (  ElementParameter parameter : parameters) {
    assertTrue(parameter.isReadOnly());
  }
  IComponent component=ComponentsFactoryProvider.getInstance().get("String_Node_Str","String_Node_Str");
  INode node=new Node(component,new Process(new FakePropertyImpl()));
  checkParameterInitializationStatus(node,true);
  checkParameterInitializationStatus(node,false);
}
Program: 118461
Project: 118461
Buggy source:
@Override public Object[] getChildren(Object element){
  if (!(element instanceof RepositoryNode)) {
    return super.getChildren(element);
  }
  RepositoryNode repoNode=(RepositoryNode)element;
  ProjectRepositoryNode projectRepositoryNode=(ProjectRepositoryNode)repoNode.getRoot();
  if (metadataNodeTester.isMetadataTopNode(repoNode)) {
    getTopLevelNodes().addAll(projectRepositoryNode.getGenericTopNodesMap().values());
    return getTopLevelNodes().toArray();
  }
  if (getTopLevelNodes().contains(repoNode)) {
    projectRepositoryNode.initializeChildren(repoNode);
  }
  return repoNode.getChildren().toArray();
}

Fixed version (ground truth):
@Override public Object[] getChildren(Object element){
  if (!(element instanceof RepositoryNode)) {
    return super.getChildren(element);
  }
  RepositoryNode repoNode=(RepositoryNode)element;
  ProjectRepositoryNode projectRepositoryNode=(ProjectRepositoryNode)repoNode.getRoot();
  if (metadataNodeTester.isMetadataTopNode(repoNode)) {
    getTopLevelNodes().clear();
    getTopLevelNodes().addAll(projectRepositoryNode.getGenericTopNodesMap().values());
    return getTopLevelNodes().toArray();
  }
  if (getTopLevelNodes().contains(repoNode)) {
    projectRepositoryNode.initializeChildren(repoNode);
  }
  return repoNode.getChildren().toArray();
}
Program: 118462
Project: 118462
Buggy source:
@Override public void paint(Graphics graphics){
  graphics.setAlpha(255);
  if (errorFigure.isVisible()) {
    errorFigure.setLocation(jobletContainer.getErrorLocation());
  }
  if (warningFigure.isVisible()) {
    warningFigure.setLocation(jobletContainer.getWarningLocation());
  }
  Iterator it=getChildren().iterator();
  if (!jobletContainer.getNode().isJoblet()) {
    while (it.hasNext()) {
      Figure fig=(Figure)it.next();
      if (mrFigures.isEmpty() && (fig instanceof GreenRectangle || fig instanceof RoundedRectangle)) {
        it.remove();
        continue;
      }
    }
  }
  if (this.jobletContainer.getNode().isJoblet()) {
    refreshForJoblet();
  }
  initializejobletContainer(getBounds());
  super.paint(graphics);
}

Fixed version (ground truth):
@Override public void paint(Graphics graphics){
  graphics.setAlpha(255);
  if (errorFigure.isVisible()) {
    errorFigure.setLocation(jobletContainer.getErrorLocation());
  }
  if (warningFigure.isVisible()) {
    warningFigure.setLocation(jobletContainer.getWarningLocation());
  }
  if (infoFigure.isVisible()) {
    infoFigure.setLocation(jobletContainer.getInfoLocation());
  }
  if (rectFig.isVisible()) {
    rectFig.setLocation(jobletContainer.getMarkLocation());
  }
  if (markFigure.isVisible()) {
    markFigure.setLocation(jobletContainer.getErrorMarkLocation());
  }
  Iterator it=getChildren().iterator();
  if (!jobletContainer.getNode().isJoblet()) {
    while (it.hasNext()) {
      Figure fig=(Figure)it.next();
      if (mrFigures.isEmpty() && (fig instanceof GreenRectangle || fig instanceof RoundedRectangle)) {
        it.remove();
        continue;
      }
    }
  }
  if (this.jobletContainer.getNode().isJoblet()) {
    refreshForJoblet();
  }
  initializejobletContainer(getBounds());
  super.paint(graphics);
}
Program: 118464
Project: 118464
Buggy source:
public void updateStatus(int status){
  if ((status & Process.ERROR_STATUS) != 0) {
    warningFigure.setVisible(false);
    errorFigure.setVisible(true);
  }
 else {
    errorFigure.setVisible(false);
    errorFigure.setToolTip(null);
  }
  if (((status & Process.WARNING_STATUS) != 0) && !errorFigure.isVisible()) {
    warningFigure.setVisible(true);
  }
 else {
    warningFigure.setVisible(false);
    warningFigure.setToolTip(null);
  }
  if (warningFigure.isVisible() || errorFigure.isVisible()) {
    List<String> problemsList;
    String text="String_Node_Str" + jobletContainer.getNode().getUniqueName() + "String_Node_Str";
    if ((status & Process.WARNING_STATUS) != 0) {
      text+="String_Node_Str";
      problemsList=Problems.getStatusList(ProblemStatus.WARNING,jobletContainer.getNode());
      for (      String str : problemsList) {
        text+="String_Node_Str" + str + "String_Node_Str";
      }
    }
    if ((status & Process.ERROR_STATUS) != 0) {
      text+="String_Node_Str";
      problemsList=Problems.getStatusList(ProblemStatus.ERROR,jobletContainer.getNode());
      for (      String str : problemsList) {
        text+="String_Node_Str" + str + "String_Node_Str";
      }
    }
    htmlStatusHint.setText(text);
    if (errorFigure.isVisible()) {
      errorFigure.setToolTip(htmlStatusHint);
    }
 else     if (warningFigure.isVisible()) {
      warningFigure.setToolTip(htmlStatusHint);
    }
  }
 else {
    errorFigure.setVisible(false);
    errorFigure.setToolTip(null);
  }
}

Fixed version (ground truth):
public void updateStatus(int status){
  updateStatus(status,false);
}
Program: 118468
Project: 118468
Buggy source:
public void addRepositoryPropertyListener(Control control){
  boolean flag=false;
  if (this.curParameter != null) {
    final EComponentCategory category=this.curParameter.getCategory();
    final IElement element=this.curParameter.getElement();
    if (AbstractPreferenceComposite.inUseProjectSettingMode(element,category,EParameterName.STATANDLOG_USE_PROJECT_SETTINGS) || AbstractPreferenceComposite.inUseProjectSettingMode(element,category,EParameterName.IMPLICITCONTEXT_USE_PROJECT_SETTINGS)) {
      flag=true;
    }
  }
  if (!flag) {
    control.addMouseListener(listenerSelection);
  }
}

Fixed version (ground truth):
public void addRepositoryPropertyListener(Control control){
  boolean flag=false;
  if (this.curParameter != null) {
    final EComponentCategory category=this.curParameter.getCategory();
    final IElement element=this.curParameter.getElement();
    if (element instanceof FakeElement || AbstractPreferenceComposite.inUseProjectSettingMode(element,category,EParameterName.STATANDLOG_USE_PROJECT_SETTINGS) || AbstractPreferenceComposite.inUseProjectSettingMode(element,category,EParameterName.IMPLICITCONTEXT_USE_PROJECT_SETTINGS)) {
      flag=true;
    }
  }
  if (!flag) {
    control.addMouseListener(listenerSelection);
  }
}
Program: 118471
Project: 118471
Buggy source:
/** 
 * DOC YeXiaowei Comment method "isPasswordParam".
 * @param parameter
 * @return
 */
protected boolean isPasswordParam(final IElementParameter parameter){
  if (ContextParameterUtils.containContextVariables(parameter.getValue().toString())) {
    return false;
  }
  return parameter.isRepositoryValueUsed() && (parameter.getName().equals(EParameterName.PASS.getName()) || parameter.getName().contains("String_Node_Str") || parameter.getRepositoryValue().contains("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * DOC YeXiaowei Comment method "isPasswordParam".
 * @param parameter
 * @return
 */
protected boolean isPasswordParam(final IElementParameter parameter){
  if (ContextParameterUtils.containContextVariables(parameter.getValue().toString())) {
    return false;
  }
  return parameter.isRepositoryValueUsed() && (parameter.getName().equals(EParameterName.PASS.getName()) || parameter.getName().contains("String_Node_Str") || parameter.getRepositoryValue() != null && parameter.getRepositoryValue().contains("String_Node_Str"));
}
Program: 118474
Project: 118474
Buggy source:
@Override public void run(IProgressMonitor monitor) throws CoreException {
  try {
    factory.create(connectionItem,new Path("String_Node_Str"));
  }
 catch (  PersistenceException e) {
    throw new CoreException(new Status(IStatus.ERROR,"String_Node_Str","String_Node_Str",e));
  }
}

Fixed version (ground truth):
@Override public void run(IProgressMonitor monitor) throws CoreException {
  try {
    Form form=wizPage.getForm();
    if (form.isCallAfterFormFinish()) {
      if (creation) {
        factory.create(connectionItem,new Path("String_Node_Str"));
      }
      compService.afterFormFinish(form.getName(),(ComponentProperties)form.getProperties());
    }
    if (!creation) {
      GenericUpdateManager.updateGenericConnection(connectionItem);
    }
    updateConnectionItem(factory);
  }
 catch (  Throwable e) {
    throw new CoreException(new Status(IStatus.ERROR,IGenericConstants.REPOSITORY_PLUGIN_ID,"String_Node_Str",e));
  }
}
Program: 118475
Project: 118475
Buggy source:
@Override public boolean performFinish(){
  if (wizPage.isPageComplete()) {
    IWizardPage[] pages=getPages();
    for (    IWizardPage page : pages) {
      if (page instanceof GenericConnWizardPage) {
        GenericConnWizardPage gPage=(GenericConnWizardPage)page;
        parameters.addAll(gPage.getParameters());
      }
    }
    try {
      Form form=wizPage.getForm();
      if (form.isCallAfterFormFinish()) {
        if (creation) {
          createConnectionItem();
        }
        compService.afterFormFinish(form.getName(),(ComponentProperties)form.getProperties());
      }
      if (!creation) {
        GenericUpdateManager.updateGenericConnection(connectionItem);
      }
      updateConnectionItem();
    }
 catch (    Throwable e) {
      new ErrorDialogWidthDetailArea(getShell(),IGenericConstants.REPOSITORY_PLUGIN_ID,Messages.getString("String_Node_Str"),ExceptionUtils.getFullStackTrace(e));
      ExceptionHandler.process(e);
      return false;
    }
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  if (wizPage.isPageComplete()) {
    IWizardPage[] pages=getPages();
    for (    IWizardPage page : pages) {
      if (page instanceof GenericConnWizardPage) {
        GenericConnWizardPage gPage=(GenericConnWizardPage)page;
        parameters.addAll(gPage.getParameters());
      }
    }
    try {
      createOrUpdateConnectionItem();
    }
 catch (    Throwable e) {
      new ErrorDialogWidthDetailArea(getShell(),IGenericConstants.REPOSITORY_PLUGIN_ID,Messages.getString("String_Node_Str"),ExceptionUtils.getFullStackTrace(e));
      ExceptionHandler.process(e);
      return false;
    }
    return true;
  }
 else {
    return false;
  }
}
Program: 118476
Project: 118476
Buggy source:
private static void matchContextForAttribues(ComponentProperties componentProperties,IConnParamName param,String genericVariableName){
  GenericConnParamName genericParam=(GenericConnParamName)param;
  String paramName=genericParam.getName();
  String paramValue=ContextParameterUtils.getNewScriptCode(genericVariableName,ECodeLanguage.JAVA);
  ComponentsUtils.setGenericPropertyValue(componentProperties,paramName,paramValue);
}

Fixed version (ground truth):
private static void matchContextForAttribues(ComponentProperties componentProperties,IConnParamName param,String genericVariableName){
  GenericConnParamName genericParam=(GenericConnParamName)param;
  String paramName=genericParam.getName();
  String paramValue=ContextParameterUtils.getNewScriptCode(genericVariableName,ECodeLanguage.JAVA);
  setPropertyValue(componentProperties,paramName,paramValue,true);
}
Program: 118477
Project: 118477
Buggy source:
public static void revertPropertiesValues(ComponentProperties componentProperties,ContextType contextType){
  List<NamedThing> props=componentProperties.getProperties();
  for (  NamedThing namedThing : props) {
    if (namedThing instanceof ComponentProperties) {
      revertPropertiesValues((ComponentProperties)namedThing,contextType);
    }
 else     if (namedThing instanceof Property) {
      Property property=(Property)namedThing;
      if (ComponentsUtils.isSupportContext(property)) {
        String value=property.getStringValue();
        if (value != null) {
          String originalValue=ContextParameterUtils.getOriginalValue(contextType,value);
          property.setValue(TalendQuoteUtils.removeQuotes(originalValue));
        }
      }
    }
  }
}

Fixed version (ground truth):
public static void revertPropertiesValues(ComponentProperties componentProperties,ContextType contextType){
  List<NamedThing> props=componentProperties.getProperties();
  for (  NamedThing namedThing : props) {
    if (namedThing instanceof ComponentProperties) {
      revertPropertiesValues((ComponentProperties)namedThing,contextType);
    }
 else     if (namedThing instanceof Property) {
      Property property=(Property)namedThing;
      if (ComponentsUtils.isSupportContext(property)) {
        String value=property.getStringValue();
        if (value != null) {
          String originalValue=ContextParameterUtils.getOriginalValue(contextType,value);
          property.setTaggedValue(IGenericConstants.IS_CONTEXT_MODE,false);
          property.setValue(TalendQuoteUtils.removeQuotes(originalValue));
        }
      }
    }
  }
}
Program: 118479
Project: 118479
Buggy source:
@Override public boolean isReadOnly(){
  return false;
}

Fixed version (ground truth):
@Override public boolean isReadOnly(){
  return this.readOnly;
}
Program: 118480
Project: 118480
Buggy source:
@Override public void setReadOnly(boolean readOnly){
  return;
}

Fixed version (ground truth):
@Override public void setReadOnly(boolean readOnly){
  this.readOnly=readOnly;
}
Program: 118481
Project: 118481
Buggy source:
@Override public IWizard newSchemaWizard(IWorkbench workbench,boolean creation,IRepositoryViewObject object,MetadataTable metadataTable,String[] existingNames,boolean forceReadOnly){
  if (object == null) {
    return null;
  }
  IWorkbench wb=workbench;
  if (wb == null) {
    wb=PlatformUI.getWorkbench();
  }
  MetadataTable table=metadataTable;
  if (table == null && object instanceof MetadataTableRepositoryObject) {
    MetadataTableRepositoryObject metaTableRepObj=(MetadataTableRepositoryObject)object;
    table=metaTableRepObj.getTable();
  }
  if (table == null) {
    return null;
  }
  ConnectionItem connectionItem=(ConnectionItem)object.getProperty().getItem();
  table=SchemaUtils.getMetadataTable(connectionItem.getConnection(),table.getLabel(),table.eContainer().getClass());
  return new GenericSchemaWizard(wb,creation,connectionItem,table,forceReadOnly);
}

Fixed version (ground truth):
@Override public IWizard newSchemaWizard(IWorkbench workbench,boolean creation,IRepositoryViewObject object,MetadataTable metadataTable,String[] existingNames,boolean forceReadOnly){
  if (object == null) {
    return null;
  }
  IWorkbench wb=workbench;
  if (wb == null) {
    wb=PlatformUI.getWorkbench();
  }
  MetadataTable table=metadataTable;
  if (table == null && object instanceof MetadataTableRepositoryObject) {
    MetadataTableRepositoryObject metaTableRepObj=(MetadataTableRepositoryObject)object;
    table=metaTableRepObj.getTable();
  }
  if (table == null) {
    return null;
  }
  ConnectionItem connectionItem=(ConnectionItem)object.getProperty().getItem();
  table=SchemaUtils.getMetadataTable(connectionItem.getConnection(),table.getLabel(),table.eContainer().getClass());
  return new GenericSchemaWizard(wb,creation,object,connectionItem,table,forceReadOnly);
}
Program: 118482
Project: 118482
Buggy source:
@Override public void createControl(final Composite parent){
  Composite container=new Composite(parent,SWT.NONE);
  container.setLayoutData(new GridData(GridData.FILL_BOTH));
  container.setLayout(new FormLayout());
  setControl(container);
  Element element=new FakeElement(form.getName());
  dynamicComposite=new DynamicComposite(container,SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS,EComponentCategory.BASIC,element,true,container.getBackground(),form,false);
  dynamicComposite.setLayoutData(createMainFormData(addContextFields));
  dynamicComposite.setConnectionItem(connectionItem);
  addCheckListener(dynamicComposite.getChecker());
  if (addContextFields) {
    Composite contextParentComp=new Composite(container,SWT.NONE);
    contextParentComp.setLayoutData(createFooterFormData(dynamicComposite));
    contextParentComp.setLayout(new GridLayout());
    ContextComposite contextComp=addContextFields(contextParentComp);
    contextComp.addPropertyChangeListener(dynamicComposite);
    contextComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  }
}

Fixed version (ground truth):
@Override public void createControl(final Composite parent){
  Composite container=new Composite(parent,SWT.NONE);
  container.setLayoutData(new GridData(GridData.FILL_BOTH));
  container.setLayout(new FormLayout());
  setControl(container);
  Element element=new FakeElement(form.getName());
  element.setReadOnly(!isRepositoryObjectEditable);
  dynamicComposite=new DynamicComposite(container,SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS,EComponentCategory.BASIC,element,true,container.getBackground(),form,false);
  dynamicComposite.setLayoutData(createMainFormData(addContextFields));
  dynamicComposite.setConnectionItem(connectionItem);
  addCheckListener(dynamicComposite.getChecker());
  if (addContextFields) {
    Composite contextParentComp=new Composite(container,SWT.NONE);
    contextParentComp.setLayoutData(createFooterFormData(dynamicComposite));
    contextParentComp.setLayout(new GridLayout());
    ContextComposite contextComp=addContextFields(contextParentComp);
    contextComp.addPropertyChangeListener(dynamicComposite);
    contextComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  }
}
Program: 118483
Project: 118483
Buggy source:
public GenericSchemaWizard(IWorkbench workbench,boolean creation,ConnectionItem connectionItem,MetadataTable metadataTable,boolean forceReadOnly){
  super(workbench,creation,forceReadOnly);
  this.connectionItem=connectionItem;
  this.metadataTable=metadataTable;
  if (connectionItem != null) {
    oldTableMap=GenericUpdateManager.getOldTableIdAndNameMap(connectionItem,metadataTable,creation);
    oldMetadataTable=ConvertionHelper.convert(metadataTable);
  }
  setNeedsProgressMonitor(true);
  isRepositoryObjectEditable();
  initLockStrategy();
}

Fixed version (ground truth):
public GenericSchemaWizard(IWorkbench workbench,boolean creation,IRepositoryViewObject object,ConnectionItem connectionItem,MetadataTable metadataTable,boolean forceReadOnly){
  super(workbench,creation,forceReadOnly);
  this.connectionItem=connectionItem;
  this.metadataTable=metadataTable;
  if (connectionItem != null) {
    oldTableMap=GenericUpdateManager.getOldTableIdAndNameMap(connectionItem,metadataTable,creation);
    oldMetadataTable=ConvertionHelper.convert(metadataTable);
  }
  setNeedsProgressMonitor(true);
  setRepositoryObject(object);
  isRepositoryObjectEditable();
  initLockStrategy();
}
Program: 118484
Project: 118484
Buggy source:
protected ContextComposite addContextFields(Composite parentComposite){
  contextHandler=new GenericContextHandler();
  contextHandler.setParameters(getContextParameters());
  ContextComposite contextComp=new ContextComposite(parentComposite,connectionItem,contextHandler);
  return contextComp;
}

Fixed version (ground truth):
protected ContextComposite addContextFields(Composite parentComposite){
  contextHandler=new GenericContextHandler();
  contextHandler.setParameters(getContextParameters());
  ContextComposite contextComp=new ContextComposite(parentComposite,connectionItem,!isRepositoryObjectEditable,contextHandler);
  return contextComp;
}
Program: 118485
Project: 118485
Buggy source:
private void refreshContextBtn(){
  boolean isContextMode=isContextMode();
  exportContextBtn.setEnabled(!isContextMode);
  revertContextBtn.setEnabled(isContextMode);
}

Fixed version (ground truth):
private void refreshContextBtn(){
  boolean isContextMode=isContextMode();
  exportContextBtn.setEnabled(!isReadOnly && !isContextMode);
  revertContextBtn.setEnabled(!isReadOnly && isContextMode);
}
Program: 118486
Project: 118486
Buggy source:
public ContextComposite(Composite parent,ConnectionItem connectionItem,IContextHandler contextHandler){
  super(parent,SWT.NONE);
  this.connectionItem=connectionItem;
  this.contextHandler=contextHandler;
  GridLayout gridLayout=new GridLayout();
  gridLayout.marginWidth=0;
  gridLayout.marginHeight=0;
  setLayout(gridLayout);
  createControl();
}

Fixed version (ground truth):
public ContextComposite(Composite parent,ConnectionItem connectionItem,boolean isReadOnly,IContextHandler contextHandler){
  super(parent,SWT.NONE);
  this.connectionItem=connectionItem;
  this.isReadOnly=isReadOnly;
  this.contextHandler=contextHandler;
  GridLayout gridLayout=new GridLayout();
  gridLayout.marginWidth=0;
  gridLayout.marginHeight=0;
  setLayout(gridLayout);
  createControl();
}
Program: 118488
Project: 118488
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.getAvailableConnectors(null,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.getAvailableConnectors(null,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;
}
Program: 118489
Project: 118489
Buggy source:
private void addPropertyParameters(final List<ElementParameter> listParam,final INode node,String formName,EComponentCategory category){
  ComponentProperties props=node.getComponentProperties();
  Form form=props.getForm(formName);
  List<ElementParameter> parameters=ComponentsUtils.getParametersFromForm(node,category,node.getComponentProperties(),form);
  ComponentService componentService=new ComponentServiceWithValueEvaluator(ComponentsUtils.getComponentService(),new ComponentContextPropertyValueEvaluator(node));
  for (  ElementParameter parameter : parameters) {
    if (parameter instanceof GenericElementParameter) {
      GenericElementParameter genericElementParameter=(GenericElementParameter)parameter;
      genericElementParameter.setComponentService(componentService);
    }
  }
  listParam.addAll(parameters);
}

Fixed version (ground truth):
private void addPropertyParameters(final List<ElementParameter> listParam,final INode node,String formName,EComponentCategory category){
  ComponentProperties props=node.getComponentProperties();
  Form form=props.getForm(formName);
  List<ElementParameter> parameters=ComponentsUtils.getParametersFromForm(node,category,props,form);
  props.setValueEvaluator(new ComponentContextPropertyValueEvaluator(node));
  ComponentService componentService=ComponentsUtils.getComponentService();
  for (  ElementParameter parameter : parameters) {
    if (parameter instanceof GenericElementParameter) {
      GenericElementParameter genericElementParameter=(GenericElementParameter)parameter;
      genericElementParameter.setComponentService(componentService);
    }
  }
  listParam.addAll(parameters);
}
Program: 118490
Project: 118490
Buggy source:
@Override public void setRepositoryValueUsed(boolean repositoryUsed){
  NamedThing widgetProperty=widget.getContent();
  if (widgetProperty instanceof Property) {
    Property property=((Property)widgetProperty);
    if (repositoryUsed) {
      property.setTaggedValue(IGenericConstants.REPOSITORY_VALUE,property.getName());
    }
 else {
      property.setTaggedValue(IGenericConstants.REPOSITORY_VALUE,null);
    }
  }
}

Fixed version (ground truth):
@Override public void setRepositoryValueUsed(boolean repositoryUsed){
  Property property=getProperty();
  if (property != null) {
    property.setTaggedValue(IGenericConstants.REPOSITORY_VALUE,repositoryUsed ? property.getName() : null);
  }
}
Program: 118491
Project: 118491
Buggy source:
@Override public boolean isRepositoryValueUsed(){
  NamedThing widgetProperty=widget.getContent();
  if (widgetProperty instanceof Property) {
    Property property=((Property)widgetProperty);
    if (property.getTaggedValue(IGenericConstants.REPOSITORY_VALUE) != null) {
      return true;
    }
 else {
      return false;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isRepositoryValueUsed(){
  Property property=getProperty();
  if (property != null) {
    return property.getTaggedValue(IGenericConstants.REPOSITORY_VALUE) != null;
  }
  return false;
}
Program: 118495
Project: 118495
Buggy source:
private ComponentProperties getComponentProperties(){
  if (connectionItem != null) {
    GenericConnection connection=(GenericConnection)connectionItem.getConnection();
    String compPropertiesStr=connection.getCompProperties();
    if (compPropertiesStr != null) {
      Deserialized<ComponentProperties> fromSerialized=ComponentProperties.fromSerialized(compPropertiesStr,ComponentProperties.class);
      if (fromSerialized != null) {
        return fromSerialized.properties;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private ComponentProperties getComponentProperties(){
  if (connectionItem != null) {
    GenericConnection connection=(GenericConnection)connectionItem.getConnection();
    String compPropertiesStr=connection.getCompProperties();
    if (compPropertiesStr != null) {
      Deserialized<ComponentProperties> fromSerialized=ComponentProperties.fromSerialized(compPropertiesStr,ComponentProperties.class);
      if (fromSerialized != null) {
        ComponentProperties properties=fromSerialized.properties;
        properties.setValueEvaluator(new MetadataContextPropertyValueEvaluator(connection));
        return fromSerialized.properties;
      }
    }
  }
  return null;
}
Program: 118497
Project: 118497
Buggy source:
@Override public List<? extends INode> getGeneratingNodes(){
  if (generatingProcess == null) {
    generatingProcess=new DataProcess(this);
  }
  List<? extends INode> generatedNodeList=generatingProcess.getNodeList();
  if (!isBuilding()) {
    if (isProcessModified() || routinesDependencies == null || routinesDependencies.isEmpty()) {
      checkRoutineDependencies();
    }
    if (isProcessModified()) {
      if (isBuilding()) {
        return generatedNodeList;
      }
      setBuilding(true);
      List<INode> sortedFlow=sortNodes(nodes);
      if (sortedFlow.size() != nodes.size()) {
        sortedFlow=nodes;
      }
      generatingProcess.buildFromGraphicalProcess(sortedFlow);
      generatedNodeList=generatingProcess.getNodeList();
      processModified=false;
      setBuilding(false);
    }
  }
  return generatedNodeList;
}

Fixed version (ground truth):
@Override public List<? extends INode> getGeneratingNodes(){
  if (generatingProcess == null) {
    generatingProcess=new DataProcess(this);
  }
  List<? extends INode> generatedNodeList=generatingProcess.getNodeList();
  if (!isBuilding()) {
    if (isProcessModified() || routinesDependencies == null || routinesDependencies.isEmpty()) {
      checkRoutineDependencies();
    }
    if (isProcessModified()) {
      if (isBuilding()) {
        return generatedNodeList;
      }
      setBuilding(true);
      List<INode> sortedFlow=sortNodes(nodes);
      if (sortedFlow.size() != nodes.size()) {
        sortedFlow=nodes;
      }
      generatingProcess.buildFromGraphicalProcess(sortedFlow);
      generatedNodeList=generatingProcess.getNodeList();
      if (isActivate()) {
        processModified=false;
      }
      setBuilding(false);
    }
  }
  return generatedNodeList;
}
Program: 118498
Project: 118498
Buggy source:
protected void paintGrid(Graphics g,IFigure f,org.eclipse.draw2d.geometry.Point origin,int distanceX,int distanceY){
  FreeformFigure ff=(FreeformFigure)this.getParent();
  Rectangle clientArea=getClientArea();
  Rectangle bounds=ff.getFreeformExtent().getCopy();
  bounds.union(clientArea.x,clientArea.y,clientArea.width,clientArea.height);
  ff.setFreeformBounds(bounds);
  Rectangle original=g.getClip(Rectangle.SINGLETON);
  Rectangle clip=new Rectangle(original.x - original.x % distanceX,original.y - original.y % distanceY,original.width + Math.abs(original.x % distanceX),original.height + Math.abs(original.y % distanceY));
  if (distanceX > 0 && distanceY > 0) {
    if (origin.x >= clip.x) {
      while (origin.x - distanceX >= clip.x) {
        origin.x-=distanceX;
      }
    }
 else {
      while (origin.x < clip.x) {
        origin.x+=distanceX;
      }
    }
    if (origin.y >= clip.y) {
      while (origin.y - distanceY >= clip.y) {
        origin.y-=distanceY;
      }
    }
 else {
      while (origin.y < clip.y) {
        origin.y+=distanceY;
      }
    }
    for (int i=origin.x; i < clip.x + clip.width; i+=distanceX) {
      for (int j=origin.y; j < clip.y + clip.height; j+=distanceY) {
        int re=Math.abs(i - j);
        if (re / distanceY % 2 == 0) {
          g.drawImage(ImageProvider.getImage(EImage.CHESS_GRAY),i,j);
        }
      }
    }
  }
}

Fixed version (ground truth):
protected void paintGrid(Graphics g,IFigure f,org.eclipse.draw2d.geometry.Point origin,int distanceX,int distanceY){
  FreeformFigure ff=(FreeformFigure)this.getParent();
  Rectangle clientArea=getClientArea();
  Rectangle bounds=ff.getFreeformExtent().getCopy();
  bounds.union(clientArea.x,clientArea.y,clientArea.width * AnimatableZoomManager.currentZoom,clientArea.height * AnimatableZoomManager.currentZoom);
  ff.setFreeformBounds(bounds);
  Rectangle original=g.getClip(Rectangle.SINGLETON);
  Rectangle clip=new Rectangle(original.x - original.x % distanceX,original.y - original.y % distanceY,original.width + Math.abs(original.x % distanceX),original.height + Math.abs(original.y % distanceY));
  if (distanceX > 0 && distanceY > 0) {
    if (origin.x >= clip.x) {
      while (origin.x - distanceX >= clip.x) {
        origin.x-=distanceX;
      }
    }
 else {
      while (origin.x < clip.x) {
        origin.x+=distanceX;
      }
    }
    if (origin.y >= clip.y) {
      while (origin.y - distanceY >= clip.y) {
        origin.y-=distanceY;
      }
    }
 else {
      while (origin.y < clip.y) {
        origin.y+=distanceY;
      }
    }
    for (int i=origin.x; i < clip.x + clip.width; i+=distanceX) {
      for (int j=origin.y; j < clip.y + clip.height; j+=distanceY) {
        int re=Math.abs(i - j);
        if (re / distanceY % 2 == 0) {
          g.drawImage(ImageProvider.getImage(EImage.CHESS_GRAY),i,j);
        }
      }
    }
  }
}
Program: 118499
Project: 118499
Buggy source:
protected String getRepositoryItemFromRepositoryName(IElementParameter param,String repositoryName){
  String value=(String)param.getValue();
  Object[] valuesList=param.getListItemsValue();
  String[] originalList=param.getListItemsDisplayCodeName();
  for (int i=0; i < valuesList.length; i++) {
    if (valuesList[i].equals(value)) {
      if ("String_Node_Str".equals(repositoryName)) {
        return valuesList[i].toString();
      }
      return originalList[i];
    }
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
protected String getRepositoryItemFromRepositoryName(IElementParameter param,String repositoryName){
  String value=(String)param.getValue();
  Object[] valuesList=param.getListItemsValue();
  String[] originalList=param.getListItemsDisplayCodeName();
  for (int i=0; i < valuesList.length; i++) {
    if (valuesList[i].equals(value)) {
      if ("String_Node_Str".equals(repositoryName) || HiveConstant.DISTRIBUTION_PARAMETER.equals(repositoryName) || HiveConstant.VERSION_PARAMETER.equals(repositoryName)) {
        return valuesList[i].toString();
      }
      return originalList[i];
    }
  }
  return "String_Node_Str";
}
Program: 118500
Project: 118500
Buggy source:
/** 
 * ggu Comment method "removeDuplication". for context mode
 */
private void removeDuplication(){
  List<UpdateResult> contextResult=new ArrayList<UpdateResult>();
  for (  UpdateResult result : getInputElements()) {
    if (result.getUpdateType() == EUpdateItemType.CONTEXT && result.getResultType() == EUpdateResult.ADD && result.getContextModeConnectionItem() != null) {
      contextResult.add(result);
    }
  }
  List<ConnectionItem> connItems=new ArrayList<ConnectionItem>();
  List<UpdateResult> duplicatedResult=new ArrayList<UpdateResult>();
  Iterator<UpdateResult> iterator=contextResult.iterator();
  List tempItems=new ArrayList();
  while (iterator.hasNext()) {
    Map<Object,ConnectionItem> jobAndContext=new HashMap<Object,ConnectionItem>();
    UpdateResult result=iterator.next();
    ConnectionItem item=result.getContextModeConnectionItem();
    jobAndContext.put(result.getJob(),item);
    if (tempItems.contains(jobAndContext)) {
      duplicatedResult.add(result);
    }
 else {
      tempItems.add(item);
    }
  }
  getInputElements().removeAll(duplicatedResult);
}

Fixed version (ground truth):
/** 
 * ggu Comment method "removeDuplication". for context mode
 */
private void removeDuplication(){
  List<UpdateResult> contextResult=new ArrayList<UpdateResult>();
  for (  UpdateResult result : getInputElements()) {
    if (((result.getUpdateType() == EUpdateItemType.CONTEXT && result.getContextModeConnectionItem() != null) || result.getUpdateType() == EUpdateItemType.CONTEXT_GROUP) && result.getResultType() == EUpdateResult.ADD) {
      contextResult.add(result);
    }
  }
  List<ConnectionItem> connItems=new ArrayList<ConnectionItem>();
  List<UpdateResult> duplicatedResult=new ArrayList<UpdateResult>();
  Iterator<UpdateResult> iterator=contextResult.iterator();
  List tempItems=new ArrayList();
  List<String> contextGroups=new ArrayList<String>();
  while (iterator.hasNext()) {
    Map<Object,ConnectionItem> jobAndContext=new HashMap<Object,ConnectionItem>();
    UpdateResult result=iterator.next();
    if (result.getUpdateType() == EUpdateItemType.CONTEXT) {
      ConnectionItem item=result.getContextModeConnectionItem();
      jobAndContext.put(result.getJob(),item);
      if (tempItems.contains(jobAndContext)) {
        duplicatedResult.add(result);
      }
 else {
        tempItems.add(item);
      }
    }
 else     if (result.getUpdateType() == EUpdateItemType.CONTEXT_GROUP) {
      if (contextGroups.contains(result.getJobInfor())) {
        duplicatedResult.add(result);
      }
 else {
        contextGroups.add(result.getJobInfor());
      }
    }
  }
  getInputElements().removeAll(duplicatedResult);
}
Program: 118501
Project: 118501
Buggy source:
private void saveUpdateStatus(Project project) throws JSONException {
  Context ctx=CoreRuntimePlugin.getInstance().getContext();
  RepositoryContext repositoryContext=(RepositoryContext)ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
  PreferenceManipulator prefManipulator=new PreferenceManipulator();
  String url=project.getEmfProject().getUrl();
  if (!"String_Node_Str".equals(getStorage(url)))   return;
  String location=getLocation(url);
  String projectName=project.getTechnicalLabel();
  String branch=getBranch();
  JSONObject json=prefManipulator.getLogonLocalBranchStatus(location,projectName);
  if (json != null) {
    Object noUpdateWhenLogon=json.get(branch);
    if (noUpdateWhenLogon != null) {
      repositoryContext.setNoUpdateWhenLogon((Boolean)noUpdateWhenLogon);
    }
  }
}

Fixed version (ground truth):
private void saveUpdateStatus(Project project) throws JSONException {
  Context ctx=CoreRuntimePlugin.getInstance().getContext();
  RepositoryContext repositoryContext=(RepositoryContext)ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
  PreferenceManipulator prefManipulator=new PreferenceManipulator();
  String url=project.getEmfProject().getUrl();
  if (url == null || !"String_Node_Str".equals(getStorage(url)))   return;
  String location=getLocation(url);
  String projectName=project.getTechnicalLabel();
  String branch=getBranch();
  JSONObject json=prefManipulator.getLogonLocalBranchStatus(location,projectName);
  if (json != null) {
    Object noUpdateWhenLogon=json.get(branch);
    if (noUpdateWhenLogon != null) {
      repositoryContext.setNoUpdateWhenLogon((Boolean)noUpdateWhenLogon);
    }
  }
}
Program: 118505
Project: 118505
Buggy source:
@Override public void run(){
  boolean display=isChecked();
  getGlobalStore().setValue(TalendDesignerPrefConstants.DISPLAY_SUBJOBS,display);
  IEditorReference[] editorParts=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
  for (  IEditorReference reference : editorParts) {
    if (!(reference.getId().equals(MultiPageTalendEditor.ID) || reference.getId().equals(JOBLET_ID) || MAP_REDUCE_MULTIPAGE_EDITOR_ID.equals(reference.getId()))) {
      continue;
    }
    IEditorPart editorPart=reference.getEditor(false);
    if (editorPart == null) {
      continue;
    }
    if (editorPart instanceof AbstractMultiPageTalendEditor) {
      AbstractMultiPageTalendEditor editor=(AbstractMultiPageTalendEditor)editorPart;
      IProcess2 process=editor.getTalendEditor().getProcess();
      if (process == null) {
        continue;
      }
      List<? extends ISubjobContainer> subjobs=process.getSubjobContainers();
      for (      ISubjobContainer subjobContainer : subjobs) {
        subjobContainer.updateSubjobDisplay();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  boolean display=isChecked();
  getGlobalStore().setValue(TalendDesignerPrefConstants.DISPLAY_SUBJOBS,display);
  IEditorReference[] editorParts=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
  for (  IEditorReference reference : editorParts) {
    if (!(reference.getId().equals(MultiPageTalendEditor.ID) || reference.getId().equals(JOBLET_ID) || MAP_REDUCE_MULTIPAGE_EDITOR_ID.equals(reference.getId())|| TEST_CASE_DI_EDITOR.equals(reference.getId()))) {
      continue;
    }
    IEditorPart editorPart=reference.getEditor(false);
    if (editorPart == null) {
      continue;
    }
    if (editorPart instanceof AbstractMultiPageTalendEditor) {
      AbstractMultiPageTalendEditor editor=(AbstractMultiPageTalendEditor)editorPart;
      IProcess2 process=editor.getTalendEditor().getProcess();
      if (process == null) {
        continue;
      }
      List<? extends ISubjobContainer> subjobs=process.getSubjobContainers();
      for (      ISubjobContainer subjobContainer : subjobs) {
        subjobContainer.updateSubjobDisplay();
      }
    }
  }
}
Program: 118507
Project: 118507
Buggy source:
public static void setTableValues(ComponentProperties tableProperties,List<Map<String,Object>> value,IElementParameter param){
  List<Map<String,String>> table=ElementParameterParser.createTableValues(value,param);
  for (  Map<String,String> line : table) {
    for (    String column : line.keySet()) {
      Property property=tableProperties.getValuedProperty(column);
      if (property.getValue() instanceof List) {
        ((List)property.getValue()).clear();
      }
    }
  }
  for (  Map<String,String> line : table) {
    for (    String column : line.keySet()) {
      Property property=tableProperties.getValuedProperty(column);
      List<String> values=new ArrayList<>();
      if (property.getValue() == null || (!(property.getValue() instanceof List))) {
        property.setValue(values);
      }
 else {
        values=(List)property.getValue();
      }
      values.add(line.get(column));
    }
  }
}

Fixed version (ground truth):
public static void setTableValues(ComponentProperties tableProperties,List<Map<String,Object>> value,IElementParameter param){
  List<Map<String,String>> table=ElementParameterParser.createTableValues(value,param);
  for (  String column : param.getListItemsDisplayCodeName()) {
    Property property=tableProperties.getValuedProperty(column);
    if (property.getValue() instanceof List) {
      ((List)property.getValue()).clear();
    }
  }
  for (  Map<String,String> line : table) {
    for (    String column : line.keySet()) {
      Property property=tableProperties.getValuedProperty(column);
      List<String> values=new ArrayList<>();
      if (property.getValue() == null || (!(property.getValue() instanceof List))) {
        property.setValue(values);
      }
 else {
        values=(List)property.getValue();
      }
      values.add(line.get(column));
    }
  }
}
Program: 118508
Project: 118508
Buggy source:
@Override public Set<EUpdateItemType> getTypes(){
  Set<EUpdateItemType> types=new HashSet<>();
  types.add(EUpdateItemType.NODE_PROPERTY);
  return types;
}

Fixed version (ground truth):
@Override public Set<EUpdateItemType> getTypes(){
  Set<EUpdateItemType> types=new HashSet<>();
  types.add(EUpdateItemType.NODE_PROPERTY);
  types.add(EUpdateItemType.NODE_SCHEMA);
  return types;
}
Program: 118509
Project: 118509
Buggy source:
@Override public Object evaluate(Property property,Object storedValue){
  if (storedValue == null) {
    return storedValue;
  }
  if (storedValue instanceof Schema || storedValue instanceof List) {
    return storedValue;
  }
  IContext context=null;
  if (node != null) {
    IProcess process=node.getProcess();
    if (process != null) {
      IContextManager cm=process.getContextManager();
      if (cm != null) {
        context=cm.getDefaultContext();
      }
    }
  }
  if (context != null) {
    return ContextParameterUtils.parseScriptContextCode(String.valueOf(storedValue),context);
  }
  return storedValue;
}

Fixed version (ground truth):
@Override public Object evaluate(Property property,Object storedValue){
  if (storedValue == null) {
    return storedValue;
  }
  if (storedValue instanceof Schema || storedValue instanceof List || storedValue instanceof Enum) {
    return storedValue;
  }
  IContext context=null;
  if (node != null) {
    IProcess process=node.getProcess();
    if (process != null) {
      IContextManager cm=process.getContextManager();
      if (cm != null) {
        context=cm.getDefaultContext();
      }
    }
  }
  if (context != null) {
    return ContextParameterUtils.parseScriptContextCode(String.valueOf(storedValue),context);
  }
  return storedValue;
}
Program: 118511
Project: 118511
Buggy source:
private void addGenericType(List<INodeConnector> listConnector,EConnectionType type,String genericConnectorType,INode parentNode){
  GenericNodeConnector nodeConnector=new GenericNodeConnector(parentNode);
  nodeConnector.setMaxLinkInput(0);
  nodeConnector.setDefaultConnectionType(EConnectionType.FLOW_MAIN);
  nodeConnector.setGenericConnectorType(genericConnectorType);
  nodeConnector.setLinkName(type.getDefaultLinkName());
  if (type == EConnectionType.REJECT) {
    nodeConnector.addConnectionProperty(EConnectionType.FLOW_MAIN,new RGB(255,0,0),2);
    nodeConnector.getConnectionProperty(EConnectionType.FLOW_MAIN).setRGB(new RGB(255,0,0));
  }
 else {
    nodeConnector.addConnectionProperty(type,type.getRGB(),type.getDefaultLineStyle());
  }
  listConnector.add(nodeConnector);
}

Fixed version (ground truth):
private void addGenericType(List<INodeConnector> listConnector,EConnectionType type,String genericConnectorType,INode parentNode,boolean isOutput){
  GenericNodeConnector nodeConnector=new GenericNodeConnector(parentNode,isOutput);
  nodeConnector.setDefaultConnectionType(EConnectionType.FLOW_MAIN);
  nodeConnector.setGenericConnectorType(genericConnectorType);
  nodeConnector.setLinkName(type.getDefaultLinkName());
  if (type == EConnectionType.REJECT) {
    nodeConnector.addConnectionProperty(EConnectionType.FLOW_MAIN,new RGB(255,0,0),2);
    nodeConnector.getConnectionProperty(EConnectionType.FLOW_MAIN).setRGB(new RGB(255,0,0));
  }
 else {
    nodeConnector.addConnectionProperty(type,type.getRGB(),type.getDefaultLineStyle());
  }
  listConnector.add(nodeConnector);
}