nus-yam/ex-repair huggingface dataset:
Program: 125960
Project: 125960
Buggy source:
private static void generateBuildInfo(JobInfo jobInfo,IProgressMonitor progressMonitor,boolean isMainJob,IProcess currentProcess,String currentJobName,IProcessor processor,int option) throws ProcessorException {
  if (isMainJob) {
    progressMonitor.subTask(Messages.getString("String_Node_Str") + currentJobName);
    if (codeModified && !BitwiseOptionUtils.containOption(option,GENERATE_WITHOUT_COMPILING)) {
      try {
        processor.build(progressMonitor);
      }
 catch (      Exception e) {
        throw new ProcessorException(e);
      }
      processor.syntaxCheck();
    }
    needContextInCurrentGeneration=true;
    codeModified=false;
  }
}

Fixed version (ground truth):
private static void generateBuildInfo(JobInfo jobInfo,IProgressMonitor progressMonitor,boolean isMainJob,IProcess currentProcess,String currentJobName,IProcessor processor,int option) throws ProcessorException {
  if (isMainJob) {
    progressMonitor.subTask(Messages.getString("String_Node_Str") + currentJobName);
    if (codeModified && !BitwiseOptionUtils.containOption(option,GENERATE_WITHOUT_COMPILING)) {
      try {
        processor.build(progressMonitor);
      }
 catch (      Exception e) {
        throw new ProcessorException(e);
      }
      processor.syntaxCheck();
    }
    needContextInCurrentGeneration=true;
    retrievedJarsForCurrentBuild.clear();
    codeModified=false;
  }
}
Program: 125961
Project: 125961
Buggy source:
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  monitor.beginTask(Messages.getString("String_Node_Str"),IProgressMonitor.UNKNOWN);
  try {
    List<ModuleToInstall> mti=modulesToInstall;
    if (mti == null) {
      mti=new ArrayList<ModuleToInstall>();
    }
    Map<String,License> typeToLicense=new HashMap<String,License>();
    for (    ModuleToInstall moduleToInstall : mti) {
      String licenseType=moduleToInstall.getLicenseType();
      if (licenseType == null) {
        licenseType=UNKNOWN_LICENSE;
      }
      boolean isLicenseAccepted=LibManagerUiPlugin.getDefault().getPreferenceStore().getBoolean(licenseType);
      if (isLicenseAccepted) {
        continue;
      }
      License license=typeToLicense.get(licenseType);
      if (license == null) {
        license=new License();
        String licenseUrl=RemoteModulesHelper.getInstance().getLicenseUrl(licenseType);
        license.setName(licenseType);
        license.setType(licenseType);
        license.setUrl(licenseUrl);
        license.setParent(licenseRoot);
        licenseRoot.addChild(license);
        typeToLicense.put(licenseType,license);
        licenseTypeToStatus.put(licenseType,false);
      }
      Module module=new Module();
      module.setName(moduleToInstall.getName());
      module.setParent(license);
      license.addChild(module);
    }
  }
  finally {
    monitor.done();
  }
}

Fixed version (ground truth):
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  monitor.beginTask(Messages.getString("String_Node_Str"),IProgressMonitor.UNKNOWN);
  try {
    List<ModuleToInstall> mti=modulesToInstall;
    if (mti == null) {
      mti=new ArrayList<ModuleToInstall>();
    }
    Map<String,License> typeToLicense=new HashMap<String,License>();
    for (    ModuleToInstall moduleToInstall : mti) {
      if (moduleToInstall.isFromCustomNexus()) {
        continue;
      }
      String licenseType=moduleToInstall.getLicenseType();
      if (licenseType == null) {
        licenseType=UNKNOWN_LICENSE;
      }
      boolean isLicenseAccepted=LibManagerUiPlugin.getDefault().getPreferenceStore().getBoolean(licenseType);
      if (isLicenseAccepted) {
        continue;
      }
      License license=typeToLicense.get(licenseType);
      if (license == null) {
        license=new License();
        String licenseUrl=RemoteModulesHelper.getInstance().getLicenseUrl(licenseType);
        license.setName(licenseType);
        license.setType(licenseType);
        license.setUrl(licenseUrl);
        license.setParent(licenseRoot);
        licenseRoot.addChild(license);
        typeToLicense.put(licenseType,license);
        licenseTypeToStatus.put(licenseType,false);
      }
      Module module=new Module();
      module.setName(moduleToInstall.getName());
      module.setParent(license);
      license.addChild(module);
    }
  }
  finally {
    monitor.done();
  }
}
Program: 125963
Project: 125963
Buggy source:
protected boolean hasLicensesToAccept(){
  if (toDownload != null && toDownload.size() > 0) {
    for (    ModuleToInstall module : toDownload) {
      String licenseType=module.getLicenseType();
      if (licenseType != null) {
        boolean isLicenseAccepted=LibManagerUiPlugin.getDefault().getPreferenceStore().getBoolean(module.getLicenseType());
        if (!isLicenseAccepted) {
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
protected boolean hasLicensesToAccept(){
  if (toDownload != null && toDownload.size() > 0) {
    for (    ModuleToInstall module : toDownload) {
      if (module.isFromCustomNexus()) {
        continue;
      }
      String licenseType=module.getLicenseType();
      if (licenseType != null) {
        boolean isLicenseAccepted=LibManagerUiPlugin.getDefault().getPreferenceStore().getBoolean(module.getLicenseType());
        if (!isLicenseAccepted) {
          return true;
        }
      }
    }
  }
  return false;
}
Program: 125965
Project: 125965
Buggy source:
@Override public List<ComponentDefinition> getPossibleComponents(ComponentProperties properties) throws Throwable {
  return service.getPossibleComponents(properties);
}

Fixed version (ground truth):
@Override public List<ComponentDefinition> getPossibleComponents(ComponentProperties... properties) throws Throwable {
  return service.getPossibleComponents(properties);
}
Program: 125966
Project: 125966
Buggy source:
@Override public String storeProperties(ComponentProperties properties,String name,String repositoryLocation,Schema schema){
  return service.storeProperties(properties,name,repositoryLocation,schema);
}

Fixed version (ground truth):
@Override public String storeProperties(ComponentProperties properties,String name,String repositoryLocation,String schemaPropertyName){
  return service.storeProperties(properties,name,repositoryLocation,schemaPropertyName);
}
Program: 125967
Project: 125967
Buggy source:
/** 
 * DOC bqian Comment method "getJobletCustomIcon".
 * @param property
 * @return
 */
public static Image getJobletCustomIcon(Property property){
  JobletProcessItem item=(JobletProcessItem)property.getItem();
  Image image=null;
  if (item.getIcon() == null || item.getIcon().getInnerContent() == null || item.getIcon().getInnerContent().length == 0) {
    image=getDefaultJobletImage();
  }
 else {
    ImageDescriptor imageDesc=ImageUtils.createImageFromData(item.getIcon().getInnerContent());
    imageDesc=ImageUtils.scale(imageDesc,ICON_SIZE.ICON_32);
    image=cachedImages.get(item.getIcon().getInnerContent());
    if (image == null || image.isDisposed()) {
      image=imageDesc.createImage();
      cachedImages.put(item.getIcon().getInnerContent(),image);
    }
 else {
    }
  }
  return image;
}

Fixed version (ground truth):
/** 
 * DOC bqian Comment method "getJobletCustomIcon".
 * @param property
 * @return
 */
public static Image getJobletCustomIcon(Property property){
  JobletProcessItem item=(JobletProcessItem)property.getItem();
  Image image=null;
  if (item.getIcon() == null || item.getIcon().getInnerContent() == null || item.getIcon().getInnerContent().length == 0) {
    image=getDefaultJobletImage();
  }
 else {
    ImageDescriptor imageDesc=ImageUtils.createImageFromData(item.getIcon().getInnerContent());
    imageDesc=ImageUtils.scale(imageDesc,ICON_SIZE.ICON_32);
    String md5Desc=MD5.getMD5(item.getIcon().getInnerContent());
    image=cachedImages.get(md5Desc);
    if (image == null || image.isDisposed()) {
      image=imageDesc.createImage();
      cachedImages.put(md5Desc,image);
    }
 else {
    }
  }
  return image;
}
Program: 125970
Project: 125970
Buggy source:
/** 
 * DOC ycbai Comment method "getHadoopPropertiesList". <p> Get the list type of hadoop properties from json string. </p>
 * @param propertiesJsonStr
 * @param includeQuotes
 * @return
 * @throws JSONException
 */
public static List<Map<String,Object>> getHadoopPropertiesList(String propertiesJsonStr,boolean includeQuotes){
  List<Map<String,Object>> properties=new ArrayList<Map<String,Object>>();
  try {
    if (StringUtils.isNotEmpty(propertiesJsonStr)) {
      JSONArray jsonArr=new JSONArray(propertiesJsonStr);
      for (int i=0; i < jsonArr.length(); i++) {
        HashMap<String,Object> map=new HashMap<String,Object>();
        JSONObject object=jsonArr.getJSONObject(i);
        Iterator<String> it=object.keys();
        while (it.hasNext()) {
          String key=it.next();
          String value=String.valueOf(object.get(key));
          if (includeQuotes) {
            value=TalendQuoteUtils.addQuotesIfNotExist(value);
          }
 else {
            value=TalendQuoteUtils.removeQuotesIfExist(value);
          }
          map.put(key,value);
        }
        properties.add(map);
      }
    }
  }
 catch (  JSONException e) {
    ExceptionHandler.process(e);
  }
  return properties;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "getHadoopPropertiesList". <p> Get the list type of hadoop properties from json string. </p>
 * @param propertiesJsonStr
 * @param includeQuotes
 * @return
 * @throws JSONException
 */
public static List<Map<String,Object>> getHadoopPropertiesList(String propertiesJsonStr,boolean isContextMode,boolean includeQuotes){
  List<Map<String,Object>> properties=new ArrayList<Map<String,Object>>();
  try {
    if (StringUtils.isNotEmpty(propertiesJsonStr)) {
      JSONArray jsonArr=new JSONArray(propertiesJsonStr);
      for (int i=0; i < jsonArr.length(); i++) {
        HashMap<String,Object> map=new HashMap<String,Object>();
        JSONObject object=jsonArr.getJSONObject(i);
        Iterator<String> it=object.keys();
        while (it.hasNext()) {
          String key=it.next();
          String value=String.valueOf(object.get(key));
          if (includeQuotes) {
            if (isContextMode && "String_Node_Str".equals(key)) {
              value=TalendQuoteUtils.removeQuotesIfExist(value);
            }
 else {
              value=TalendQuoteUtils.addQuotesIfNotExist(value);
            }
          }
 else {
            value=TalendQuoteUtils.removeQuotesIfExist(value);
          }
          map.put(key,value);
        }
        properties.add(map);
      }
    }
  }
 catch (  JSONException e) {
    ExceptionHandler.process(e);
  }
  return properties;
}
Program: 125971
Project: 125971
Buggy source:
public static ERepositoryObjectType getType(String typeName){
  for (  ERepositoryObjectType type : (ERepositoryObjectType[])values()) {
    if (type.getType().equals(typeName)) {
      return type;
    }
  }
  return null;
}

Fixed version (ground truth):
public static ERepositoryObjectType getType(Property property){
  String itemId=property.getId();
  ERepositoryObjectType type=typeCacheById.get(itemId);
  if (type == null) {
    Item item=property.getItem();
    type=getItemType(item);
    if (type != null) {
      typeCacheById.put(itemId,type);
    }
  }
  return type;
}
Program: 125973
Project: 125973
Buggy source:
@Override public String storeProperties(ComponentProperties properties,String name,String repositoryLocation,Schema schema){
  return service.storeProperties(properties,name,repositoryLocation,schema);
}

Fixed version (ground truth):
@Override public String storeProperties(ComponentProperties properties,String name,String repositoryLocation,String schemaPropertyName){
  return service.storeProperties(properties,name,repositoryLocation,schemaPropertyName);
}
Program: 125975
Project: 125975
Buggy source:
/** 
 * DOC ycbai Comment method "getHadoopPropertiesList". <p> Get the list type of hadoop properties from json string. </p>
 * @param propertiesJsonStr
 * @param includeQuotes
 * @return
 * @throws JSONException
 */
public static List<Map<String,Object>> getHadoopPropertiesList(String propertiesJsonStr,boolean includeQuotes){
  List<Map<String,Object>> properties=new ArrayList<Map<String,Object>>();
  try {
    if (StringUtils.isNotEmpty(propertiesJsonStr)) {
      JSONArray jsonArr=new JSONArray(propertiesJsonStr);
      for (int i=0; i < jsonArr.length(); i++) {
        HashMap<String,Object> map=new HashMap<String,Object>();
        JSONObject object=jsonArr.getJSONObject(i);
        Iterator<String> it=object.keys();
        while (it.hasNext()) {
          String key=it.next();
          String value=String.valueOf(object.get(key));
          if (includeQuotes) {
            value=TalendQuoteUtils.addQuotesIfNotExist(value);
          }
 else {
            value=TalendQuoteUtils.removeQuotesIfExist(value);
          }
          map.put(key,value);
        }
        properties.add(map);
      }
    }
  }
 catch (  JSONException e) {
    ExceptionHandler.process(e);
  }
  return properties;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "getHadoopPropertiesList". <p> Get the list type of hadoop properties from json string. </p>
 * @param propertiesJsonStr
 * @param includeQuotes
 * @return
 * @throws JSONException
 */
public static List<Map<String,Object>> getHadoopPropertiesList(String propertiesJsonStr,boolean isContextMode,boolean includeQuotes){
  List<Map<String,Object>> properties=new ArrayList<Map<String,Object>>();
  try {
    if (StringUtils.isNotEmpty(propertiesJsonStr)) {
      JSONArray jsonArr=new JSONArray(propertiesJsonStr);
      for (int i=0; i < jsonArr.length(); i++) {
        HashMap<String,Object> map=new HashMap<String,Object>();
        JSONObject object=jsonArr.getJSONObject(i);
        Iterator<String> it=object.keys();
        while (it.hasNext()) {
          String key=it.next();
          String value=String.valueOf(object.get(key));
          if (includeQuotes) {
            if (isContextMode && "String_Node_Str".equals(key)) {
              value=TalendQuoteUtils.removeQuotesIfExist(value);
            }
 else {
              value=TalendQuoteUtils.addQuotesIfNotExist(value);
            }
          }
 else {
            value=TalendQuoteUtils.removeQuotesIfExist(value);
          }
          map.put(key,value);
        }
        properties.add(map);
      }
    }
  }
 catch (  JSONException e) {
    ExceptionHandler.process(e);
  }
  return properties;
}
Program: 125976
Project: 125976
Buggy source:
@Override public List<ComponentDefinition> getPossibleComponents(ComponentProperties properties) throws Throwable {
  return service.getPossibleComponents(properties);
}

Fixed version (ground truth):
@Override public List<ComponentDefinition> getPossibleComponents(ComponentProperties... properties) throws Throwable {
  return service.getPossibleComponents(properties);
}
Program: 125977
Project: 125977
Buggy source:
@Override public List<ComponentDefinition> getPossibleComponents(ComponentProperties properties) throws Throwable {
  return service.getPossibleComponents(properties);
}

Fixed version (ground truth):
@Override public List<ComponentDefinition> getPossibleComponents(ComponentProperties... properties) throws Throwable {
  return service.getPossibleComponents(properties);
}
Program: 125978
Project: 125978
Buggy source:
@Override public void postStartup(){
  super.postStartup();
  if (!ArrayUtils.contains(Platform.getApplicationArgs(),EclipseCommandLine.TALEND_DISABLE_LOGINDIALOG_COMMAND)) {
    RegisterManagement.getInstance().validateRegistration();
  }
  CommonsPlugin.setWorkbenchCreated(true);
  Job myJob=new Job("String_Node_Str"){
    @Override protected IStatus run(    IProgressMonitor monitor){
      RepositoryWorkUnit rwu=new RepositoryWorkUnit<Object>("String_Node_Str"){
        @Override protected void run() throws LoginException, PersistenceException {
        }
      }
;
      rwu.setAvoidUnloadResources(true);
      rwu.setUnloadResourcesAfterRun(true);
      rwu.setFilesModifiedOutsideOfRWU(true);
      rwu.setForceTransaction(true);
      ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(rwu);
      return org.eclipse.core.runtime.Status.OK_STATUS;
    }
  }
;
  myJob.schedule();
}

Fixed version (ground truth):
@Override public void postStartup(){
  super.postStartup();
  if (!ArrayUtils.contains(Platform.getApplicationArgs(),EclipseCommandLine.TALEND_DISABLE_LOGINDIALOG_COMMAND)) {
    RegisterManagement.getInstance().validateRegistration();
  }
  CommonsPlugin.setWorkbenchCreated(true);
}
Program: 125981
Project: 125981
Buggy source:
/** 
 * DOC ycbai Comment method "getHadoopPropertiesList". <p> Get the list type of hadoop properties from json string. </p>
 * @param propertiesJsonStr
 * @param includeQuotes
 * @return
 * @throws JSONException
 */
public static List<Map<String,Object>> getHadoopPropertiesList(String propertiesJsonStr,boolean includeQuotes){
  List<Map<String,Object>> properties=new ArrayList<Map<String,Object>>();
  try {
    if (StringUtils.isNotEmpty(propertiesJsonStr)) {
      JSONArray jsonArr=new JSONArray(propertiesJsonStr);
      for (int i=0; i < jsonArr.length(); i++) {
        HashMap<String,Object> map=new HashMap<String,Object>();
        JSONObject object=jsonArr.getJSONObject(i);
        Iterator<String> it=object.keys();
        while (it.hasNext()) {
          String key=it.next();
          String value=String.valueOf(object.get(key));
          if (includeQuotes) {
            value=TalendQuoteUtils.addQuotesIfNotExist(value);
          }
 else {
            value=TalendQuoteUtils.removeQuotesIfExist(value);
          }
          map.put(key,value);
        }
        properties.add(map);
      }
    }
  }
 catch (  JSONException e) {
    ExceptionHandler.process(e);
  }
  return properties;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "getHadoopPropertiesList". <p> Get the list type of hadoop properties from json string. </p>
 * @param propertiesJsonStr
 * @param includeQuotes
 * @return
 * @throws JSONException
 */
public static List<Map<String,Object>> getHadoopPropertiesList(String propertiesJsonStr,boolean isContextMode,boolean includeQuotes){
  List<Map<String,Object>> properties=new ArrayList<Map<String,Object>>();
  try {
    if (StringUtils.isNotEmpty(propertiesJsonStr)) {
      JSONArray jsonArr=new JSONArray(propertiesJsonStr);
      for (int i=0; i < jsonArr.length(); i++) {
        HashMap<String,Object> map=new HashMap<String,Object>();
        JSONObject object=jsonArr.getJSONObject(i);
        Iterator<String> it=object.keys();
        while (it.hasNext()) {
          String key=it.next();
          String value=String.valueOf(object.get(key));
          if (includeQuotes) {
            if (isContextMode && "String_Node_Str".equals(key)) {
              value=TalendQuoteUtils.removeQuotesIfExist(value);
            }
 else {
              value=TalendQuoteUtils.addQuotesIfNotExist(value);
            }
          }
 else {
            value=TalendQuoteUtils.removeQuotesIfExist(value);
          }
          map.put(key,value);
        }
        properties.add(map);
      }
    }
  }
 catch (  JSONException e) {
    ExceptionHandler.process(e);
  }
  return properties;
}
Program: 125982
Project: 125982
Buggy source:
@Override public ComponentProperties commitFormValues(ComponentProperties properties,String formName){
  return service.commitFormValues(properties,formName);
}

Fixed version (ground truth):
@Deprecated public ComponentProperties commitFormValues(ComponentProperties properties,String formName){
  return null;
}
Program: 125983
Project: 125983
Buggy source:
public ELibraryInstallStatus getStatus(){
  final ELibraryInstallStatus eLibraryInstallStatus=ModuleStatusProvider.getStatusMap().get(getMavenUri(true));
  if (eLibraryInstallStatus != null) {
    return eLibraryInstallStatus;
  }
 else {
    ILibraryManagerService libManagerService=(ILibraryManagerService)GlobalServiceRegister.getDefault().getService(ILibraryManagerService.class);
    Set<String> existLibraries=libManagerService.list();
    if (existLibraries.contains(getModuleName())) {
      status=ELibraryInstallStatus.INSTALLED;
    }
 else {
      String localMavenUri=getMavenUriSnapshot().replace("String_Node_Str","String_Node_Str" + MavenConstants.LOCAL_RESOLUTION_URL + "String_Node_Str");
      try {
        getMavenResolver().resolve(localMavenUri);
        status=ELibraryInstallStatus.INSTALLED;
      }
 catch (      IOException e) {
        status=ELibraryInstallStatus.NOT_INSTALLED;
      }
    }
    ModuleStatusProvider.getStatusMap().put(getMavenUri(true),status);
  }
  return this.status;
}

Fixed version (ground truth):
public ELibraryInstallStatus getStatus(){
  final ELibraryInstallStatus eLibraryInstallStatus=ModuleStatusProvider.getStatusMap().get(getMavenUriSnapshot());
  if (eLibraryInstallStatus != null) {
    return eLibraryInstallStatus;
  }
 else {
    ILibraryManagerService libManagerService=(ILibraryManagerService)GlobalServiceRegister.getDefault().getService(ILibraryManagerService.class);
    Set<String> existLibraries=libManagerService.list();
    if (existLibraries.contains(getModuleName())) {
      status=ELibraryInstallStatus.INSTALLED;
    }
 else {
      String localMavenUri=getMavenUriSnapshot().replace("String_Node_Str","String_Node_Str" + MavenConstants.LOCAL_RESOLUTION_URL + "String_Node_Str");
      try {
        getMavenResolver().resolve(localMavenUri);
        status=ELibraryInstallStatus.INSTALLED;
      }
 catch (      IOException e) {
        status=ELibraryInstallStatus.NOT_INSTALLED;
      }
    }
    ModuleStatusProvider.getStatusMap().put(getMavenUriSnapshot(),status);
  }
  return this.status;
}
Program: 125987
Project: 125987
Buggy source:
public static ERepositoryObjectType getType(String typeName){
  for (  ERepositoryObjectType type : (ERepositoryObjectType[])values()) {
    if (type.getType().equals(typeName)) {
      return type;
    }
  }
  return null;
}

Fixed version (ground truth):
public static ERepositoryObjectType getType(Property property){
  String itemId=property.getId();
  ERepositoryObjectType type=typeCacheById.get(itemId);
  if (type == null) {
    Item item=property.getItem();
    type=getItemType(item);
    if (type != null) {
      typeCacheById.put(itemId,type);
    }
  }
  return type;
}
Program: 125989
Project: 125989
Buggy source:
@Override public void perspectiveActivated(IWorkbenchPage page,IPerspectiveDescriptor perspective){
  if (null != cheetSheetInPerspective.get(perspective.getId()) && cheetSheetInPerspective.get(perspective.getId())) {
    restoreCheetSheet();
  }
  if (!PrefUtil.getAPIPreferenceStore().getBoolean(this.getClass().getName()) && perspective.getId().equals(CheatSheetUtils.DQ_PERSPECTIVE_ID)) {
    PrefUtil.getAPIPreferenceStore().setValue(this.getClass().getName(),true);
    restoreCheetSheet();
  }
  super.perspectiveActivated(page,perspective);
}

Fixed version (ground truth):
@Override public void perspectiveActivated(IWorkbenchPage page,IPerspectiveDescriptor perspective){
  if (null != cheetSheetInPerspective.get(perspective.getId()) && cheetSheetInPerspective.get(perspective.getId())) {
    restoreCheetSheet();
  }
  if (CheatSheetUtils.getInstance().isFirstTime() && perspective.getId().equals(CheatSheetUtils.DQ_PERSPECTIVE_ID)) {
    restoreCheetSheet();
  }
  super.perspectiveActivated(page,perspective);
}
Program: 125990
Project: 125990
Buggy source:
/** 
 * DOC talend Comment method "restoreOtherViewAndEditor".
 * @param part
 */
protected void restoreOtherViewAndEditor(IWorkbenchPart part){
  if (part instanceof org.eclipse.ui.internal.cheatsheets.views.CheatSheetView) {
    IWorkbenchPage activePage=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    for (    IViewReference ref : activePage.getViewReferences()) {
      if (part != ref.getView(false)) {
        activePage.setPartState(ref,IWorkbenchPage.STATE_RESTORED);
      }
    }
    for (    IEditorReference ref : activePage.getEditorReferences()) {
      activePage.setPartState(ref,IWorkbenchPage.STATE_RESTORED);
    }
    CheatSheetUtils.getInstance().setMaxCheatSheetHasSHow(false);
    if (partListener2 != null) {
      activePage.removePartListener(partListener2);
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC talend Comment method "restoreOtherViewAndEditor".
 * @param part
 */
protected void restoreOtherViewAndEditor(IWorkbenchPart part){
  if (part instanceof org.eclipse.ui.internal.cheatsheets.views.CheatSheetView) {
    IWorkbenchPage activePage=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    if (activePage == null) {
      return;
    }
    for (    IViewReference ref : activePage.getViewReferences()) {
      if (part != ref.getView(false)) {
        activePage.setPartState(ref,IWorkbenchPage.STATE_RESTORED);
      }
    }
    for (    IEditorReference ref : activePage.getEditorReferences()) {
      activePage.setPartState(ref,IWorkbenchPage.STATE_RESTORED);
    }
    CheatSheetUtils.getInstance().setMaxCheatSheetHasSHow(false);
    if (partListener2 != null) {
      activePage.removePartListener(partListener2);
    }
  }
}
Program: 125991
Project: 125991
Buggy source:
public void initNewWorkspaceTasks(){
  List<IWorkspaceMigrationTask> toExecute=GetTasksHelper.getWorkspaceTasks();
  for (  IWorkspaceMigrationTask task : toExecute) {
    coreService.addWorkspaceTaskDone(task.getId());
  }
}

Fixed version (ground truth):
public void initNewWorkspaceTasks(){
  final ICoreService coreService=getCoreService();
  if (coreService == null) {
    return;
  }
  List<IWorkspaceMigrationTask> toExecute=GetTasksHelper.getWorkspaceTasks();
  for (  IWorkspaceMigrationTask task : toExecute) {
    coreService.addWorkspaceTaskDone(task.getId());
  }
}
Program: 125992
Project: 125992
Buggy source:
@Override public void executeWorspaceTasks(){
  log.trace("String_Node_Str");
  List<IWorkspaceMigrationTask> toExecute=GetTasksHelper.getWorkspaceTasks();
  List<String> done=coreService.readWorkspaceTasksDone();
  String lastUser=coreService.getLastUser();
  if (lastUser == null || lastUser.length() == 0) {
    if (done.isEmpty()) {
      initNewWorkspaceTasks();
      done=coreService.readWorkspaceTasksDone();
    }
  }
  Collections.sort(toExecute,new Comparator<IWorkspaceMigrationTask>(){
    @Override public int compare(    IWorkspaceMigrationTask o1,    IWorkspaceMigrationTask o2){
      return o1.getOrder().compareTo(o2.getOrder());
    }
  }
);
  for (  IWorkspaceMigrationTask task : toExecute) {
    if (!done.contains(task.getId())) {
      if (task.execute()) {
        coreService.addWorkspaceTaskDone(task.getId());
        log.debug("String_Node_Str" + task.getName() + "String_Node_Str");
      }
 else {
        log.debug("String_Node_Str" + task.getName() + "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
@Override public void executeWorspaceTasks(){
  log.trace("String_Node_Str");
  List<IWorkspaceMigrationTask> toExecute=GetTasksHelper.getWorkspaceTasks();
  final ICoreService coreService=getCoreService();
  if (coreService == null) {
    return;
  }
  List<String> done=coreService.readWorkspaceTasksDone();
  String lastUser=coreService.getLastUser();
  if (lastUser == null || lastUser.length() == 0) {
    if (done.isEmpty()) {
      initNewWorkspaceTasks();
      done=coreService.readWorkspaceTasksDone();
    }
  }
  Collections.sort(toExecute,new Comparator<IWorkspaceMigrationTask>(){
    @Override public int compare(    IWorkspaceMigrationTask o1,    IWorkspaceMigrationTask o2){
      return o1.getOrder().compareTo(o2.getOrder());
    }
  }
);
  for (  IWorkspaceMigrationTask task : toExecute) {
    if (!done.contains(task.getId())) {
      if (task.execute()) {
        coreService.addWorkspaceTaskDone(task.getId());
        log.debug("String_Node_Str" + task.getName() + "String_Node_Str");
      }
 else {
        log.debug("String_Node_Str" + task.getName() + "String_Node_Str");
      }
    }
  }
}
Program: 125993
Project: 125993
Buggy source:
@Test public void testCurrentProject3() throws PersistenceException {
  Project currentProject=ProjectManager.getInstance().getCurrentProject();
  IProject project=ResourceUtils.getProject(currentProject);
  testExist(new ProjectPreferenceManager(project,getTestQualifier(currentProject.getTechnicalLabel())));
}

Fixed version (ground truth):
@Test public void testCurrentProject3() throws PersistenceException {
  Project currentProject=ProjectManager.getInstance().getCurrentProject();
  IProject project=ResourceUtils.getProject(currentProject);
  testExist(new ProjectPreferenceManager(project,'C' + getTestQualifier(currentProject.getTechnicalLabel())));
}
Program: 125994
Project: 125994
Buggy source:
@Test public void testCurrentProject(){
  Project currentProject=ProjectManager.getInstance().getCurrentProject();
  testExist(new ProjectPreferenceManager(getTestQualifier(currentProject.getTechnicalLabel())));
}

Fixed version (ground truth):
@Test public void testCurrentProject(){
  Project currentProject=ProjectManager.getInstance().getCurrentProject();
  testExist(new ProjectPreferenceManager('A' + getTestQualifier(currentProject.getTechnicalLabel())));
}
Program: 125995
Project: 125995
Buggy source:
@Test public void testCurrentProject2(){
  Project currentProject=ProjectManager.getInstance().getCurrentProject();
  testExist(new ProjectPreferenceManager(currentProject,getTestQualifier(currentProject.getTechnicalLabel())));
}

Fixed version (ground truth):
@Test public void testCurrentProject2(){
  Project currentProject=ProjectManager.getInstance().getCurrentProject();
  testExist(new ProjectPreferenceManager(currentProject,'B' + getTestQualifier(currentProject.getTechnicalLabel())));
}
Program: 125996
Project: 125996
Buggy source:
@Override public void done(IJobChangeEvent jobEvent){
  MultiStatus results=(MultiStatus)jobEvent.getResult();
  IStatus[] installStatus=results.getChildren();
  boolean hasAnyFailure=false;
  boolean hasAnySuccess=false;
  boolean hasCancel=false;
  for (  IStatus status : installStatus) {
    if (!status.isOK()) {
      if (status.getSeverity() == IStatus.CANCEL) {
        hasCancel=true;
      }
 else {
        hasAnyFailure=true;
      }
    }
 else {
      hasAnySuccess=true;
    }
  }
  if (hasCancel) {
    return;
  }
  String firstPartOfMessage=Messages.getString("String_Node_Str");
  if (hasAnySuccess) {
    if (hasAnyFailure) {
      firstPartOfMessage=Messages.getString("String_Node_Str");
    }
    final String finalMessage=firstPartOfMessage + Messages.getString("String_Node_Str");
    Display.getDefault().syncExec(new Runnable(){
      @Override public void run(){
        boolean isOkToRestart=MessageDialog.openQuestion(getShell(),Messages.getString("String_Node_Str"),finalMessage);
        if (isOkToRestart) {
          PlatformUI.getWorkbench().restart();
        }
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void done(IJobChangeEvent jobEvent){
  MultiStatus results=(MultiStatus)jobEvent.getResult();
  IStatus[] installStatus=results.getChildren();
  boolean hasAnyFailure=false;
  boolean hasAnySuccess=false;
  boolean hasCancel=false;
  for (  IStatus status : installStatus) {
    if (!status.isOK()) {
      if (status.getSeverity() == IStatus.CANCEL) {
        hasCancel=true;
      }
 else {
        hasAnyFailure=true;
      }
    }
 else {
      hasAnySuccess=true;
    }
  }
  if (hasCancel) {
    return;
  }
  String firstPartOfMessage=Messages.getString("String_Node_Str");
  if (hasAnySuccess) {
    if (hasAnyFailure) {
      firstPartOfMessage=Messages.getString("String_Node_Str");
    }
    final String finalMessage=firstPartOfMessage + Messages.getString("String_Node_Str");
    Display.getDefault().syncExec(new Runnable(){
      @Override public void run(){
        IPreferenceStore store=PlatformUI.getPreferenceStore();
        store.putValue("String_Node_Str","String_Node_Str");
        boolean isOkToRestart=MessageDialog.openQuestion(getShell(),Messages.getString("String_Node_Str"),finalMessage);
        if (isOkToRestart) {
          PlatformUI.getWorkbench().restart();
        }
      }
    }
);
  }
}
Program: 125998
Project: 125998
Buggy source:
public static boolean isJavaProject(){
  RepositoryContext repositoryContext=(RepositoryContext)CoreRuntimePlugin.getInstance().getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
  ECodeLanguage codeLanguage=repositoryContext.getProject().getLanguage();
  return (codeLanguage == ECodeLanguage.JAVA);
}

Fixed version (ground truth):
public static boolean isJavaProject(){
  return true;
}
Program: 126001
Project: 126001
Buggy source:
@Override public boolean isDeleted(){
  return getProperty().getItem().getState().isDeleted();
}

Fixed version (ground truth):
@Override public boolean isDeleted(){
  if (getProperty().getItem() == null) {
    return false;
  }
  return getProperty().getItem().getState().isDeleted();
}
Program: 126003
Project: 126003
Buggy source:
@Override public void run(){
  ExternalModulesInstallDialogWithProgress dialog=new ExternalModulesInstallDialogWithProgress(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),SWT.APPLICATION_MODAL);
  dialog.showDialog(true,requiredJars.toArray(new String[requiredJars.size()]));
}

Fixed version (ground truth):
@Override public void run(){
  ExternalModulesInstallDialogWithProgress dialog=new ExternalModulesInstallDialogWithProgress(DisplayUtils.getDefaultShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),SWT.APPLICATION_MODAL);
  dialog.showDialog(true,requiredJars.toArray(new String[requiredJars.size()]));
}
Program: 126004
Project: 126004
Buggy source:
protected MPerspectiveStack getMPerspectiveStack(){
  if (fPerspectiveStack != null) {
    return fPerspectiveStack;
  }
  if (fWindow != null) {
    if (fPerspectiveStack == null) {
      List<MPerspectiveStack> perspStackList=fModelService.findElements(fWindow,null,MPerspectiveStack.class,null);
      if (perspStackList.size() > 0) {
        fPerspectiveStack=perspStackList.get(0);
        return fPerspectiveStack;
      }
    }
    for (    MWindowElement child : fWindow.getChildren()) {
      if (child instanceof MPerspectiveStack) {
        fPerspectiveStack=(MPerspectiveStack)child;
        return fPerspectiveStack;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
protected MPerspectiveStack getMPerspectiveStack(){
  if (fPerspectiveStack != null) {
    return fPerspectiveStack;
  }
  MUIElement baseElement=fWindow;
  if (fWindow == null) {
    baseElement=fApp;
  }
  if (baseElement != null) {
    if (fPerspectiveStack == null) {
      List<MPerspectiveStack> perspStackList=fModelService.findElements(baseElement,null,MPerspectiveStack.class,null);
      if (perspStackList.size() > 0) {
        fPerspectiveStack=perspStackList.get(0);
        return fPerspectiveStack;
      }
    }
    if (fWindow != null) {
      for (      MWindowElement child : fWindow.getChildren()) {
        if (child instanceof MPerspectiveStack) {
          fPerspectiveStack=(MPerspectiveStack)child;
          return fPerspectiveStack;
        }
      }
    }
  }
  return null;
}
Program: 126006
Project: 126006
Buggy source:
/** 
 * DOC ldong Comment method "getCurrentBranchLabel".
 * @param project
 * @return
 */
public static String getCurrentBranchLabel(Project project){
  String branchSelection=NAME_TRUNK;
  String branchSelectionFromProject=ProjectManager.getInstance().getMainProjectBranch(project);
  if (branchSelectionFromProject != null) {
    branchSelection=branchSelectionFromProject;
  }
  if (!branchSelection.contains(NAME_TAGS) && !branchSelection.contains(NAME_BRANCHES) && !branchSelection.contains(NAME_TRUNK)) {
    branchSelection=NAME_BRANCHES + branchSelection;
  }
  return branchSelection;
}

Fixed version (ground truth):
/** 
 * DOC ldong Comment method "getCurrentBranchLabel".
 * @param project
 * @return
 */
public static String getCurrentBranchLabel(Project project){
  String branchSelection=NAME_TRUNK;
  String branchSelectionFromProject=ProjectManager.getInstance().getMainProjectBranch(project);
  if (branchSelectionFromProject != null) {
    branchSelection=branchSelectionFromProject;
  }
  if (!branchSelection.contains(NAME_TAGS) && !branchSelection.contains(NAME_BRANCHES) && !branchSelection.contains(NAME_TRUNK)&& !branchSelection.contains("String_Node_Str")) {
    branchSelection=NAME_BRANCHES + branchSelection;
  }
  return branchSelection;
}
Program: 126007
Project: 126007
Buggy source:
public static boolean isSchemaFromSidOrDatabase(EDatabaseTypeName inType){
  if (EDatabaseTypeName.TERADATA.equals(inType) || EDatabaseTypeName.IMPALA.equals(inType) || EDatabaseTypeName.AS400.equals(inType)|| EDatabaseTypeName.EXASOL.equals(inType)) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public static boolean isSchemaFromSidOrDatabase(EDatabaseTypeName inType){
  if (EDatabaseTypeName.TERADATA.equals(inType) || EDatabaseTypeName.IMPALA.equals(inType) || EDatabaseTypeName.AS400.equals(inType)|| EDatabaseTypeName.EXASOL.equals(inType)|| EDatabaseTypeName.HIVE.equals(inType)) {
    return true;
  }
 else {
    return false;
  }
}
Program: 126011
Project: 126011
Buggy source:
/** 
 * This method is invoked when an item of Hive mode is selected. If the selected is Embedded, it invokes  {@link #handleEmbeddedMode()},   {@link #handleStandaloneMode()} otherwise. Then it invokes the method{@link #doUpdateConnection()} to update connection. Added by Marvin Wang on Aug. 3, 2012.
 */
protected void doHiveModeModify(){
  int distributionIndex=distributionCombo.getSelectionIndex();
  int hiveVersionIndex=hiveVersionCombo.getSelectionIndex();
  int hiveModeIndex=hiveModeCombo.getSelectionIndex();
  int hiveServerIndex=getRealHiveServerIndex(distributionIndex,hiveVersionIndex,hiveServerVersionCombo.getSelectionIndex());
  boolean isEmbeddedMode=HiveConnUtils.isEmbeddedMode(distributionIndex,hiveVersionIndex,hiveModeIndex,hiveServerIndex);
  getConnection().setURL(getStringConnection());
  if (isEmbeddedMode) {
    handleUIWhenEmbeddedModeSelected();
  }
 else {
    handleUIWhenStandaloneModeSelected();
  }
  fillDefaultsWhenHiveModeChanged(isEmbeddedMode);
  doUpdateConnection();
}

Fixed version (ground truth):
/** 
 * This method is invoked when an item of Hive mode is selected. If the selected is Embedded, it invokes  {@link #handleEmbeddedMode()},   {@link #handleStandaloneMode()} otherwise. Then it invokes the method{@link #doUpdateConnection()} to update connection. Added by Marvin Wang on Aug. 3, 2012.
 */
protected void doHiveModeModify(){
  boolean isEmbeddedMode=isEmbeddedMode();
  getConnection().setURL(getStringConnection());
  if (isEmbeddedMode) {
    urlConnectionStringText.setText(DbConnStrForHive.URL_HIVE_2_TEMPLATE);
    handleUIWhenEmbeddedModeSelected();
  }
 else {
    handleUIWhenStandaloneModeSelected();
  }
  fillDefaultsWhenHiveModeChanged(isEmbeddedMode);
  doUpdateConnection();
}
Program: 126012
Project: 126012
Buggy source:
@Override public ResultSet getTables(String catalog,String schemaPattern,String tableNamePattern,String[] types) throws SQLException {
  ResultSet tables=super.getTables(catalog,schemaPattern,tableNamePattern,types);
  List<String[]> list=getTableList(tables);
  if (list.isEmpty()) {
    String sql="String_Node_Str";
    ResultSet rs=null;
    PreparedStatement stmt=null;
    try {
      stmt=connection.prepareStatement(sql);
      if (!StringUtils.isEmpty(tableNamePattern)) {
        stmt.setString(1,tableNamePattern);
      }
      rs=stmt.executeQuery();
      list=getTableList(rs);
    }
 catch (    SQLException e) {
      throw new RuntimeException(e);
    }
 finally {
      try {
        rs.close();
        stmt.close();
      }
 catch (      Exception e) {
      }
    }
  }
  EXASOLResultSet tableResultSet=new EXASOLResultSet();
  tableResultSet.setMetadata(TABLE_META);
  tableResultSet.setData(list);
  return tableResultSet;
}

Fixed version (ground truth):
@Override public ResultSet getTables(String catalog,String schemaPattern,String tableNamePattern,String[] types) throws SQLException {
  ResultSet tables=super.getTables(null,schemaPattern,tableNamePattern,types);
  List<String[]> list=getTableList(tables);
  if (list.isEmpty()) {
    StringBuilder sql=new StringBuilder();
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    sql.append("String_Node_Str");
    ResultSet rs=null;
    PreparedStatement stmt=null;
    try {
      stmt=connection.prepareStatement(sql.toString());
      if (!StringUtils.isEmpty(tableNamePattern)) {
        stmt.setString(1,tableNamePattern);
      }
      rs=stmt.executeQuery();
      list=getTableList(rs);
    }
  finally {
      try {
        if (rs != null) {
          rs.close();
        }
        if (stmt != null) {
          stmt.close();
        }
      }
 catch (      Exception e) {
      }
    }
  }
  EXASOLResultSet tableResultSet=new EXASOLResultSet();
  tableResultSet.setMetadata(TABLE_META);
  tableResultSet.setData(list);
  return tableResultSet;
}
Program: 126013
Project: 126013
Buggy source:
private String getStringFromResultSet(ResultSet resultSet,String nameOfString){
  String valueOfString=null;
  try {
    valueOfString=resultSet.getString(nameOfString);
  }
 catch (  SQLException e) {
    log.warn(e,e);
  }
  return valueOfString;
}

Fixed version (ground truth):
private String getStringFromResultSet(ResultSet resultSet,String nameOfString){
  String valueOfString=null;
  try {
    valueOfString=resultSet.getString(nameOfString);
  }
 catch (  SQLException e) {
    logger.warn(e.getMessage(),e);
  }
  return valueOfString;
}
Program: 126016
Project: 126016
Buggy source:
/** 
 * This method is invoked when an item of Hive mode is selected. If the selected is Embedded, it invokes  {@link #handleEmbeddedMode()},   {@link #handleStandaloneMode()} otherwise. Then it invokes the method{@link #doUpdateConnection()} to update connection. Added by Marvin Wang on Aug. 3, 2012.
 */
protected void doHiveModeModify(){
  int distributionIndex=distributionCombo.getSelectionIndex();
  int hiveVersionIndex=hiveVersionCombo.getSelectionIndex();
  int hiveModeIndex=hiveModeCombo.getSelectionIndex();
  int hiveServerIndex=getRealHiveServerIndex(distributionIndex,hiveVersionIndex,hiveServerVersionCombo.getSelectionIndex());
  boolean isEmbeddedMode=HiveConnUtils.isEmbeddedMode(distributionIndex,hiveVersionIndex,hiveModeIndex,hiveServerIndex);
  getConnection().setURL(getStringConnection());
  if (isEmbeddedMode) {
    handleUIWhenEmbeddedModeSelected();
  }
 else {
    handleUIWhenStandaloneModeSelected();
  }
  fillDefaultsWhenHiveModeChanged(isEmbeddedMode);
  doUpdateConnection();
}

Fixed version (ground truth):
/** 
 * This method is invoked when an item of Hive mode is selected. If the selected is Embedded, it invokes  {@link #handleEmbeddedMode()},   {@link #handleStandaloneMode()} otherwise. Then it invokes the method{@link #doUpdateConnection()} to update connection. Added by Marvin Wang on Aug. 3, 2012.
 */
protected void doHiveModeModify(){
  boolean isEmbeddedMode=isEmbeddedMode();
  getConnection().setURL(getStringConnection());
  if (isEmbeddedMode) {
    urlConnectionStringText.setText(DbConnStrForHive.URL_HIVE_2_TEMPLATE);
    handleUIWhenEmbeddedModeSelected();
  }
 else {
    handleUIWhenStandaloneModeSelected();
  }
  fillDefaultsWhenHiveModeChanged(isEmbeddedMode);
  doUpdateConnection();
}
Program: 126017
Project: 126017
Buggy source:
public static MetadataTable getMetadataTableFromRepository(String metaRepositoryId){
  org.talend.core.model.metadata.builder.connection.Connection connection;
  String[] names=metaRepositoryId.split("String_Node_Str");
  if (names.length < 2) {
    return null;
  }
  String linkedRepository=names[0];
  String tableName=null;
  if (names.length == 2) {
    tableName=names[1];
  }
 else   if (names.length > 2) {
    tableName=metaRepositoryId.substring(linkedRepository.length() + 3);
  }
  connection=getConnectionFromRepository(linkedRepository);
  if (connection != null) {
    if (connection instanceof SAPConnection) {
      if (tableName == null) {
        return null;
      }
      if (tableName.contains("String_Node_Str")) {
        return getMetadataTableFromSAPFunction((SAPConnection)connection,metaRepositoryId);
      }
    }
    Set tables=ConnectionHelper.getTables(connection);
    for (    Object tableObj : tables) {
      MetadataTable table=(MetadataTable)tableObj;
      if (table.getLabel().equals(tableName)) {
        return table;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public static MetadataTable getMetadataTableFromRepository(String metaRepositoryId){
  org.talend.core.model.metadata.builder.connection.Connection connection;
  String[] names=metaRepositoryId.split("String_Node_Str");
  if (names.length < 2) {
    return null;
  }
  String linkedRepository=names[0];
  String tableName=null;
  if (names.length == 2) {
    tableName=names[1];
  }
 else   if (names.length > 2) {
    tableName=metaRepositoryId.substring(linkedRepository.length() + 3);
  }
  connection=getConnectionFromRepository(linkedRepository);
  if (connection != null) {
    if (connection instanceof SAPConnection) {
      if (tableName == null) {
        return null;
      }
      if (tableName.contains("String_Node_Str")) {
        return getMetadataTableFromSAPFunction((SAPConnection)connection,metaRepositoryId);
      }
    }
    Set tables=ConnectionHelper.getTables(connection);
    IGenericWizardService wizardService=null;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
      wizardService=(IGenericWizardService)GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
    }
    if (wizardService != null) {
      List<MetadataTable> metadataTables=wizardService.getMetadataTables(connection);
      tables=new HashSet<>(metadataTables);
    }
    for (    Object tableObj : tables) {
      MetadataTable table=(MetadataTable)tableObj;
      if (table.getLabel().equals(tableName)) {
        return table;
      }
    }
  }
  return null;
}
Program: 126019
Project: 126019
Buggy source:
private URI getReferenceFileURI(URI itemResourceURI,ReferenceFileItem refFile){
  if (refFile.getName() != null) {
    ByteArray contentByteArray=refFile.getContent();
    URI referenceFileURI=null;
    if (contentByteArray != null) {
      Resource eResource=contentByteArray.eResource();
      if (eResource != null) {
        referenceFileURI=eResource.getURI();
      }
    }
    if (referenceFileURI != null) {
      String fileName=referenceFileURI.segment(referenceFileURI.segmentCount() - 1);
      if (fileName != null && fileName.startsWith(refFile.getName())) {
        return itemResourceURI.trimSegments(1).appendSegment(fileName);
      }
 else {
        CommonExceptionHandler.process(new Exception("String_Node_Str" + refFile.getName() + "String_Node_Str"+ fileName+ "String_Node_Str"),Priority.INFO);
      }
    }
    return itemResourceURI.trimSegments(1).appendSegment(refFile.getName() + "String_Node_Str" + refFile.getExtension());
  }
 else {
    return itemResourceURI.trimFileExtension().appendFileExtension(refFile.getExtension());
  }
}

Fixed version (ground truth):
private URI getReferenceFileURI(URI itemResourceURI,ReferenceFileItem refFile){
  if (refFile.getName() != null) {
    return itemResourceURI.trimSegments(1).appendSegment(refFile.getName() + "String_Node_Str" + refFile.getExtension());
  }
 else {
    return itemResourceURI.trimFileExtension().appendFileExtension(refFile.getExtension());
  }
}