nus-yam/ex-repair huggingface dataset:
Program: 91832
Project: 91832
Buggy source:
@Override protected IStatus run(final IProgressMonitor monitor){
  try {
    monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
    broadcast(new TmfStartAnalysisSignal(TmfAbstractAnalysisModule.this,TmfAbstractAnalysisModule.this));
    fAnalysisCancelled=!executeAnalysis(monitor);
  }
 catch (  TmfAnalysisException e) {
    Activator.logError("String_Node_Str" + getTrace().getName(),e);
  }
 finally {
synchronized (syncObj) {
      monitor.done();
      setAnalysisCompleted();
    }
    TmfTraceManager.refreshSupplementaryFiles(trace);
  }
  if (!fAnalysisCancelled) {
    return Status.OK_STATUS;
  }
  resetAnalysis();
  return Status.CANCEL_STATUS;
}

Fixed version (ground truth):
@Override protected IStatus run(final IProgressMonitor monitor){
  try {
    monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
    broadcast(new TmfStartAnalysisSignal(TmfAbstractAnalysisModule.this,TmfAbstractAnalysisModule.this));
    fAnalysisCancelled=!executeAnalysis(monitor);
  }
 catch (  TmfAnalysisException e) {
    Activator.logError("String_Node_Str" + trace.getName(),e);
  }
 finally {
synchronized (syncObj) {
      monitor.done();
      setAnalysisCompleted();
    }
    TmfTraceManager.refreshSupplementaryFiles(trace);
  }
  if (!fAnalysisCancelled) {
    return Status.OK_STATUS;
  }
  resetAnalysis();
  return Status.CANCEL_STATUS;
}
Program: 91833
Project: 91833
Buggy source:
private void execute(@NonNull final ITmfTrace trace){
  if (fFinishedLatch.getCount() == 0) {
    return;
  }
synchronized (syncObj) {
    if (fStarted) {
      return;
    }
    fStarted=true;
  }
  fJob=new Job(NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis,getName())){
    @Override protected IStatus run(    final IProgressMonitor monitor){
      try {
        monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
        broadcast(new TmfStartAnalysisSignal(TmfAbstractAnalysisModule.this,TmfAbstractAnalysisModule.this));
        fAnalysisCancelled=!executeAnalysis(monitor);
      }
 catch (      TmfAnalysisException e) {
        Activator.logError("String_Node_Str" + getTrace().getName(),e);
      }
 finally {
synchronized (syncObj) {
          monitor.done();
          setAnalysisCompleted();
        }
        TmfTraceManager.refreshSupplementaryFiles(trace);
      }
      if (!fAnalysisCancelled) {
        return Status.OK_STATUS;
      }
      resetAnalysis();
      return Status.CANCEL_STATUS;
    }
    @Override protected void canceling(){
      TmfAbstractAnalysisModule.this.canceling();
    }
  }
;
  fJob.schedule();
}

Fixed version (ground truth):
private void execute(@NonNull final ITmfTrace trace){
  if (fFinishedLatch.getCount() == 0) {
    return;
  }
synchronized (syncObj) {
    if (fStarted) {
      return;
    }
    fStarted=true;
  }
  fJob=new Job(NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis,getName())){
    @Override protected IStatus run(    final IProgressMonitor monitor){
      try {
        monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
        broadcast(new TmfStartAnalysisSignal(TmfAbstractAnalysisModule.this,TmfAbstractAnalysisModule.this));
        fAnalysisCancelled=!executeAnalysis(monitor);
      }
 catch (      TmfAnalysisException e) {
        Activator.logError("String_Node_Str" + trace.getName(),e);
      }
 finally {
synchronized (syncObj) {
          monitor.done();
          setAnalysisCompleted();
        }
        TmfTraceManager.refreshSupplementaryFiles(trace);
      }
      if (!fAnalysisCancelled) {
        return Status.OK_STATUS;
      }
      resetAnalysis();
      return Status.CANCEL_STATUS;
    }
    @Override protected void canceling(){
      TmfAbstractAnalysisModule.this.canceling();
    }
  }
;
  fJob.schedule();
}
Program: 91834
Project: 91834
Buggy source:
@Override public IStatus schedule(){
  final ITmfTrace trace=fTrace;
  if (trace == null) {
    return new Status(IStatus.ERROR,Activator.PLUGIN_ID,String.format("String_Node_Str",getName()));
  }
  execute(trace);
  return Status.OK_STATUS;
}

Fixed version (ground truth):
@Override public IStatus schedule(){
synchronized (syncObj) {
    final ITmfTrace trace=getTrace();
    if (trace == null) {
      return new Status(IStatus.ERROR,Activator.PLUGIN_ID,String.format("String_Node_Str",getName()));
    }
    execute(trace);
  }
  return Status.OK_STATUS;
}
Program: 91835
Project: 91835
Buggy source:
/** 
 * Signal handler for trace closing
 * @param signal Trace closed signal
 */
@TmfSignalHandler public void traceClosed(TmfTraceClosedSignal signal){
  if (signal.getTrace() == fTrace) {
    cancel();
    fTrace=null;
  }
}

Fixed version (ground truth):
/** 
 * Signal handler for trace closing
 * @param signal Trace closed signal
 */
@TmfSignalHandler public void traceClosed(TmfTraceClosedSignal signal){
synchronized (syncObj) {
    if (signal.getTrace() == fTrace) {
      cancel();
      fTrace=null;
    }
  }
}
Program: 91836
Project: 91836
Buggy source:
@Override protected boolean executeAnalysis(@Nullable final IProgressMonitor monitor){
  IProgressMonitor mon=(monitor == null ? new NullProgressMonitor() : monitor);
  final ITmfStateProvider provider=createStateProvider();
  String id=getId();
  try {
    StateSystemBackendType backend=getBackendType();
    String directory;
    File htFile;
switch (backend) {
case FULL:
      directory=TmfTraceManager.getSupplementaryFileDir(getTrace());
    htFile=new File(directory + getSsFileName());
  createFullHistory(id,provider,htFile);
break;
case PARTIAL:
directory=TmfTraceManager.getSupplementaryFileDir(getTrace());
htFile=new File(directory + getSsFileName());
createPartialHistory(id,provider,htFile);
break;
case INMEM:
createInMemoryHistory(id,provider);
break;
case NULL:
createNullHistory(id,provider);
break;
default :
break;
}
}
 catch (TmfTraceException e) {
return false;
}
return !mon.isCanceled();
}

Fixed version (ground truth):
@Override protected boolean executeAnalysis(@Nullable final IProgressMonitor monitor){
  IProgressMonitor mon=(monitor == null ? new NullProgressMonitor() : monitor);
  final ITmfStateProvider provider=createStateProvider();
  String id=getId();
  try {
    StateSystemBackendType backend=getBackendType();
    String directory;
    File htFile;
    ITmfTrace trace=getTrace();
    if (trace == null) {
      fInitialized.countDown();
      return false;
    }
switch (backend) {
case FULL:
      directory=TmfTraceManager.getSupplementaryFileDir(trace);
    htFile=new File(directory + getSsFileName());
  createFullHistory(id,provider,htFile);
break;
case PARTIAL:
directory=TmfTraceManager.getSupplementaryFileDir(trace);
htFile=new File(directory + getSsFileName());
createPartialHistory(id,provider,htFile);
break;
case INMEM:
createInMemoryHistory(id,provider);
break;
case NULL:
createNullHistory(id,provider);
break;
default :
break;
}
}
 catch (TmfTraceException e) {
fInitialized.countDown();
return false;
}
return !mon.isCanceled();
}
Program: 91837
Project: 91837
Buggy source:
@Override protected boolean executeAnalysis(IProgressMonitor monitor) throws TmfAnalysisException {
  ITmfTrace trace=getTrace();
  if (trace == null) {
    throw new IllegalStateException();
  }
  IStatus status1=totalsModule.schedule();
  IStatus status2=eventTypesModule.schedule();
  if (!(status1.isOK() && status2.isOK())) {
    cancelSubAnalyses();
    return false;
  }
  totalsModule.waitForInitialization();
  eventTypesModule.waitForInitialization();
  ITmfStateSystem totalsSS=totalsModule.getStateSystem();
  ITmfStateSystem eventTypesSS=eventTypesModule.getStateSystem();
  if (totalsSS == null || eventTypesSS == null) {
    throw new IllegalStateException();
  }
  fStatistics=new TmfStateStatistics(totalsSS,eventTypesSS);
  fInitialized.countDown();
  if (!(totalsModule.waitForCompletion(monitor) && eventTypesModule.waitForCompletion(monitor))) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override protected boolean executeAnalysis(IProgressMonitor monitor) throws TmfAnalysisException {
  ITmfTrace trace=getTrace();
  if (trace == null) {
    fInitialized.countDown();
    return false;
  }
  IStatus status1=totalsModule.schedule();
  IStatus status2=eventTypesModule.schedule();
  if (!(status1.isOK() && status2.isOK())) {
    cancelSubAnalyses();
    fInitialized.countDown();
    return false;
  }
  totalsModule.waitForInitialization();
  eventTypesModule.waitForInitialization();
  ITmfStateSystem totalsSS=totalsModule.getStateSystem();
  ITmfStateSystem eventTypesSS=eventTypesModule.getStateSystem();
  if (totalsSS == null || eventTypesSS == null) {
    fInitialized.countDown();
    return false;
  }
  fStatistics=new TmfStateStatistics(totalsSS,eventTypesSS);
  fInitialized.countDown();
  if (!(totalsModule.waitForCompletion(monitor) && eventTypesModule.waitForCompletion(monitor))) {
    return false;
  }
  return true;
}
Program: 91838
Project: 91838
Buggy source:
@Override protected boolean executeAnalysis(@Nullable IProgressMonitor monitor) throws TmfAnalysisException {
  IProgressMonitor mon=(monitor == null ? new NullProgressMonitor() : monitor);
  if (getTrace() == null) {
    return false;
  }
  ITmfEventRequest request=fRequest;
  if ((request != null) && (!request.isCompleted())) {
    request.cancel();
  }
  request=new TmfEventRequest(PcapEvent.class,TmfTimeRange.ETERNITY,0L,ITmfEventRequest.ALL_DATA,ITmfEventRequest.ExecutionType.BACKGROUND){
    @Override public void handleData(    ITmfEvent data){
      super.handleData(data);
      if (!(data instanceof PcapEvent)) {
        return;
      }
      PcapEvent event=(PcapEvent)data;
      for (      TmfPcapProtocol protocol : fBuilders.keySet()) {
        fBuilders.get(protocol).addEventToStream(event);
      }
    }
  }
;
  getTrace().sendRequest(request);
  fRequest=request;
  try {
    request.waitForCompletion();
  }
 catch (  InterruptedException e) {
    return false;
  }
  return !mon.isCanceled() && !request.isCancelled() && !request.isFailed();
}

Fixed version (ground truth):
@Override protected boolean executeAnalysis(@Nullable IProgressMonitor monitor) throws TmfAnalysisException {
  IProgressMonitor mon=(monitor == null ? new NullProgressMonitor() : monitor);
  ITmfTrace trace=getTrace();
  if (trace == null) {
    return false;
  }
  ITmfEventRequest request=fRequest;
  if ((request != null) && (!request.isCompleted())) {
    request.cancel();
  }
  request=new TmfEventRequest(PcapEvent.class,TmfTimeRange.ETERNITY,0L,ITmfEventRequest.ALL_DATA,ITmfEventRequest.ExecutionType.BACKGROUND){
    @Override public void handleData(    ITmfEvent data){
      super.handleData(data);
      if (!(data instanceof PcapEvent)) {
        return;
      }
      PcapEvent event=(PcapEvent)data;
      for (      TmfPcapProtocol protocol : fBuilders.keySet()) {
        fBuilders.get(protocol).addEventToStream(event);
      }
    }
  }
;
  trace.sendRequest(request);
  fRequest=request;
  try {
    request.waitForCompletion();
  }
 catch (  InterruptedException e) {
    return false;
  }
  return !mon.isCanceled() && !request.isCancelled() && !request.isFailed();
}
Program: 91839
Project: 91839
Buggy source:
@Override public void stop(BundleContext context) throws Exception {
  plugin=null;
  super.stop(context);
}

Fixed version (ground truth):
@Override public void stop(BundleContext context) throws Exception {
  stateLocation=this.getStateLocation();
  preferenceStore=this.getPreferenceStore();
  plugin=null;
  super.stop(context);
}
Program: 91840
Project: 91840
Buggy source:
private void save(){
  LibHover.saveLibraries();
}

Fixed version (ground truth):
private void save(){
  if (stateLocation == null)   stateLocation=this.getStateLocation();
  if (preferenceStore == null)   preferenceStore=this.getPreferenceStore();
  LibHover.saveLibraries(stateLocation,preferenceStore);
}
Program: 91841
Project: 91841
Buggy source:
public static void saveLibraries(){
  IPreferenceStore ps=LibhoverPlugin.getDefault().getPreferenceStore();
  if (ps.getBoolean(PreferenceConstants.CACHE_EXT_LIBHOVER)) {
    IPath locationBase=LibhoverPlugin.getDefault().getStateLocation();
    for (Iterator<LibHoverLibrary> i=libraries.values().iterator(); i.hasNext(); ) {
      LibHoverLibrary l=i.next();
      try {
        IPath locationDir=locationBase;
        if (l.isCPP()) {
          locationDir=locationBase.append("String_Node_Str");
        }
 else {
          locationDir=locationBase.append("String_Node_Str");
        }
        File lDir=new File(locationDir.toOSString());
        lDir.mkdir();
        IPath location=locationDir.append(getTransformedName(l.getName()) + "String_Node_Str");
        File target=new File(location.toOSString());
        if (!target.exists()) {
          try (FileOutputStream f=new FileOutputStream(locationDir.append("String_Node_Str").toOSString());ObjectOutputStream out=new ObjectOutputStream(f)){
            out.writeObject(l.getHoverInfo());
            out.close();
            File tmp=new File(locationDir.append("String_Node_Str").toOSString());
            tmp.renameTo(target);
          }
         }
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
public static void saveLibraries(IPath locationBase,IPreferenceStore ps){
  if (ps.getBoolean(PreferenceConstants.CACHE_EXT_LIBHOVER)) {
    for (Iterator<LibHoverLibrary> i=libraries.values().iterator(); i.hasNext(); ) {
      LibHoverLibrary l=i.next();
      try {
        IPath locationDir=locationBase;
        if (l.isCPP()) {
          locationDir=locationBase.append("String_Node_Str");
        }
 else {
          locationDir=locationBase.append("String_Node_Str");
        }
        File lDir=new File(locationDir.toOSString());
        lDir.mkdir();
        IPath location=locationDir.append(getTransformedName(l.getName()) + "String_Node_Str");
        File target=new File(location.toOSString());
        if (!target.exists()) {
          try (FileOutputStream f=new FileOutputStream(locationDir.append("String_Node_Str").toOSString());ObjectOutputStream out=new ObjectOutputStream(f)){
            out.writeObject(l.getHoverInfo());
            out.close();
            File tmp=new File(locationDir.append("String_Node_Str").toOSString());
            tmp.renameTo(target);
          }
         }
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
}
Program: 91842
Project: 91842
Buggy source:
public String getXmlElem(){
  return fXmlElem;
}

Fixed version (ground truth):
/** 
 * Get the XML element corresponding to this view type
 * @return The XML element corresponding to this type
 */
public @NonNull String getXmlElem(){
  return fXmlElem;
}
Program: 91843
Project: 91843
Buggy source:
public String getViewId(){
  return fViewId;
}

Fixed version (ground truth):
private String getViewId(){
  return fViewId;
}
Program: 91844
Project: 91844
Buggy source:
private void ViewType(String xmlElem,String viewId){
  fXmlElem=xmlElem;
  fViewId=viewId;
}

Fixed version (ground truth):
private void ViewType(@NonNull String xmlElem,String viewId){
  fXmlElem=xmlElem;
  fViewId=viewId;
}
Program: 91846
Project: 91846
Buggy source:
/** 
 * Constructor
 * @param viewid id of the view to display as output
 */
public TmfXmlViewOutput(String viewid){
  super(viewid);
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param viewid id of the view to display as output
 * @param viewType type of view this output is for
 * @since 1.1
 */
public TmfXmlViewOutput(String viewid,@NonNull ViewType viewType){
  super(viewid);
  fViewType=viewType;
}
Program: 91847
Project: 91847
Buggy source:
@Override public void setOutputProperty(@NonNull String key,String value,boolean immediate){
  super.setOutputProperty(key,value,immediate);
  if (key.equals(TmfXmlUiStrings.XML_OUTPUT_DATA)) {
    String[] idFile=value.split(TmfXmlAnalysisOutputSource.DATA_SEPARATOR);
    String viewId=(idFile.length > 0) ? idFile[0] : null;
    String filePath=(idFile.length > 1) ? idFile[1] : null;
    if ((viewId == null) || (filePath == null)) {
      return;
    }
    Element viewElement=XmlUtils.getElementInFile(filePath,TmfXmlUiStrings.TIME_GRAPH_VIEW,viewId);
    if (viewElement == null) {
      return;
    }
    List<Element> heads=XmlUtils.getChildElements(viewElement,TmfXmlStrings.HEAD);
    if (heads.size() != 1) {
      return;
    }
    Element headElement=heads.get(0);
    List<Element> label=XmlUtils.getChildElements(headElement,TmfXmlStrings.LABEL);
    if (label.isEmpty()) {
      return;
    }
    Element labelElement=label.get(0);
    fLabel=labelElement.getAttribute(TmfXmlStrings.VALUE);
  }
}

Fixed version (ground truth):
@Override public void setOutputProperty(@NonNull String key,String value,boolean immediate){
  super.setOutputProperty(key,value,immediate);
  if (key.equals(TmfXmlUiStrings.XML_OUTPUT_DATA)) {
    String[] idFile=value.split(TmfXmlAnalysisOutputSource.DATA_SEPARATOR);
    String viewId=(idFile.length > 0) ? idFile[0] : null;
    String filePath=(idFile.length > 1) ? idFile[1] : null;
    if ((viewId == null) || (filePath == null)) {
      return;
    }
    Element viewElement=XmlUtils.getElementInFile(filePath,fViewType.getXmlElem(),viewId);
    if (viewElement == null) {
      return;
    }
    List<Element> heads=XmlUtils.getChildElements(viewElement,TmfXmlStrings.HEAD);
    if (heads.size() != 1) {
      return;
    }
    Element headElement=heads.get(0);
    List<Element> label=XmlUtils.getChildElements(headElement,TmfXmlStrings.LABEL);
    if (label.isEmpty()) {
      return;
    }
    Element labelElement=label.get(0);
    fLabel=labelElement.getAttribute(TmfXmlStrings.VALUE);
  }
}
Program: 91848
Project: 91848
Buggy source:
private SourceFile findSourceCoverageForElement(ICElement element){
  List<SourceFile> sources=new ArrayList<>();
  ICProject cProject=element.getCProject();
  IPath target=GcovAnnotationModelTracker.getInstance().getBinaryPath(cProject.getProject());
  try {
    IBinary[] binaries=cProject.getBinaryContainer().getBinaries();
    for (    IBinary b : binaries) {
      if (b.getResource().getLocation().equals(target)) {
        CovManager covManager=new CovManager(b.getResource().getLocation().toOSString());
        covManager.processCovFiles(covManager.getGCDALocations(),null);
        sources.addAll(covManager.getAllSrcs());
      }
    }
  }
 catch (  IOException|CoreException|InterruptedException e) {
  }
  for (  SourceFile sf : sources) {
    IPath sfPath=new Path(sf.getName());
    IFile file=STLink2SourceSupport.getFileForPath(sfPath,cProject.getProject());
    if (file != null && element.getLocationURI().getPath().equals(file.getLocation().toOSString())) {
      return sf;
    }
  }
  IPath binFolder=target.removeLastSegments(1);
  for (  SourceFile sf : sources) {
    String sfPath=Paths.get(binFolder.toOSString(),sf.getName()).normalize().toString();
    if (sfPath.equals(element.getLocationURI().getPath())) {
      return sf;
    }
  }
  return null;
}

Fixed version (ground truth):
private SourceFile findSourceCoverageForElement(ICElement element){
  List<SourceFile> sources=new ArrayList<>();
  ICProject cProject=element.getCProject();
  IPath target=GcovAnnotationModelTracker.getInstance().getBinaryPath(cProject.getProject());
  try {
    IBinary[] binaries=cProject.getBinaryContainer().getBinaries();
    for (    IBinary b : binaries) {
      if (b.getResource().getLocation().equals(target)) {
        CovManager covManager=new CovManager(b.getResource().getLocation().toOSString());
        covManager.processCovFiles(covManager.getGCDALocations(),null);
        sources.addAll(covManager.getAllSrcs());
      }
    }
  }
 catch (  IOException|CoreException|InterruptedException e) {
  }
  for (  SourceFile sf : sources) {
    IPath sfPath=new Path(sf.getName());
    IFile file=STLink2SourceSupport.getFileForPath(sfPath,cProject.getProject());
    if (file != null && element.getResource().getLocation().equals(file.getLocation())) {
      return sf;
    }
  }
  IPath binFolder=target.removeLastSegments(1);
  for (  SourceFile sf : sources) {
    String sfPath=Paths.get(binFolder.toOSString()).resolve(sf.getName()).normalize().toString();
    if (sfPath.equals(element.getLocationURI().getPath())) {
      return sf;
    }
  }
  return null;
}
Program: 91849
Project: 91849
Buggy source:
/** 
 * Create opcontrol process
 * @param cmdArray array of opcontrol command and arguments
 * @param project project to be profiled
 * @return p opcontrol process
 * @throws OpcontrolException
 * @since 1.1
 */
protected Process createOpcontrolProcess(String[] cmdArray,IProject project) throws OpcontrolException {
  Process p=null;
  try {
    if (!LinuxtoolsPathProperty.getInstance().getLinuxtoolsPath(project).equals("String_Node_Str")) {
      p=RuntimeProcessFactory.getFactory().sudoExec(cmdArray,project);
    }
 else     if (isInstalled) {
      p=Runtime.getRuntime().exec(cmdArray);
    }
 else {
      throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("String_Node_Str",null));
    }
  }
 catch (  IOException ioe) {
    throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("String_Node_Str",ioe));
  }
  return p;
}

Fixed version (ground truth):
/** 
 * Create opcontrol process
 * @param cmdArray array of opcontrol command and arguments
 * @param project project to be profiled
 * @return p opcontrol process
 * @throws OpcontrolException
 * @since 1.1
 */
protected Process createOpcontrolProcess(String[] cmdArray,IProject project) throws OpcontrolException {
  Process p=null;
  try {
    if (!LinuxtoolsPathProperty.getInstance().getLinuxtoolsPath(project).isEmpty()) {
      p=RuntimeProcessFactory.getFactory().sudoExec(cmdArray,project);
    }
 else     if (isInstalled) {
      p=Runtime.getRuntime().exec(cmdArray);
    }
 else {
      throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("String_Node_Str",null));
    }
  }
 catch (  IOException ioe) {
    throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("String_Node_Str",ioe));
  }
  return p;
}
Program: 91850
Project: 91850
Buggy source:
/** 
 * Saves the current ("default") session
 * @param name    the name to which to save the session
 * @throws OpcontrolException
 */
@Override public void saveSession(String name) throws OpcontrolException {
  SessionManager sessMan;
  try {
    sessMan=new SessionManager(SessionManager.SESSION_LOCATION);
    for (    String event : sessMan.getSessionEvents(SessionManager.CURRENT)) {
      sessMan.addSession(name,event);
      String oldFile=SessionManager.OPXML_PREFIX + SessionManager.MODEL_DATA + event+ SessionManager.CURRENT;
      String newFile=SessionManager.OPXML_PREFIX + SessionManager.MODEL_DATA + event+ name;
      Process p=Runtime.getRuntime().exec("String_Node_Str" + oldFile + "String_Node_Str"+ newFile);
      p.waitFor();
    }
    sessMan.write();
  }
 catch (  FileNotFoundException e) {
  }
catch (  IOException e) {
    e.printStackTrace();
  }
catch (  InterruptedException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Saves the current ("default") session
 * @param name    the name to which to save the session
 * @throws OpcontrolException
 */
@Override public void saveSession(String name) throws OpcontrolException {
  SessionManager sessMan;
  try {
    sessMan=new SessionManager(SessionManager.SESSION_LOCATION);
    for (    String event : sessMan.getSessionEvents(SessionManager.CURRENT)) {
      sessMan.addSession(name,event);
      String oldFile=SessionManager.OPXML_PREFIX + SessionManager.MODEL_DATA + event+ SessionManager.CURRENT;
      String newFile=SessionManager.OPXML_PREFIX + SessionManager.MODEL_DATA + event+ name;
      Process p=Runtime.getRuntime().exec("String_Node_Str" + oldFile + "String_Node_Str"+ newFile);
      p.waitFor();
    }
    sessMan.write();
  }
 catch (  FileNotFoundException e) {
  }
catch (  IOException|InterruptedException e) {
    e.printStackTrace();
  }
}
Program: 91852
Project: 91852
Buggy source:
/** 
 * Search for opcontrol executable on the system
 * @return a string path to opcontrol executable
 * @since 1.1
 */
private String findOpcontrolExecutable(){
  IProject project=Oprofile.OprofileProject.getProject();
  if (!LinuxtoolsPathProperty.getInstance().getLinuxtoolsPath(project).equals("String_Node_Str")) {
    return OPCONTROL_EXECUTABLE;
  }
  URL url=FileLocator.find(Platform.getBundle(OprofileCorePlugin.getId()),new Path(OPCONTROL_REL_PATH),null);
  if (url != null) {
    try {
      isInstalled=true;
      return FileLocator.toFileURL(url).getPath();
    }
 catch (    IOException ignore) {
    }
  }
 else {
    isInstalled=false;
    return OPCONTROL_EXECUTABLE;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Search for opcontrol executable on the system
 * @return a string path to opcontrol executable
 * @since 1.1
 */
private String findOpcontrolExecutable(){
  IProject project=Oprofile.OprofileProject.getProject();
  if (!LinuxtoolsPathProperty.getInstance().getLinuxtoolsPath(project).isEmpty()) {
    return OPCONTROL_EXECUTABLE;
  }
  URL url=FileLocator.find(Platform.getBundle(OprofileCorePlugin.getId()),new Path(OPCONTROL_REL_PATH),null);
  if (url != null) {
    try {
      isInstalled=true;
      return FileLocator.toFileURL(url).getPath();
    }
 catch (    IOException ignore) {
    }
  }
 else {
    isInstalled=false;
    return OPCONTROL_EXECUTABLE;
  }
  return null;
}
Program: 91853
Project: 91853
Buggy source:
private File saveOpxmlToFile(BufferedReader bi,String[] args){
  String fileName="String_Node_Str";
  for (int i=0; i < args.length; i++) {
    fileName+=args[i];
  }
  File file=new File(SessionManager.OPXML_PREFIX + fileName);
  String line;
  try {
    file.createNewFile();
    BufferedWriter bw=new BufferedWriter(new FileWriter(file));
    while ((line=bi.readLine()) != null) {
      bw.write(line + "String_Node_Str");
    }
    bi.close();
    bw.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return file;
}

Fixed version (ground truth):
private File saveOpxmlToFile(BufferedReader bi,String[] args){
  String fileName="String_Node_Str";
  for (  String arg : args) {
    fileName+=arg;
  }
  File file=new File(SessionManager.OPXML_PREFIX + fileName);
  String line;
  try {
    file.createNewFile();
    BufferedWriter bw=new BufferedWriter(new FileWriter(file));
    while ((line=bi.readLine()) != null) {
      bw.write(line + "String_Node_Str");
    }
    bi.close();
    bw.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return file;
}
Program: 91855
Project: 91855
Buggy source:
/** 
 * @return an InputStream to the newly created XML data.
 */
public InputStream getInputStream(){
  InputStream inp=null;
  Source source=new DOMSource(getDocument());
  StringWriter stw=new StringWriter();
  Result result=new StreamResult(stw);
  TransformerFactory factory=TransformerFactory.newInstance();
  Transformer xformer;
  try {
    xformer=factory.newTransformer();
    xformer.setOutputProperty("String_Node_Str","String_Node_Str");
    xformer.transform(source,result);
    inp=new ByteArrayInputStream(stw.toString().getBytes("String_Node_Str"));
  }
 catch (  TransformerException|UnsupportedEncodingException e) {
    e.printStackTrace();
  }
  return inp;
}

Fixed version (ground truth):
/** 
 * @return an InputStream to the newly created XML data.
 */
public InputStream getInputStream(){
  InputStream inp=null;
  Source source=new DOMSource(getDocument());
  StringWriter stw=new StringWriter();
  Result result=new StreamResult(stw);
  TransformerFactory factory=TransformerFactory.newInstance();
  Transformer xformer;
  try {
    xformer=factory.newTransformer();
    xformer.setOutputProperty("String_Node_Str","String_Node_Str");
    xformer.transform(source,result);
    inp=new ByteArrayInputStream(stw.toString().getBytes(StandardCharsets.UTF_8));
  }
 catch (  TransformerException e) {
    e.printStackTrace();
  }
  return inp;
}
Program: 91857
Project: 91857
Buggy source:
@Override public void run(){
  AutotoolsConfigurationManager.getInstance().syncConfigurations(project);
  ICConfigurationDescription[] cfgds=CoreModel.getDefault().getProjectDescription(project).getConfigurations();
  if (cfgds != null && cfgds.length >= 1) {
    IAConfiguration iaConfig=AutotoolsConfigurationManager.getInstance().getConfiguration(project,cfgds[0].getId());
    iaConfig.setOption(optId,optVal);
    AutotoolsConfigurationManager.getInstance().saveConfigs(project);
  }
}

Fixed version (ground truth):
@Override public void run(){
  AutotoolsConfigurationManager.getInstance().syncConfigurations(project);
  ICConfigurationDescription cfgds=CoreModel.getDefault().getProjectDescription(project).getActiveConfiguration();
  if (cfgds != null) {
    IAConfiguration iaConfig=AutotoolsConfigurationManager.getInstance().getConfiguration(project,cfgds.getId());
    iaConfig.setOption(optId,optVal);
    AutotoolsConfigurationManager.getInstance().saveConfigs(project);
  }
}
Program: 91858
Project: 91858
Buggy source:
/** 
 * <h1>Option enabled check</h1> <p> Check to see if an option is enabled in the .autotools configuration.</p>
 * @param project  the IProject project which will be read to check if it is c or cpp.
 * @param optionId copy & paste directly from .autotools. pick the 'ID' field value.
 * @return true if it is
 */
public static boolean isOptionCheckedInAutotoolsPrefStore(final IProject project,final String optionId){
  final BooleanWithGetSet userChoiceBool=new BooleanWithGetSet(false);
  Display.getDefault().syncExec(new Runnable(){
    @Override public void run(){
      AutotoolsConfigurationManager.getInstance().syncConfigurations(project);
      ICConfigurationDescription[] cfgds=CoreModel.getDefault().getProjectDescription(project).getConfigurations();
      if (cfgds != null && cfgds.length >= 1) {
        IAConfiguration iaConfig=AutotoolsConfigurationManager.getInstance().getConfiguration(project,cfgds[0].getId());
        IConfigureOption option=iaConfig.getOption(optionId);
        String optValString=option.getValue();
        boolean optVal=Boolean.parseBoolean(optValString);
        userChoiceBool.setVal(optVal);
      }
    }
  }
);
  return userChoiceBool.getVal();
}

Fixed version (ground truth):
/** 
 * <h1>Option enabled check</h1> <p> Check to see if an option is enabled in the .autotools configuration.</p>
 * @param project  the IProject project which will be read to check if it is c or cpp.
 * @param optionId copy & paste directly from .autotools. pick the 'ID' field value.
 * @return true if it is
 */
public static boolean isOptionCheckedInAutotoolsPrefStore(final IProject project,final String optionId){
  final BooleanWithGetSet userChoiceBool=new BooleanWithGetSet(false);
  Display.getDefault().syncExec(new Runnable(){
    @Override public void run(){
      AutotoolsConfigurationManager.getInstance().syncConfigurations(project);
      ICConfigurationDescription cfgds=CoreModel.getDefault().getProjectDescription(project).getActiveConfiguration();
      if (cfgds != null) {
        IAConfiguration iaConfig=AutotoolsConfigurationManager.getInstance().getConfiguration(project,cfgds.getId());
        IConfigureOption option=iaConfig.getOption(optionId);
        String optValString=option.getValue();
        boolean optVal=Boolean.parseBoolean(optValString);
        userChoiceBool.setVal(optVal);
      }
    }
  }
);
  return userChoiceBool.getVal();
}
Program: 91859
Project: 91859
Buggy source:
/** 
 * <h1>Set Autotools option & write to disk.</h1> <p> Set an option (as well as flags) in the .autotools configuration & update gui. <br> It is oblivious as to whether the option ID is an option or a flag, it just looks at the ID in the xml. </p> <p> It is designed so that it can be ran from a background thread. It syncs with the GUI thread to avoid concurrency exceptions. </p> <p> *this modifies gui checkbox options* <b>as well as</b> *saving the option to disk*. </p>
 * @param project    the IProject project which will be read to check if it is c or cpp.
 * @param optId      Id of option to set. Take directly out of .autotools. a 'flag' is also an option.
 * @param optVal     string value of the option. e.g "true"  "1234";
 */
public static void setOptionInAutotools(final IProject project,final String optId,final String optVal){
  Display.getDefault().syncExec(new Runnable(){
    @Override public void run(){
      AutotoolsConfigurationManager.getInstance().syncConfigurations(project);
      ICConfigurationDescription[] cfgds=CoreModel.getDefault().getProjectDescription(project).getConfigurations();
      if (cfgds != null && cfgds.length >= 1) {
        IAConfiguration iaConfig=AutotoolsConfigurationManager.getInstance().getConfiguration(project,cfgds[0].getId());
        iaConfig.setOption(optId,optVal);
        AutotoolsConfigurationManager.getInstance().saveConfigs(project);
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * <h1>Set Autotools option & write to disk.</h1> <p> Set an option (as well as flags) in the .autotools configuration & update gui. <br> It is oblivious as to whether the option ID is an option or a flag, it just looks at the ID in the xml. </p> <p> It is designed so that it can be ran from a background thread. It syncs with the GUI thread to avoid concurrency exceptions. </p> <p> *this modifies gui checkbox options* <b>as well as</b> *saving the option to disk*. </p>
 * @param project    the IProject project which will be read to check if it is c or cpp.
 * @param optId      Id of option to set. Take directly out of .autotools. a 'flag' is also an option.
 * @param optVal     string value of the option. e.g "true"  "1234";
 */
public static void setOptionInAutotools(final IProject project,final String optId,final String optVal){
  Display.getDefault().syncExec(new Runnable(){
    @Override public void run(){
      AutotoolsConfigurationManager.getInstance().syncConfigurations(project);
      ICConfigurationDescription cfgds=CoreModel.getDefault().getProjectDescription(project).getActiveConfiguration();
      if (cfgds != null) {
        IAConfiguration iaConfig=AutotoolsConfigurationManager.getInstance().getConfiguration(project,cfgds.getId());
        iaConfig.setOption(optId,optVal);
        AutotoolsConfigurationManager.getInstance().saveConfigs(project);
      }
    }
  }
);
}
Program: 91865
Project: 91865
Buggy source:
@Override public boolean isValid(ILaunchConfiguration config){
  IProject project=getProject(config);
  setOprofileProject(project);
  if (getOprofileTimerMode() || counterSubTabs == null) {
    return true;
  }
 else {
    return validateEvents(config);
  }
}

Fixed version (ground truth):
@Override public boolean isValid(ILaunchConfiguration config){
  IProject project=getProject(config);
  setOprofileProject(project);
  OprofileCounter[] ctrs=getOprofileCounters(null);
  if (ctrs.length > 0 && ctrs[0].getValidEvents() == null) {
    return false;
  }
  if (getOprofileTimerMode() || counterSubTabs == null) {
    return true;
  }
 else {
    return validateEvents(config);
  }
}
Program: 91866
Project: 91866
Buggy source:
private OpEvent eventFromString(String str){
  for (int i=0; i < eventList.length; i++) {
    if (eventList[i].getText().equals(str))     return eventList[i];
  }
  return null;
}

Fixed version (ground truth):
private OpEvent eventFromString(String str){
  if (eventList != null) {
    for (int i=0; i < eventList.length; i++) {
      if (eventList[i].getText().equals(str))       return eventList[i];
    }
  }
  return null;
}
Program: 91867
Project: 91867
Buggy source:
private void createAnnotations(SourceFile sourceFile){
  AnnotationModelEvent event=new AnnotationModelEvent(this);
  clear(event);
  List<Line> lines=sourceFile.getLines();
  List<Long> tmp=new ArrayList<>();
  for (  Line line : lines) {
    if (line.getCount() != 0) {
      tmp.add(line.getCount());
    }
  }
  Long[] counts=tmp.toArray(new Long[0]);
  Arrays.sort(counts);
  final int q1=(int)Math.floor(0.25 * counts.length);
  final int q3=(int)Math.ceil(0.75 * counts.length);
  final float outlierThreshold=counts[q3] + (1.5f * (counts[q3] - counts[q1]));
  for (int i=0; i < lines.size(); i++) {
    try {
      Line line=lines.get((i + 1) % lines.size());
      String type=COVERAGE;
      if (line.getCount() == 0) {
        type=NO_COVERAGE;
      }
 else       if (line.getCount() > outlierThreshold) {
        type=THOROUGH_COVERAGE;
      }
      if (line.exists()) {
        GcovAnnotation ca=new GcovAnnotation(document.getLineOffset(i),document.getLineLength(i),line.getCount(),type);
        annotations.add(ca);
        event.annotationAdded(ca);
      }
    }
 catch (    BadLocationException e) {
    }
  }
  fireModelChanged(event);
  annotated=true;
}

Fixed version (ground truth):
private void createAnnotations(SourceFile sourceFile){
  AnnotationModelEvent event=new AnnotationModelEvent(this);
  clear(event);
  List<Line> lines=sourceFile.getLines();
  List<Long> tmp=new ArrayList<>();
  for (  Line line : lines) {
    if (line.getCount() != 0) {
      tmp.add(line.getCount());
    }
  }
  Long[] counts=tmp.toArray(new Long[0]);
  Arrays.sort(counts);
  float outlierThreshold=0;
  if (!tmp.isEmpty()) {
    final int q1=(int)Math.floor(0.25 * counts.length);
    final int q3=(int)Math.floor(0.75 * counts.length);
    outlierThreshold=counts[q3] + (1.5f * (counts[q3] - counts[q1]));
  }
  for (int i=0; i < lines.size(); i++) {
    try {
      Line line=lines.get((i + 1) % lines.size());
      String type=COVERAGE;
      if (line.getCount() == 0) {
        type=NO_COVERAGE;
      }
 else       if (line.getCount() > outlierThreshold) {
        type=THOROUGH_COVERAGE;
      }
      if (line.exists()) {
        GcovAnnotation ca=new GcovAnnotation(document.getLineOffset(i),document.getLineLength(i),line.getCount(),type);
        annotations.add(ca);
        event.annotationAdded(ca);
      }
    }
 catch (    BadLocationException e) {
    }
  }
  fireModelChanged(event);
  annotated=true;
}
Program: 91868
Project: 91868
Buggy source:
@Override public void createPartControl(Composite parent){
  fTree=new Tree(parent,SWT.NONE);
  TreeColumn nameCol=new TreeColumn(fTree,SWT.NONE,0);
  TreeColumn valueCol=new TreeColumn(fTree,SWT.NONE,1);
  nameCol.setText(Messages.TmfSynchronizationView_NameColumn);
  valueCol.setText(Messages.TmfSynchronizationView_ValueColumn);
  fTree.setItemCount(0);
  fTree.setHeaderVisible(true);
  nameCol.pack();
  valueCol.pack();
}

Fixed version (ground truth):
@Override public void createPartControl(Composite parent){
  fTree=new Tree(parent,SWT.NONE);
  TreeColumn nameCol=new TreeColumn(fTree,SWT.NONE,0);
  TreeColumn valueCol=new TreeColumn(fTree,SWT.NONE,1);
  nameCol.setText(Messages.TmfSynchronizationView_NameColumn);
  valueCol.setText(Messages.TmfSynchronizationView_ValueColumn);
  fTree.setItemCount(0);
  fTree.setHeaderVisible(true);
  nameCol.pack();
  valueCol.pack();
  ITmfTrace trace=TmfTraceManager.getInstance().getActiveTrace();
  if (trace != null) {
    traceSelected(new TmfTraceSelectedSignal(this,trace));
  }
}
Program: 91869
Project: 91869
Buggy source:
/** 
 * Run the BaseEventInfo() constructor test.
 */
@Test public void testBaseEventInfo(){
  EventInfo fixture=new EventInfo("String_Node_Str");
  assertNotNull(fixture);
  TraceEventType result=fixture.getEventType();
  assertEquals("String_Node_Str",fixture.getName());
  assertEquals("String_Node_Str",result.getInName());
  assertEquals("String_Node_Str",result.name());
  assertEquals("String_Node_Str",result.toString());
  assertEquals(4,result.ordinal());
  TraceEnablement state=fixture.getState();
  assertEquals("String_Node_Str",state.getInName());
  assertEquals("String_Node_Str",state.name());
  assertEquals("String_Node_Str",state.toString());
  assertEquals(0,state.ordinal());
}

Fixed version (ground truth):
/** 
 * Run the EventInfo() constructor test.
 */
@Test public void testBaseEventInfo(){
  EventInfo fixture=new EventInfo("String_Node_Str");
  assertNotNull(fixture);
  TraceEventType result=fixture.getEventType();
  assertEquals("String_Node_Str",fixture.getName());
  assertEquals("String_Node_Str",result.getInName());
  assertEquals("String_Node_Str",result.name());
  assertEquals("String_Node_Str",result.toString());
  assertEquals(4,result.ordinal());
  TraceEnablement state=fixture.getState();
  assertEquals("String_Node_Str",state.getInName());
  assertEquals("String_Node_Str",state.name());
  assertEquals("String_Node_Str",state.toString());
  assertEquals(0,state.ordinal());
  LogLevelType logType=fixture.getLogLevelType();
  assertEquals("String_Node_Str",logType.getShortName());
  assertEquals("String_Node_Str",logType.name());
  assertEquals("String_Node_Str",logType.toString());
  assertEquals(0,state.ordinal());
}
Program: 91870
Project: 91870
Buggy source:
/** 
 * Test Copy Constructor
 */
@Test public void testEventInfoCopy(){
  EventInfo info=new EventInfo((EventInfo)fEventInfo1);
  assertEquals(fEventInfo1.getName(),info.getName());
  assertEquals(fEventInfo1.getEventType(),info.getEventType());
  assertEquals(fEventInfo1.getState(),info.getState());
}

Fixed version (ground truth):
/** 
 * Test Copy Constructor
 */
@Test public void testEventInfoCopy(){
  EventInfo info=new EventInfo((EventInfo)fEventInfo1);
  assertEquals(fEventInfo1.getName(),info.getName());
  assertEquals(fEventInfo1.getEventType(),info.getEventType());
  assertEquals(fEventInfo1.getState(),info.getState());
  assertEquals(fEventInfo1.getLogLevelType(),info.getLogLevelType());
}
Program: 91873
Project: 91873
Buggy source:
/** 
 * Copy constructor
 * @param other - the instance to copy
 */
public BaseEventInfo(BaseEventInfo other){
  super(other);
  fEventType=other.fEventType;
  for (Iterator<IFieldInfo> iterator=other.fFields.iterator(); iterator.hasNext(); ) {
    IFieldInfo field=iterator.next();
    if (field instanceof FieldInfo) {
      fFields.add(new FieldInfo((FieldInfo)field));
    }
 else {
      fFields.add(field);
    }
  }
  fFilterExpression=other.fFilterExpression;
}

Fixed version (ground truth):
/** 
 * Copy constructor
 * @param other - the instance to copy
 */
public BaseEventInfo(BaseEventInfo other){
  super(other);
  fEventType=other.fEventType;
  fLogLevel=other.fLogLevel;
  for (Iterator<IFieldInfo> iterator=other.fFields.iterator(); iterator.hasNext(); ) {
    IFieldInfo field=iterator.next();
    if (field instanceof FieldInfo) {
      fFields.add(new FieldInfo((FieldInfo)field));
    }
 else {
      fFields.add(field);
    }
  }
  fFilterExpression=other.fFilterExpression;
}
Program: 91874
Project: 91874
Buggy source:
/** 
 * Copy constructor
 * @param other - the instance to copy
 */
public EventInfo(EventInfo other){
  super(other);
  fState=other.fState;
}

Fixed version (ground truth):
/** 
 * Copy constructor
 * @param other - the instance to copy
 */
public EventInfo(EventInfo other){
  super(other);
  fState=other.fState;
  fLogLevelType=other.fLogLevelType;
}
Program: 91875
Project: 91875
Buggy source:
@Override public int hashCode(){
  final int prime=31;
  int result=super.hashCode();
  result=prime * result + ((fState == null) ? 0 : (fState.ordinal() + 1));
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  final int prime=31;
  int result=super.hashCode();
  result=prime * result + ((fState == null) ? 0 : (fState.ordinal() + 1));
  result=prime * result + ((fLogLevelType == null) ? 0 : fLogLevelType.hashCode());
  return result;
}
Program: 91876
Project: 91876
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (!super.equals(obj)) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  EventInfo other=(EventInfo)obj;
  if (fState != other.fState) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (!super.equals(obj)) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  EventInfo other=(EventInfo)obj;
  if (fState != other.fState) {
    return false;
  }
  if (fLogLevelType != other.fLogLevelType) {
    return false;
  }
  return true;
}
Program: 91877
Project: 91877
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public String toString(){
  StringBuffer output=new StringBuffer();
  output.append("String_Node_Str");
  output.append(super.toString());
  output.append("String_Node_Str");
  output.append(fState);
  output.append("String_Node_Str");
  return output.toString();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public String toString(){
  StringBuffer output=new StringBuffer();
  output.append("String_Node_Str");
  output.append(super.toString());
  output.append("String_Node_Str");
  output.append(fState);
  output.append("String_Node_Str");
  output.append(fLogLevelType);
  output.append("String_Node_Str");
  return output.toString();
}
Program: 91881
Project: 91881
Buggy source:
/** 
 * Copy this trace in the trace folder. No other parameters are mentioned so the trace is copied in this element's project trace folder
 * @param string The new trace name
 * @return the new Resource object
 * @since 2.0
 */
public TmfTraceElement copy(String string){
  TmfTraceFolder folder=this.getProject().getTracesFolder();
  IResource res=super.copy(string,false);
  return new TmfTraceElement(string,res,folder);
}

Fixed version (ground truth):
/** 
 * Copy this trace in the trace folder. No other parameters are mentioned so the trace is copied in this element's project trace folder
 * @param newName The new trace name
 * @return the new Resource object
 * @since 2.0
 */
public TmfTraceElement copy(String newName){
  TmfTraceFolder folder=(TmfTraceFolder)getParent();
  IResource res=super.copy(newName,false);
  for (  TmfTraceElement trace : folder.getTraces()) {
    if (trace.getResource().equals(res)) {
      return trace;
    }
  }
  return null;
}
Program: 91882
Project: 91882
Buggy source:
private static void openTraceIfNecessary(IProject project){
  String traceToOpen=TracingRcpPlugin.getDefault().getCli().getArgument(CliParser.OPEN_FILE_LOCATION);
  if (traceToOpen != null) {
    try {
      TmfTraceFolder destinationFolder=TmfProjectRegistry.getProject(project).getTracesFolder();
      TmfOpenTraceHelper.openTraceFromPath(destinationFolder,traceToOpen,TracingRcpPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell());
    }
 catch (    CoreException e) {
      TracingRcpPlugin.getDefault().logError(e.getMessage());
    }
  }
}

Fixed version (ground truth):
private static void openTraceIfNecessary(IProject project){
  String traceToOpen=TracingRcpPlugin.getDefault().getCli().getArgument(CliParser.OPEN_FILE_LOCATION);
  if (traceToOpen != null) {
    try {
      TmfTraceFolder destinationFolder=TmfProjectRegistry.getProject(project,true).getTracesFolder();
      TmfOpenTraceHelper.openTraceFromPath(destinationFolder,traceToOpen,TracingRcpPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell());
    }
 catch (    CoreException e) {
      TracingRcpPlugin.getDefault().logError(e.getMessage());
    }
  }
}