nus-yam/ex-repair huggingface dataset:
Program: 118316
Project: 118316
Buggy source:
@Override public boolean finish(){
  BusyIndicator.showWhile(Display.getDefault(),new Runnable(){
    @Override public void run(){
      for (      File file : newJarFiles.values()) {
        try {
          CorePlugin.getDefault().getLibrariesService().deployLibrary(file.toURL());
        }
 catch (        Exception e) {
          ExceptionHandler.process(e);
        }
      }
      try {
        CorePlugin.getDefault().getProxyRepositoryFactory().save(getSelectedRoutine());
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
      }
      CorePlugin.getDefault().getLibrariesService().resetModulesNeeded();
      CorePlugin.getDefault().getRunProcessService().updateLibraries(new HashSet<ModuleNeeded>(),null);
    }
  }
);
  return true;
}

Fixed version (ground truth):
@Override public boolean finish(){
  BusyIndicator.showWhile(Display.getDefault(),new Runnable(){
    @Override public void run(){
      for (      File file : newJarFiles.values()) {
        try {
          CorePlugin.getDefault().getLibrariesService().deployLibrary(file.toURL());
        }
 catch (        Exception e) {
          ExceptionHandler.process(e);
        }
      }
      try {
        CorePlugin.getDefault().getProxyRepositoryFactory().save(getSelectedRoutine());
      }
 catch (      Exception e) {
        ExceptionHandler.process(e);
      }
      CorePlugin.getDefault().getLibrariesService().resetModulesNeeded();
      CorePlugin.getDefault().getRunProcessService().updateLibraries(new HashSet<ModuleNeeded>(),null);
      for (      File file : newJarFiles.values()) {
        try {
          CorePlugin.getDefault().getLibrariesService().deployProjectLibrary(file);
        }
 catch (        Exception e) {
          ExceptionHandler.process(e);
        }
      }
    }
  }
);
  return true;
}
Program: 118319
Project: 118319
Buggy source:
public void finishPressed(){
  try {
    saveUpdateStatus(getProject());
  }
 catch (  JSONException e) {
    ExceptionHandler.process(e);
  }
  if (LoginHelper.isRestart) {
    loginDialog.okPressed();
  }
 else {
    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 {
    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();
    }
  }
}
Program: 118320
Project: 118320
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 (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);
    }
  }
}

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: 118321
Project: 118321
Buggy source:
private Object getTypedValue(Property property,String rawValue){
  if (GenericTypeUtils.isBooleanType(property)) {
    return new Boolean(rawValue);
  }
  if (GenericTypeUtils.isIntegerType(property) && !rawValue.isEmpty()) {
    try {
      return Integer.valueOf(rawValue);
    }
 catch (    Exception e) {
      return 0;
    }
  }
  if (GenericTypeUtils.isEnumType(property)) {
    List<?> propertyPossibleValues=((Property<?>)property).getPossibleValues();
    if (propertyPossibleValues != null) {
      for (      Object possibleValue : propertyPossibleValues) {
        if (possibleValue.toString().equals(rawValue)) {
          return possibleValue;
        }
      }
    }
  }
  if (GenericTypeUtils.isStringType(property)) {
    return TalendQuoteUtils.removeQuotes(String.valueOf(rawValue));
  }
  return rawValue;
}

Fixed version (ground truth):
private Object getTypedValue(Property property,String rawValue){
  if (GenericTypeUtils.isBooleanType(property)) {
    return new Boolean(rawValue);
  }
  if (GenericTypeUtils.isIntegerType(property) && !rawValue.isEmpty()) {
    try {
      return Integer.valueOf(rawValue);
    }
 catch (    Exception e) {
      return 0;
    }
  }
  if (GenericTypeUtils.isEnumType(property)) {
    List<?> possibleValues=property.getPossibleValues();
    if (possibleValues != null) {
      Object firstValue=null;
      if (!possibleValues.isEmpty()) {
        firstValue=possibleValues.get(0);
      }
      String stringStoredValue=TalendQuoteUtils.removeQuotes(String.valueOf(rawValue));
      for (      Object possibleValue : possibleValues) {
        if (possibleValue.toString().equals(stringStoredValue)) {
          return possibleValue;
        }
      }
      if (firstValue != null) {
        return firstValue;
      }
    }
  }
  if (GenericTypeUtils.isStringType(property)) {
    return TalendQuoteUtils.removeQuotes(String.valueOf(rawValue));
  }
  return rawValue;
}
Program: 118322
Project: 118322
Buggy source:
@Override public Object evaluate(Property property,Object storedValue){
  if (storedValue == null) {
    return storedValue;
  }
  if (storedValue instanceof Schema || storedValue instanceof List || storedValue instanceof Enum|| storedValue instanceof Boolean) {
    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();
      }
    }
  }
  String stringStoredValue=String.valueOf(storedValue);
  if (context != null && ContextParameterUtils.isContainContextParam(stringStoredValue)) {
    stringStoredValue=ContextParameterUtils.parseScriptContextCode(stringStoredValue,context);
  }
  List<?> possibleValues=property.getPossibleValues();
  if (possibleValues != null) {
    Object firstValue=null;
    if (!possibleValues.isEmpty()) {
      firstValue=possibleValues.get(0);
    }
    for (    Object possibleValue : possibleValues) {
      if (possibleValue.toString().equals(stringStoredValue)) {
        return possibleValue;
      }
    }
    if (firstValue != null) {
      return firstValue;
    }
  }
  return getTypedValue(property,stringStoredValue);
}

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|| storedValue instanceof Boolean) {
    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();
      }
    }
  }
  String stringStoredValue=String.valueOf(storedValue);
  if (context != null && ContextParameterUtils.isContainContextParam(stringStoredValue)) {
    stringStoredValue=ContextParameterUtils.parseScriptContextCode(stringStoredValue,context);
  }
  return getTypedValue(property,stringStoredValue);
}
Program: 118323
Project: 118323
Buggy source:
public Command createCommand(Button button){
  Object paramObj=button.getData(PARAM_OBJ);
  if (paramObj instanceof GenericElementParameter) {
    GenericElementParameter gParam=(GenericElementParameter)paramObj;
    if (gParam != null) {
      callBeforeActive(gParam);
      NameAndLabelsDialog nameAndLabelsDialog=new NameAndLabelsDialog(composite.getShell(),ComponentsUtils.getFormalPossibleValues(gParam),this.isInWizard());
      if (nameAndLabelsDialog.open() == IDialogConstants.OK_ID) {
        String propertyName=(String)button.getData(PARAMETER_NAME);
        String result=StringUtils.trimToEmpty(nameAndLabelsDialog.getResult());
        Text moduleText=(Text)hashCurControls.get(propertyName);
        moduleText.setText(result);
        gParam.setValue(result);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public Command createCommand(Button button){
  Object paramObj=button.getData(PARAM_OBJ);
  if (paramObj instanceof GenericElementParameter) {
    GenericElementParameter gParam=(GenericElementParameter)paramObj;
    if (gParam != null) {
      callBeforeActive(gParam);
      NameAndLabelsDialog nameAndLabelsDialog=new NameAndLabelsDialog(composite.getShell(),ComponentsUtils.getFormalPossibleValues(gParam),this.isInWizard());
      if (nameAndLabelsDialog.open() == IDialogConstants.OK_ID) {
        String propertyName=(String)button.getData(PARAMETER_NAME);
        String result=StringUtils.trimToEmpty(nameAndLabelsDialog.getResult());
        Text moduleText=(Text)hashCurControls.get(propertyName);
        moduleText.setText(result);
        PropertyChangeCommand pcc=new PropertyChangeCommand(elem,propertyName,result);
        return pcc;
      }
    }
  }
  return null;
}
Program: 118325
Project: 118325
Buggy source:
private String getParameterName(){
  String paramName=getName();
  if (paramName.indexOf(IGenericConstants.EXP_SEPARATOR) != -1) {
    paramName=paramName.substring(paramName.lastIndexOf(IGenericConstants.EXP_SEPARATOR) + 1);
  }
  return paramName;
}

Fixed version (ground truth):
public String getParameterName(){
  String paramName=getName();
  if (paramName.indexOf(IGenericConstants.EXP_SEPARATOR) != -1) {
    paramName=paramName.substring(paramName.lastIndexOf(IGenericConstants.EXP_SEPARATOR) + 1);
  }
  return paramName;
}
Program: 118327
Project: 118327
Buggy source:
static List<ModuleNeeded> getChildrenModules(final INode node,Set<ProcessItem> searchItems,boolean withChildrens,boolean forMR){
  List<ModuleNeeded> modulesNeeded=new ArrayList<ModuleNeeded>();
  if (node.getComponent().getName().equals("String_Node_Str")) {
    IElementParameter processIdparam=node.getElementParameter("String_Node_Str");
    IElementParameter processVersionParam=node.getElementParameter(EParameterName.PROCESS_TYPE_VERSION.getName());
    ProcessItem processItem=null;
    if (processVersionParam != null) {
      processItem=ItemCacheManager.getProcessItem((String)processIdparam.getValue(),(String)processVersionParam.getValue());
    }
 else {
      processItem=ItemCacheManager.getProcessItem((String)processIdparam.getValue());
    }
    String context=(String)node.getElementParameter("String_Node_Str").getValue();
    if (processItem != null && !searchItems.contains(processItem)) {
      boolean independent=getBooleanParamValue(node,"String_Node_Str") || getBooleanParamValue(node,"String_Node_Str");
      if (withChildrens || !independent) {
        searchItems.add(processItem);
        JobInfo subJobInfo=new JobInfo(processItem,context);
        IDesignerCoreService service=CorePlugin.getDefault().getDesignerCoreService();
        IProcess child=service.getProcessFromItem(subJobInfo.getProcessItem());
        getNeededModules(child,withChildrens,searchItems,modulesNeeded,forMR);
      }
    }
  }
  return modulesNeeded;
}

Fixed version (ground truth):
static List<ModuleNeeded> getChildrenModules(final INode node,Set<ProcessItem> searchItems,boolean forMR){
  List<ModuleNeeded> modulesNeeded=new ArrayList<ModuleNeeded>();
  if (node.getComponent().getName().equals("String_Node_Str")) {
    IElementParameter processIdparam=node.getElementParameter("String_Node_Str");
    IElementParameter processVersionParam=node.getElementParameter(EParameterName.PROCESS_TYPE_VERSION.getName());
    ProcessItem processItem=null;
    if (processVersionParam != null) {
      processItem=ItemCacheManager.getProcessItem((String)processIdparam.getValue(),(String)processVersionParam.getValue());
    }
 else {
      processItem=ItemCacheManager.getProcessItem((String)processIdparam.getValue());
    }
    String context=(String)node.getElementParameter("String_Node_Str").getValue();
    if (processItem != null && !searchItems.contains(processItem)) {
      boolean seperated=getBooleanParamValue(node,"String_Node_Str") || getBooleanParamValue(node,"String_Node_Str");
      if (!seperated) {
        searchItems.add(processItem);
        JobInfo subJobInfo=new JobInfo(processItem,context);
        IDesignerCoreService service=CorePlugin.getDefault().getDesignerCoreService();
        IProcess child=service.getProcessFromItem(subJobInfo.getProcessItem());
        getNeededModules(child,true,searchItems,modulesNeeded,forMR);
      }
    }
  }
  return modulesNeeded;
}
Program: 118328
Project: 118328
Buggy source:
private static Set<ModuleNeeded> getNeededModules(final INode node,Set<ProcessItem> searchItems,boolean withChildrens,boolean forMR){
  if (searchItems == null) {
    searchItems=new HashSet<ProcessItem>();
  }
  List<ModuleNeeded> modulesNeeded=new ArrayList<ModuleNeeded>();
  addNodeRelatedModules(node.getProcess(),modulesNeeded,node,forMR);
  if (withChildrens) {
    modulesNeeded.addAll(getChildrenModules(node,searchItems,withChildrens,forMR));
  }
  return new HashSet<ModuleNeeded>(modulesNeeded);
}

Fixed version (ground truth):
private static Set<ModuleNeeded> getNeededModules(final INode node,Set<ProcessItem> searchItems,boolean withChildrens,boolean forMR){
  if (searchItems == null) {
    searchItems=new HashSet<ProcessItem>();
  }
  List<ModuleNeeded> modulesNeeded=new ArrayList<ModuleNeeded>();
  addNodeRelatedModules(node.getProcess(),modulesNeeded,node,forMR);
  if (withChildrens) {
    modulesNeeded.addAll(getChildrenModules(node,searchItems,forMR));
  }
  return new HashSet<ModuleNeeded>(modulesNeeded);
}
Program: 118329
Project: 118329
Buggy source:
@Test public void testGetChildrenModules_noChildren(){
  INode node=mock(INode.class);
  IComponent component=mock(IComponent.class);
  when(node.getComponent()).thenReturn(component);
  when(component.getName()).thenReturn("String_Node_Str");
  List<ModuleNeeded> childrenModules=JavaProcessUtil.getChildrenModules(node,Collections.emptySet(),false,false);
  assertTrue(childrenModules.isEmpty());
}

Fixed version (ground truth):
@Test public void testGetChildrenModules_noChildren(){
  INode node=mock(INode.class);
  IComponent component=mock(IComponent.class);
  when(node.getComponent()).thenReturn(component);
  when(component.getName()).thenReturn("String_Node_Str");
  List<ModuleNeeded> childrenModules=JavaProcessUtil.getChildrenModules(node,Collections.emptySet(),false);
  assertTrue(childrenModules.isEmpty());
}
Program: 118330
Project: 118330
Buggy source:
private void exportJobForPOJO(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  File tmpJob=null;
  try {
    tmpJob=File.createTempFile("String_Node_Str","String_Node_Str",null);
    exportChoiceMap.put(ExportChoice.binaries,true);
    exportChoiceMap.put(ExportChoice.includeLibs,true);
    ProcessItem processItem=(ProcessItem)node.getObject().getProperty().getItem();
    BuildJobManager.getInstance().buildJob(tmpJob.getAbsolutePath(),processItem,processItem.getProperty().getVersion(),processItem.getProcess().getDefaultContext(),exportChoiceMap,exportType,monitor);
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
      IRunProcessService service=(IRunProcessService)GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
      boolean hasError=service.checkExportProcess(new StructuredSelection(node),true);
      if (hasError) {
        return;
      }
    }
    monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
    FeaturesModel featuresModel=getFeatureModel(tmpJob);
    process(processItem,featuresModel,monitor);
  }
 catch (  InterruptedException e) {
    throw e;
  }
catch (  Exception e) {
    throw new InvocationTargetException(e);
  }
 finally {
    if (tmpJob != null && tmpJob.exists()) {
      tmpJob.delete();
    }
  }
}

Fixed version (ground truth):
private void exportJobForPOJO(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  File tmpJob=null;
  try {
    tmpJob=File.createTempFile("String_Node_Str","String_Node_Str",null);
    exportChoiceMap.put(ExportChoice.binaries,true);
    exportChoiceMap.put(ExportChoice.includeLibs,true);
    ProcessItem processItem=(ProcessItem)node.getObject().getProperty().getItem();
    BuildJobManager.getInstance().buildJob(tmpJob.getAbsolutePath(),processItem,jobVersion,processItem.getProcess().getDefaultContext(),exportChoiceMap,exportType,monitor);
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
      IRunProcessService service=(IRunProcessService)GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
      boolean hasError=service.checkExportProcess(new StructuredSelection(node),true);
      if (hasError) {
        return;
      }
    }
    monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
    FeaturesModel featuresModel=getFeatureModel(tmpJob);
    process(processItem,featuresModel,monitor);
  }
 catch (  InterruptedException e) {
    throw e;
  }
catch (  Exception e) {
    throw new InvocationTargetException(e);
  }
 finally {
    if (tmpJob != null && tmpJob.exists()) {
      tmpJob.delete();
    }
  }
}
Program: 118331
Project: 118331
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 (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);
    }
  }
}

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();
  if (!LoginHelper.isRemoteConnection(getConnection())) {
    repositoryContext.setNoUpdateWhenLogon(true);
    return;
  }
  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: 118336
Project: 118336
Buggy source:
static List<ModuleNeeded> getChildrenModules(final INode node,Set<ProcessItem> searchItems,boolean withChildrens,boolean forMR){
  List<ModuleNeeded> modulesNeeded=new ArrayList<ModuleNeeded>();
  if (node.getComponent().getName().equals("String_Node_Str")) {
    IElementParameter processIdparam=node.getElementParameter("String_Node_Str");
    IElementParameter processVersionParam=node.getElementParameter(EParameterName.PROCESS_TYPE_VERSION.getName());
    ProcessItem processItem=null;
    if (processVersionParam != null) {
      processItem=ItemCacheManager.getProcessItem((String)processIdparam.getValue(),(String)processVersionParam.getValue());
    }
 else {
      processItem=ItemCacheManager.getProcessItem((String)processIdparam.getValue());
    }
    String context=(String)node.getElementParameter("String_Node_Str").getValue();
    if (processItem != null && !searchItems.contains(processItem)) {
      boolean independent=getBooleanParamValue(node,"String_Node_Str") || getBooleanParamValue(node,"String_Node_Str");
      if (withChildrens || !independent) {
        searchItems.add(processItem);
        JobInfo subJobInfo=new JobInfo(processItem,context);
        IDesignerCoreService service=CorePlugin.getDefault().getDesignerCoreService();
        IProcess child=service.getProcessFromItem(subJobInfo.getProcessItem());
        JavaProcessUtil.getNeededModules(child,true,searchItems,modulesNeeded,forMR);
      }
    }
  }
  return modulesNeeded;
}

Fixed version (ground truth):
static List<ModuleNeeded> getChildrenModules(final INode node,Set<ProcessItem> searchItems,boolean withChildrens,boolean forMR){
  List<ModuleNeeded> modulesNeeded=new ArrayList<ModuleNeeded>();
  if (node.getComponent().getName().equals("String_Node_Str")) {
    IElementParameter processIdparam=node.getElementParameter("String_Node_Str");
    IElementParameter processVersionParam=node.getElementParameter(EParameterName.PROCESS_TYPE_VERSION.getName());
    ProcessItem processItem=null;
    if (processVersionParam != null) {
      processItem=ItemCacheManager.getProcessItem((String)processIdparam.getValue(),(String)processVersionParam.getValue());
    }
 else {
      processItem=ItemCacheManager.getProcessItem((String)processIdparam.getValue());
    }
    String context=(String)node.getElementParameter("String_Node_Str").getValue();
    if (processItem != null && !searchItems.contains(processItem)) {
      boolean independent=getBooleanParamValue(node,"String_Node_Str") || getBooleanParamValue(node,"String_Node_Str");
      if (withChildrens || !independent) {
        searchItems.add(processItem);
        JobInfo subJobInfo=new JobInfo(processItem,context);
        IDesignerCoreService service=CorePlugin.getDefault().getDesignerCoreService();
        IProcess child=service.getProcessFromItem(subJobInfo.getProcessItem());
        getNeededModules(child,withChildrens,searchItems,modulesNeeded,forMR);
      }
    }
  }
  return modulesNeeded;
}
Program: 118337
Project: 118337
Buggy source:
private static boolean getBooleanParamValue(final INode node,String paramName){
  IElementParameter parameter=node.getElementParameter("String_Node_Str");
  if (parameter != null && parameter.getValue() != null) {
    return Boolean.parseBoolean(parameter.getValue().toString());
  }
  return false;
}

Fixed version (ground truth):
private static boolean getBooleanParamValue(final INode node,String paramName){
  IElementParameter parameter=node.getElementParameter(paramName);
  if (parameter != null && parameter.getValue() != null) {
    return Boolean.parseBoolean(parameter.getValue().toString());
  }
  return false;
}
Program: 118338
Project: 118338
Buggy source:
@Override public Object evaluate(Property property,Object storedValue){
  if (storedValue == null) {
    return storedValue;
  }
  List<?> possibleValues=property.getPossibleValues();
  if (possibleValues != null) {
    if (storedValue instanceof String && !ContextParameterUtils.isContainContextParam((String)storedValue)) {
      for (      Object possibleValue : possibleValues) {
        if (possibleValue.toString().equals(storedValue)) {
          return possibleValue;
        }
      }
    }
  }
  if (storedValue instanceof Schema || storedValue instanceof List || storedValue instanceof Enum|| storedValue instanceof Boolean) {
    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();
      }
    }
  }
  String stringStoredValue=String.valueOf(storedValue);
  if (context != null && ContextParameterUtils.isContainContextParam(stringStoredValue)) {
    stringStoredValue=ContextParameterUtils.parseScriptContextCode(stringStoredValue,context);
  }
  return getTypedValue(property,stringStoredValue);
}

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|| storedValue instanceof Boolean) {
    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();
      }
    }
  }
  String stringStoredValue=String.valueOf(storedValue);
  if (context != null && ContextParameterUtils.isContainContextParam(stringStoredValue)) {
    stringStoredValue=ContextParameterUtils.parseScriptContextCode(stringStoredValue,context);
  }
  List<?> possibleValues=property.getPossibleValues();
  if (possibleValues != null) {
    Object firstValue=null;
    if (!possibleValues.isEmpty()) {
      firstValue=possibleValues.get(0);
    }
    for (    Object possibleValue : possibleValues) {
      if (possibleValue.toString().equals(stringStoredValue)) {
        return possibleValue;
      }
    }
    if (firstValue != null) {
      return firstValue;
    }
  }
  return getTypedValue(property,stringStoredValue);
}
Program: 118339
Project: 118339
Buggy source:
@Override public List<NodeReturn> createReturns(){
  List<NodeReturn> listReturn=new ArrayList<>();
  ComponentProperties componentProperties=ComponentsUtils.getComponentProperties(getName());
  if (!(componentProperties instanceof ComponentPropertiesImpl)) {
    return listReturn;
  }
  NodeReturn nodeRet=new NodeReturn();
  nodeRet.setType(JavaTypesManager.STRING.getLabel());
  nodeRet.setDisplayName(ComponentReturnVariableUtils.getTranslationForVariable(ERROR_MESSAGE,ComponentDefinition.RETURN_ERROR_MESSAGE));
  nodeRet.setName(ComponentReturnVariableUtils.getStudioNameFromVariable(ComponentDefinition.RETURN_ERROR_MESSAGE));
  nodeRet.setAvailability("String_Node_Str");
  listReturn.add(nodeRet);
  for (  Property<?> child : componentDefinition.getReturnProperties()) {
    nodeRet=new NodeReturn();
    nodeRet.setType(ComponentsUtils.getTalendTypeFromProperty(child).getId());
    nodeRet.setDisplayName(ComponentReturnVariableUtils.getTranslationForVariable(child.getName(),child.getDisplayName()));
    nodeRet.setName(ComponentReturnVariableUtils.getStudioNameFromVariable(child.getName()));
    if (nodeRet.getName().equals(ERROR_MESSAGE)) {
      continue;
    }
    Object object=child.getTaggedValue(IGenericConstants.AVAILABILITY);
    if (object != null) {
      nodeRet.setAvailability(object.toString());
    }
 else {
      nodeRet.setAvailability("String_Node_Str");
    }
    listReturn.add(nodeRet);
  }
  return listReturn;
}

Fixed version (ground truth):
@Override public List<NodeReturn> createReturns(){
  List<NodeReturn> listReturn=new ArrayList<>();
  ComponentProperties componentProperties=ComponentsUtils.getComponentProperties(getName());
  if (!(componentProperties instanceof ComponentPropertiesImpl)) {
    return listReturn;
  }
  NodeReturn nodeRet=new NodeReturn();
  nodeRet.setType(JavaTypesManager.STRING.getLabel());
  nodeRet.setDisplayName(ComponentReturnVariableUtils.getTranslationForVariable(ComponentDefinition.RETURN_ERROR_MESSAGE,ComponentDefinition.RETURN_ERROR_MESSAGE));
  nodeRet.setName(ComponentReturnVariableUtils.getStudioNameFromVariable(ComponentDefinition.RETURN_ERROR_MESSAGE));
  nodeRet.setAvailability("String_Node_Str");
  listReturn.add(nodeRet);
  for (  Property<?> child : componentDefinition.getReturnProperties()) {
    nodeRet=new NodeReturn();
    nodeRet.setType(ComponentsUtils.getTalendTypeFromProperty(child).getId());
    nodeRet.setDisplayName(ComponentReturnVariableUtils.getTranslationForVariable(child.getName(),child.getDisplayName()));
    nodeRet.setName(ComponentReturnVariableUtils.getStudioNameFromVariable(child.getName()));
    if (nodeRet.getName().equals(ERROR_MESSAGE)) {
      continue;
    }
    Object object=child.getTaggedValue(IGenericConstants.AVAILABILITY);
    if (object != null) {
      nodeRet.setAvailability(object.toString());
    }
 else {
      nodeRet.setAvailability("String_Node_Str");
    }
    listReturn.add(nodeRet);
  }
  return listReturn;
}
Program: 118341
Project: 118341
Buggy source:
static List<ModuleNeeded> getChildrenModules(final INode node,Set<ProcessItem> searchItems,boolean withChildrens,boolean forMR){
  List<ModuleNeeded> modulesNeeded=new ArrayList<ModuleNeeded>();
  if (node.getComponent().getName().equals("String_Node_Str")) {
    IElementParameter processIdparam=node.getElementParameter("String_Node_Str");
    IElementParameter processVersionParam=node.getElementParameter(EParameterName.PROCESS_TYPE_VERSION.getName());
    ProcessItem processItem=null;
    if (processVersionParam != null) {
      processItem=ItemCacheManager.getProcessItem((String)processIdparam.getValue(),(String)processVersionParam.getValue());
    }
 else {
      processItem=ItemCacheManager.getProcessItem((String)processIdparam.getValue());
    }
    String context=(String)node.getElementParameter("String_Node_Str").getValue();
    if (processItem != null && !searchItems.contains(processItem)) {
      boolean independent=getBooleanParamValue(node,"String_Node_Str") || getBooleanParamValue(node,"String_Node_Str");
      if (withChildrens || !independent) {
        searchItems.add(processItem);
        JobInfo subJobInfo=new JobInfo(processItem,context);
        IDesignerCoreService service=CorePlugin.getDefault().getDesignerCoreService();
        IProcess child=service.getProcessFromItem(subJobInfo.getProcessItem());
        JavaProcessUtil.getNeededModules(child,true,searchItems,modulesNeeded,forMR);
      }
    }
  }
  return modulesNeeded;
}

Fixed version (ground truth):
static List<ModuleNeeded> getChildrenModules(final INode node,Set<ProcessItem> searchItems,boolean withChildrens,boolean forMR){
  List<ModuleNeeded> modulesNeeded=new ArrayList<ModuleNeeded>();
  if (node.getComponent().getName().equals("String_Node_Str")) {
    IElementParameter processIdparam=node.getElementParameter("String_Node_Str");
    IElementParameter processVersionParam=node.getElementParameter(EParameterName.PROCESS_TYPE_VERSION.getName());
    ProcessItem processItem=null;
    if (processVersionParam != null) {
      processItem=ItemCacheManager.getProcessItem((String)processIdparam.getValue(),(String)processVersionParam.getValue());
    }
 else {
      processItem=ItemCacheManager.getProcessItem((String)processIdparam.getValue());
    }
    String context=(String)node.getElementParameter("String_Node_Str").getValue();
    if (processItem != null && !searchItems.contains(processItem)) {
      boolean independent=getBooleanParamValue(node,"String_Node_Str") || getBooleanParamValue(node,"String_Node_Str");
      if (withChildrens || !independent) {
        searchItems.add(processItem);
        JobInfo subJobInfo=new JobInfo(processItem,context);
        IDesignerCoreService service=CorePlugin.getDefault().getDesignerCoreService();
        IProcess child=service.getProcessFromItem(subJobInfo.getProcessItem());
        getNeededModules(child,withChildrens,searchItems,modulesNeeded,forMR);
      }
    }
  }
  return modulesNeeded;
}
Program: 118342
Project: 118342
Buggy source:
private static boolean getBooleanParamValue(final INode node,String paramName){
  IElementParameter parameter=node.getElementParameter("String_Node_Str");
  if (parameter != null && parameter.getValue() != null) {
    return Boolean.parseBoolean(parameter.getValue().toString());
  }
  return false;
}

Fixed version (ground truth):
private static boolean getBooleanParamValue(final INode node,String paramName){
  IElementParameter parameter=node.getElementParameter(paramName);
  if (parameter != null && parameter.getValue() != null) {
    return Boolean.parseBoolean(parameter.getValue().toString());
  }
  return false;
}
Program: 118343
Project: 118343
Buggy source:
@Override public void propertyChange(PropertyChangeEvent event){
  String propertyName=event.getPropertyName();
  if (IElementParameterEventProperties.EVENT_PROPERTY_VALUE_CHANGED.equals(propertyName)) {
    reset(true);
  }
 else   if (IElementParameterEventProperties.EVENT_PROPERTY_NAME_CHANGED.equals(propertyName)) {
    String newPropertyName=String.valueOf(event.getNewValue());
    updateProperty(newPropertyName);
  }
 else   if (IElementParameterEventProperties.EVENT_VALIDATE_RESULT_UPDATE.equals(propertyName)) {
    Object newValue=event.getNewValue();
    if (newValue instanceof ValidationResult) {
      updateValidationStatus((ValidationResult)newValue);
    }
  }
 else   if (IElementParameterEventProperties.EVENT_SHOW_DIALOG.equals(propertyName)) {
    Object newValue=event.getNewValue();
    if (newValue instanceof Form) {
      GenericDialog genericDialog=new GenericDialog(getShell(),(Form)newValue);
      genericDialog.setConnectionItem(connectionItem);
      genericDialog.open();
    }
  }
 else   if (IContextEventProperties.EVENT_PROPERTY_EXPORT_CONTEXT.equals(propertyName)) {
    resetComponentProperties();
  }
 else   if (IContextEventProperties.EVENT_PROPERTY_REFRESH_UI.equals(propertyName)) {
    Object newValue=event.getNewValue();
    if (newValue instanceof ComponentProperties) {
      ComponentProperties newComponentProperties=(ComponentProperties)newValue;
      form.getProperties().copyValuesFrom(newComponentProperties);
      reset(true);
    }
  }
}

Fixed version (ground truth):
@Override public void propertyChange(PropertyChangeEvent event){
  String propertyName=event.getPropertyName();
  if (IElementParameterEventProperties.EVENT_PROPERTY_VALUE_CHANGED.equals(propertyName)) {
    reset(true);
  }
 else   if (IElementParameterEventProperties.EVENT_VALIDATE_RESULT_UPDATE.equals(propertyName)) {
    Object newValue=event.getNewValue();
    if (newValue instanceof ValidationResult) {
      updateValidationStatus((ValidationResult)newValue);
    }
  }
 else   if (IElementParameterEventProperties.EVENT_SHOW_DIALOG.equals(propertyName)) {
    Object newValue=event.getNewValue();
    if (newValue instanceof Form) {
      GenericDialog genericDialog=new GenericDialog(getShell(),(Form)newValue);
      genericDialog.setConnectionItem(connectionItem);
      genericDialog.open();
    }
  }
 else   if (IContextEventProperties.EVENT_PROPERTY_EXPORT_CONTEXT.equals(propertyName)) {
    resetComponentProperties();
  }
 else   if (IContextEventProperties.EVENT_PROPERTY_REFRESH_UI.equals(propertyName)) {
    Object newValue=event.getNewValue();
    if (newValue instanceof ComponentProperties) {
      ComponentProperties newComponentProperties=(ComponentProperties)newValue;
      form.getProperties().copyValuesFrom(newComponentProperties);
      reset(true);
    }
  }
}
Program: 118344
Project: 118344
Buggy source:
@Override public void setVisible(boolean visible){
  super.setVisible(visible);
  if (visible) {
    parameters=dynamicComposite.resetParameters();
    dynamicComposite.refresh();
    updateContextFields();
  }
}

Fixed version (ground truth):
@Override public void setVisible(boolean visible){
  super.setVisible(visible);
  if (visible) {
    parameters=dynamicComposite.resetParameters();
    dynamicComposite.refresh();
    updateContextFields();
    if (getNameParameter() != null) {
      getNameParameter().addPropertyChangeListener(this);
      Job job=new Job("String_Node_Str"){
        @Override protected IStatus run(        IProgressMonitor monitor){
          try {
            listExistingObjects=loadRepositoryViewObjectList();
          }
 catch (          PersistenceException e) {
            return new org.eclipse.core.runtime.Status(IStatus.ERROR,"String_Node_Str",1,"String_Node_Str",e);
          }
          retrieveNameFinished=true;
          Display d=DisplayUtils.getDisplay();
          if (d != null) {
            d.syncExec(new Runnable(){
              @Override public void run(){
                evaluateTextField();
              }
            }
);
          }
          return Status.OK_STATUS;
        }
      }
;
      job.setUser(false);
      job.setPriority(Job.BUILD);
      job.schedule();
    }
  }
}
Program: 118345
Project: 118345
Buggy source:
@Override public void checkPerformed(IChecker source){
  String status=source.getStatus();
  if (source.isStatusOnError()) {
    setErrorMessage(status);
  }
 else {
    setErrorMessage(null);
    if (status != null) {
      setMessage(status,source.getStatusLevel());
    }
  }
  updatePageStatus();
}

Fixed version (ground truth):
@Override public void checkPerformed(IChecker source){
  String status=source.getStatus();
  if (source.isStatusOnError()) {
    genericStatus=createStatus(IStatus.ERROR,status);
  }
 else {
    genericStatus=createOkStatus();
    if (status != null) {
      genericStatus=createStatus(source.getStatusLevel(),status);
    }
  }
  updatePageStatus();
}
Program: 118346
Project: 118346
Buggy source:
protected void addCheckListener(IChecker checker){
  ICheckListener checkListener=new ICheckListener(){
    @Override public void checkPerformed(    IChecker source){
      String status=source.getStatus();
      if (source.isStatusOnError()) {
        setErrorMessage(status);
      }
 else {
        setErrorMessage(null);
        if (status != null) {
          setMessage(status,source.getStatusLevel());
        }
      }
      updatePageStatus();
    }
  }
;
  checker.setListener(checkListener);
}

Fixed version (ground truth):
protected void addCheckListener(IChecker checker){
  ICheckListener checkListener=new ICheckListener(){
    @Override public void checkPerformed(    IChecker source){
      String status=source.getStatus();
      if (source.isStatusOnError()) {
        genericStatus=createStatus(IStatus.ERROR,status);
      }
 else {
        genericStatus=createOkStatus();
        if (status != null) {
          genericStatus=createStatus(source.getStatusLevel(),status);
        }
      }
      updatePageStatus();
    }
  }
;
  checker.setListener(checkListener);
}
Program: 118347
Project: 118347
Buggy source:
/** 
 * If a DI job calls somehow a Big Data job, then the PACKAGE Maven goal must be called on all the jobs.
 * @return true if the job or its recursive childs contain a tRunJob which points to a Big Data job
 */
protected boolean requirePackaging(){
  if (this.requirePackaging == null) {
    List<? extends INode> generatedNodes=process.getGeneratingNodes();
    try {
      for (      INode node : generatedNodes) {
        if (node.getComponent() != null && "String_Node_Str".equals(node.getComponent().getName())) {
          IElementParameter elementParameter=node.getElementParameter("String_Node_Str");
          if (elementParameter != null) {
            Object value=elementParameter.getValue();
            if (value != null && !"String_Node_Str".equals(value)) {
              IRepositoryViewObject lastVersion=RunProcessPlugin.getDefault().getRepositoryService().getProxyRepositoryFactory().getLastVersion(value.toString());
              if (lastVersion != null) {
                boolean hasBatchOrStreamingSubProcess=hasBatchOrStreamingSubProcess(lastVersion.getProperty().getItem());
                if (hasBatchOrStreamingSubProcess) {
                  return true;
                }
              }
            }
          }
        }
      }
    }
 catch (    PersistenceException e) {
      return false;
    }
    return false;
  }
  return this.requirePackaging;
}

Fixed version (ground truth):
/** 
 * If a DI job calls somehow a Big Data job, then the PACKAGE Maven goal must be called on all the jobs.
 * @return true if the job or its recursive childs contain a tRunJob which points to a Big Data job
 */
protected boolean requirePackaging(){
  if (this.requirePackaging == null) {
    List<? extends INode> generatedNodes=process.getGeneratingNodes();
    try {
      for (      INode node : generatedNodes) {
        if (node.getComponent() != null && "String_Node_Str".equals(node.getComponent().getName())) {
          IElementParameter elementParameter=node.getElementParameter("String_Node_Str");
          if (elementParameter != null) {
            Object value=elementParameter.getValue();
            if (value != null && !"String_Node_Str".equals(value)) {
              IRepositoryViewObject lastVersion=RunProcessPlugin.getDefault().getRepositoryService().getProxyRepositoryFactory().getLastVersion(value.toString());
              if (lastVersion != null) {
                boolean hasBatchOrStreamingSubProcess=JavaProcessorUtilities.hasBatchOrStreamingSubProcess(lastVersion.getProperty().getItem());
                if (hasBatchOrStreamingSubProcess) {
                  return true;
                }
              }
            }
          }
        }
      }
    }
 catch (    PersistenceException e) {
      return false;
    }
    return false;
  }
  return this.requirePackaging;
}
Program: 118348
Project: 118348
Buggy source:
public boolean shouldRunAsExport(){
  List<? extends INode> generatedNodes=process.getGeneratingNodes();
  try {
    for (    INode node : generatedNodes) {
      if (node.getComponent() != null && "String_Node_Str".equals(node.getComponent().getName())) {
        IElementParameter elementParameter=node.getElementParameter("String_Node_Str");
        if (elementParameter != null) {
          Object value=elementParameter.getValue();
          if (value != null && !"String_Node_Str".equals(value)) {
            IRepositoryViewObject lastVersion=RunProcessPlugin.getDefault().getRepositoryService().getProxyRepositoryFactory().getLastVersion(value.toString());
            if (lastVersion != null) {
              boolean hasBatchOrStreamingSubProcess=hasBatchOrStreamingSubProcess(lastVersion.getProperty().getItem());
              if (hasBatchOrStreamingSubProcess) {
                return true;
              }
            }
          }
        }
      }
    }
  }
 catch (  PersistenceException e) {
    return false;
  }
  return false;
}

Fixed version (ground truth):
public boolean shouldRunAsExport(){
  List<? extends INode> generatedNodes=process.getGeneratingNodes();
  try {
    for (    INode node : generatedNodes) {
      if (node.getComponent() != null && "String_Node_Str".equals(node.getComponent().getName())) {
        IElementParameter elementParameter=node.getElementParameter("String_Node_Str");
        if (elementParameter != null) {
          Object value=elementParameter.getValue();
          if (value != null && !"String_Node_Str".equals(value)) {
            IRepositoryViewObject lastVersion=RunProcessPlugin.getDefault().getRepositoryService().getProxyRepositoryFactory().getLastVersion(value.toString());
            if (lastVersion != null) {
              boolean hasBatchOrStreamingSubProcess=JavaProcessorUtilities.hasBatchOrStreamingSubProcess(lastVersion.getProperty().getItem());
              if (hasBatchOrStreamingSubProcess) {
                return true;
              }
            }
          }
        }
      }
    }
  }
 catch (  PersistenceException e) {
    return false;
  }
  return false;
}
Program: 118349
Project: 118349
Buggy source:
private static Set<ModuleNeeded> getNeededModules(final INode node,Set<ProcessItem> searchItems,boolean withChildrens,boolean forMR){
  if (searchItems == null) {
    searchItems=new HashSet<ProcessItem>();
  }
  List<ModuleNeeded> modulesNeeded=new ArrayList<ModuleNeeded>();
  addNodeRelatedModules(node.getProcess(),modulesNeeded,node,forMR);
  if (withChildrens) {
    if (node.getComponent().getName().equals("String_Node_Str")) {
      IElementParameter processIdparam=node.getElementParameter("String_Node_Str");
      IElementParameter processVersionParam=node.getElementParameter(EParameterName.PROCESS_TYPE_VERSION.getName());
      ProcessItem processItem=null;
      if (processVersionParam != null) {
        processItem=ItemCacheManager.getProcessItem((String)processIdparam.getValue(),(String)processVersionParam.getValue());
      }
 else {
        processItem=ItemCacheManager.getProcessItem((String)processIdparam.getValue());
      }
      String context=(String)node.getElementParameter("String_Node_Str").getValue();
      if (processItem != null && !searchItems.contains(processItem)) {
        searchItems.add(processItem);
        JobInfo subJobInfo=new JobInfo(processItem,context);
        IDesignerCoreService service=CorePlugin.getDefault().getDesignerCoreService();
        IProcess child=service.getProcessFromItem(subJobInfo.getProcessItem());
        JavaProcessUtil.getNeededModules(child,true,searchItems,modulesNeeded,forMR);
      }
    }
  }
  return new HashSet<ModuleNeeded>(modulesNeeded);
}

Fixed version (ground truth):
private static Set<ModuleNeeded> getNeededModules(final INode node,Set<ProcessItem> searchItems,boolean withChildrens,boolean forMR){
  if (searchItems == null) {
    searchItems=new HashSet<ProcessItem>();
  }
  List<ModuleNeeded> modulesNeeded=new ArrayList<ModuleNeeded>();
  addNodeRelatedModules(node.getProcess(),modulesNeeded,node,forMR);
  modulesNeeded.addAll(getChildrenModules(node,searchItems,withChildrens,forMR));
  return new HashSet<ModuleNeeded>(modulesNeeded);
}