nus-yam/ex-repair huggingface dataset:
Program: 92772
Project: 92772
Buggy source:
/** 
 * Stops the executor
 */
public void stop(){
  if (fCurrentRequest != null) {
    fCurrentRequest.cancel();
  }
  fExecutor.shutdown();
  if (Tracer.isComponentTraced())   Tracer.trace(fExecutor + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Stops the executor
 */
public synchronized void stop(){
  if (fCurrentRequest != null) {
    fCurrentRequest.cancel();
  }
  while ((fCurrentRequest=fRequestQueue.poll()) != null) {
    fCurrentRequest.cancel();
  }
  fExecutor.shutdown();
  if (Tracer.isComponentTraced())   Tracer.trace(fExecutor + "String_Node_Str");
}
Program: 92773
Project: 92773
Buggy source:
/** 
 * @return the termination state
 */
public boolean isTerminated(){
  return fExecutor.isTerminated();
}

Fixed version (ground truth):
/** 
 * @return the termination state
 */
public synchronized boolean isTerminated(){
  return fExecutor.isTerminated();
}
Program: 92774
Project: 92774
Buggy source:
/** 
 * @return the number of pending requests
 */
public int getNbPendingRequests(){
  return fRequestQueue.size();
}

Fixed version (ground truth):
/** 
 * @return the number of pending requests
 */
public synchronized int getNbPendingRequests(){
  return fRequestQueue.size();
}
Program: 92775
Project: 92775
Buggy source:
/** 
 * TODO: Not used for the time being, for experiment selection test cases for package state.experiment
 */
public void testSetTraceSelection(){
  String logName="String_Node_Str";
  LTTngTrace testStream=null;
  try {
    testStream=new LTTngTrace(logName,false);
  }
 catch (  Exception e) {
  }
  if (testStream != null) {
    LTTngTrace[] streamList=new LTTngTrace[1];
    streamList[0]=testStream;
  }
}

Fixed version (ground truth):
/** 
 * TODO: Not used for the time being, for experiment selection test cases for package state.experiment
 */
public void testSetTraceSelection(){
  String logName="String_Node_Str";
}
Program: 92777
Project: 92777
Buggy source:
/** 
 * <h4>Function to merge many string with more efficacy.</h4>
 * @param strings Strings to merge.
 * @return A new string containing all the strings.
 */
protected synchronized static String mergeString(String... strings){
  fBuilder.setLength(0);
  for (  String s : strings)   fBuilder.append(s);
  return fBuilder.toString();
}

Fixed version (ground truth):
/** 
 * <h4>Function to merge many string with more efficacy.</h4>
 * @param strings Strings to merge.
 * @return A new string containing all the strings.
 */
public synchronized static String mergeString(String... strings){
  fBuilder.setLength(0);
  for (  String s : strings)   fBuilder.append(s);
  return fBuilder.toString();
}
Program: 92778
Project: 92778
Buggy source:
/** 
 * <h4>Get the map of existing elements of path classified by parent.</h4>
 * @return The map.
 */
protected Map<String,Set<String>> getKeys(){
  return fKeys;
}

Fixed version (ground truth):
/** 
 * <h4>Get the map of existing elements of path classified by parent.</h4>
 * @return The map.
 */
public Map<String,Set<String>> getKeys(){
  return fKeys;
}
Program: 92779
Project: 92779
Buggy source:
/** 
 * <h4>Get the event types paths.</h4>
 * @param event Event to get the path for.
 * @param extraInfo Extra information to pass along with the event
 * @return Array of FixedArray representing the paths.
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private TmfFixedArray<String>[] getTypePaths(TmfEvent event,ITmfExtraEventInfo extraInfo){
  String trace=extraInfo.getTraceName();
  String type=event.getType().toString();
  TmfFixedArray[] paths={new TmfFixedArray<String>(trace,HEADER_EVENT_TYPES,type)};
  return paths;
}

Fixed version (ground truth):
/** 
 * <h4>Get the event types paths.</h4>
 * @param event Event to get the path for.
 * @param extraInfo Extra information to pass along with the event
 * @return Array of FixedArray representing the paths.
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) protected TmfFixedArray<String>[] getTypePaths(TmfEvent event,ITmfExtraEventInfo extraInfo){
  String trace=extraInfo.getTraceName();
  String type=event.getType().toString();
  TmfFixedArray[] paths={new TmfFixedArray<String>(trace,HEADER_EVENT_TYPES,type)};
  return paths;
}
Program: 92780
Project: 92780
Buggy source:
/** 
 * <h4>Get the standard paths for an event.</h4>
 * @param event Event to get the path for.
 * @param extraInfo Extra information to pass along with the event
 * @return Array of FixedArray representing the paths.
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private TmfFixedArray<String>[] getNormalPaths(TmfEvent event,ITmfExtraEventInfo extraInfo){
  String trace=extraInfo.getTraceName();
  TmfFixedArray[] paths={new TmfFixedArray<String>(trace)};
  return paths;
}

Fixed version (ground truth):
/** 
 * <h4>Get the standard paths for an event.</h4>
 * @param event Event to get the path for.
 * @param extraInfo Extra information to pass along with the event
 * @return Array of FixedArray representing the paths.
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) protected TmfFixedArray<String>[] getNormalPaths(TmfEvent event,ITmfExtraEventInfo extraInfo){
  String trace=extraInfo.getTraceName();
  TmfFixedArray[] paths={new TmfFixedArray<String>(trace)};
  return paths;
}
Program: 92782
Project: 92782
Buggy source:
/** 
 * Trigger the Analysis and sequential control of the events.
 * @param e
 */
private void handleIncomingData(LttngEvent e){
  long eventTime=e.getTimestamp().getValue();
  TmfTrace<LttngEvent> inTrace=e.getParentTrace();
  LttngTraceState traceModel=traceToTraceStateModel.get(inTrace);
  updateSynEvent(e);
  if (eventTime >= dispatchTime && eventIndex >= dispatchIndex) {
    syntheticEvent.setSequenceInd(SequenceInd.BEFORE);
    fmainRequest.handleData(syntheticEvent);
    syntheticEvent.setSequenceInd(SequenceInd.UPDATE);
    fstateUpdateProcessor.process(syntheticEvent,traceModel);
    syntheticEvent.setSequenceInd(SequenceInd.AFTER);
    fmainRequest.handleData(syntheticEvent);
  }
 else {
    syntheticEvent.setSequenceInd(SequenceInd.UPDATE);
    fstateUpdateProcessor.process(syntheticEvent,traceModel);
  }
  eventIndex++;
}

Fixed version (ground truth):
/** 
 * Trigger the Analysis and sequential control of the events.
 * @param e
 */
private void handleIncomingData(LttngEvent e){
  long eventTime=e.getTimestamp().getValue();
  ITmfTrace inTrace=e.getParentTrace();
  LttngTraceState traceModel=traceToTraceStateModel.get(inTrace);
  updateSynEvent(e);
  if (eventTime >= dispatchTime && eventIndex >= dispatchIndex) {
    syntheticEvent.setSequenceInd(SequenceInd.BEFORE);
    fmainRequest.handleData(syntheticEvent);
    syntheticEvent.setSequenceInd(SequenceInd.UPDATE);
    fstateUpdateProcessor.process(syntheticEvent,traceModel);
    syntheticEvent.setSequenceInd(SequenceInd.AFTER);
    fmainRequest.handleData(syntheticEvent);
  }
 else {
    syntheticEvent.setSequenceInd(SequenceInd.UPDATE);
    fstateUpdateProcessor.process(syntheticEvent,traceModel);
  }
  eventIndex++;
}
Program: 92783
Project: 92783
Buggy source:
/** 
 * Create a synthetic event from the received new reference, if the reference is the same there is no need for a new instance if this is the first event for this request, call start handler
 * @param e
 * @return
 */
private LttngSyntheticEvent updateSynEvent(LttngEvent e){
  if ((syntheticEvent == null) || (syntheticEvent.getBaseEvent() != e)) {
    syntheticEvent=new LttngSyntheticEvent(e);
  }
  TmfTrace<LttngEvent> inTrace=e.getParentTrace();
  LttngTraceState traceModel=traceToTraceStateModel.get(inTrace);
  syntheticEvent.setTraceModel(traceModel);
  if (!startIndSent) {
    TraceDebug.debug("String_Node_Str" + Thread.currentThread().getName());
    handleProviderStarted(traceModel);
    startIndSent=true;
  }
  return syntheticEvent;
}

Fixed version (ground truth):
/** 
 * Create a synthetic event from the received new reference, if the reference is the same there is no need for a new instance if this is the first event for this request, call start handler
 * @param e
 * @return
 */
private LttngSyntheticEvent updateSynEvent(LttngEvent e){
  if ((syntheticEvent == null) || (syntheticEvent.getBaseEvent() != e)) {
    syntheticEvent=new LttngSyntheticEvent(e);
  }
  ITmfTrace inTrace=e.getParentTrace();
  LttngTraceState traceModel=traceToTraceStateModel.get(inTrace);
  syntheticEvent.setTraceModel(traceModel);
  if (!startIndSent) {
    TraceDebug.debug("String_Node_Str" + Thread.currentThread().getName());
    handleProviderStarted(traceModel);
    startIndSent=true;
  }
  return syntheticEvent;
}
Program: 92784
Project: 92784
Buggy source:
@Override public LttngEvent clone(){
  LttngEvent clone=(LttngEvent)super.clone();
  clone.getContent().setEvent(clone);
  clone.parentTrace=parentTrace;
  clone.jniEventReference=jniEventReference;
  return clone;
}

Fixed version (ground truth):
@Override public LttngEvent clone(){
  LttngEvent clone=(LttngEvent)super.clone();
  clone.getContent().setEvent(clone);
  clone.jniEventReference=jniEventReference;
  return clone;
}
Program: 92785
Project: 92785
Buggy source:
/** 
 * Copy constructor.<p>
 * @param oldEvent		Event we want to copy from.
 */
public LttngEvent(LttngEvent oldEvent){
  this(oldEvent.getParentTrace(),(LttngTimestamp)oldEvent.getTimestamp(),(TmfEventSource)oldEvent.getSource(),(LttngEventType)oldEvent.getType(),(LttngEventContent)oldEvent.getContent(),(LttngEventReference)oldEvent.getReference(),oldEvent.jniEventReference);
}

Fixed version (ground truth):
/** 
 * Copy constructor.<p>
 * @param oldEvent		Event we want to copy from.
 */
@SuppressWarnings("String_Node_Str") public LttngEvent(LttngEvent oldEvent){
  this((TmfTrace<LttngEvent>)oldEvent.getParentTrace(),(LttngTimestamp)oldEvent.getTimestamp(),(TmfEventSource)oldEvent.getSource(),(LttngEventType)oldEvent.getType(),(LttngEventContent)oldEvent.getContent(),(LttngEventReference)oldEvent.getReference(),oldEvent.jniEventReference);
}
Program: 92786
Project: 92786
Buggy source:
/** 
 * Set a new parent trace for this event
 * @param parentTrace	The new parent
 */
public void setParentTrace(TmfTrace<LttngEvent> parentTrace){
  this.parentTrace=parentTrace;
}

Fixed version (ground truth):
/** 
 * Set a new parent trace for this event
 * @param parentTrace	The new parent
 */
public void setParentTrace(TmfTrace<LttngEvent> parentTrace){
  fParentTrace=parentTrace;
}
Program: 92787
Project: 92787
Buggy source:
/** 
 * /* (non-Javadoc)
 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getParentTrace()
 */
@Override public TmfTrace<LttngEvent> getParentTrace(){
  if (baseEvent != null) {
    return baseEvent.getParentTrace();
  }
 else {
    return super.getParentTrace();
  }
}

Fixed version (ground truth):
/** 
 * /* (non-Javadoc)
 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getParentTrace()
 */
@SuppressWarnings("String_Node_Str") @Override public TmfTrace<LttngEvent> getParentTrace(){
  if (baseEvent != null) {
    return (TmfTrace<LttngEvent>)baseEvent.getParentTrace();
  }
 else {
    return (TmfTrace<LttngEvent>)super.getParentTrace();
  }
}
Program: 92788
Project: 92788
Buggy source:
public TextLttngEvent(TextLttngEvent oldEvent){
  this(oldEvent.getParentTrace(),(LttngTimestamp)oldEvent.getTimestamp(),(LttngEventSource)oldEvent.getSource(),(LttngEventType)oldEvent.getType(),(LttngEventContent)oldEvent.getContent(),(LttngEventReference)oldEvent.getReference());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public TextLttngEvent(TextLttngEvent oldEvent){
  this((TmfTrace<LttngEvent>)oldEvent.getParentTrace(),(LttngTimestamp)oldEvent.getTimestamp(),(LttngEventSource)oldEvent.getSource(),(LttngEventType)oldEvent.getType(),(LttngEventContent)oldEvent.getContent(),(LttngEventReference)oldEvent.getReference());
}
Program: 92789
Project: 92789
Buggy source:
@Override public TmfEvent clone(){
  TmfEvent clone=null;
  try {
    clone=(TmfEvent)super.clone();
    clone.fOriginalTimestamp=fOriginalTimestamp.clone();
    clone.fEffectiveTimestamp=fEffectiveTimestamp.clone();
    clone.fSource=fSource.clone();
    clone.fType=fType.clone();
    clone.fReference=fReference.clone();
    clone.fContent=fContent.clone();
  }
 catch (  CloneNotSupportedException e) {
    e.printStackTrace();
  }
  return clone;
}

Fixed version (ground truth):
@Override public TmfEvent clone(){
  TmfEvent clone=null;
  try {
    clone=(TmfEvent)super.clone();
    clone.fParentTrace=fParentTrace;
    clone.fEventRank=fEventRank;
    clone.fOriginalTimestamp=fOriginalTimestamp.clone();
    clone.fEffectiveTimestamp=fEffectiveTimestamp.clone();
    clone.fSource=fSource.clone();
    clone.fType=fType.clone();
    clone.fReference=fReference.clone();
    clone.fContent=fContent.clone();
  }
 catch (  CloneNotSupportedException e) {
    e.printStackTrace();
  }
  return clone;
}
Program: 92793
Project: 92793
Buggy source:
/** 
 * Test method for  {@link org.eclipse.linuxtools.tmf.HistogramDataModel.views.histogram.TmfHistogramDataModel#scaleTo(int,int)}.
 */
@Test public void testScaleTo_1(){
  final int nbBuckets=10;
  final int maxHeight=10;
  final int nbEvents=nbBuckets / 2;
  final int[] expectedResult=new int[]{1,1,1,1,1,0,0,0,0,0};
  HistogramDataModel model=new HistogramDataModel(nbBuckets);
  for (int i=0; i < nbEvents; i++) {
    model.countEvent(i);
  }
  HistogramScaledData result=model.scaleTo(nbBuckets,maxHeight);
  for (int i=0; i < result.fData.length; i++) {
    assertTrue(result.fData[i] == expectedResult[i]);
  }
  assertTrue(model.getNbEvents() == nbEvents);
  assertTrue(model.getNbBuckets() == nbBuckets);
  assertTrue(model.getBucketDuration() == 1);
  assertTrue(model.getStartTime() == 0);
  assertTrue(model.getEndTime() == nbEvents - 1);
  assertTrue(model.getTimeLimit() == nbBuckets);
}

Fixed version (ground truth):
@Test public void testScaleTo_1(){
  final int nbBuckets=10;
  final int maxHeight=10;
  final int nbEvents=nbBuckets / 2;
  final int[] expectedResult=new int[]{1,1,1,1,1,0,0,0,0,0};
  HistogramDataModel model=new HistogramDataModel(nbBuckets);
  for (int i=0; i < nbEvents; i++) {
    model.countEvent(i);
  }
  HistogramScaledData result=model.scaleTo(nbBuckets,maxHeight);
  for (int i=0; i < result.fData.length; i++) {
    assertTrue(result.fData[i] == expectedResult[i]);
  }
  assertTrue(model.getNbEvents() == nbEvents);
  assertTrue(model.getNbBuckets() == nbBuckets);
  assertTrue(model.getBucketDuration() == 1);
  assertTrue(model.getStartTime() == 0);
  assertTrue(model.getEndTime() == nbEvents - 1);
  assertTrue(model.getTimeLimit() == nbBuckets);
}
Program: 92794
Project: 92794
Buggy source:
@Override public void run(){
  if (!fCanvas.isDisposed()) {
    int canvasWidth=fCanvas.getBounds().width;
    int canvasHeight=fCanvas.getBounds().height;
    fDataModel.setCurrentEvent(fCurrentEventTime);
    fScaledData=fDataModel.scaleTo(canvasWidth,canvasHeight);
    fCanvas.redraw();
    fTimeRangeStartText.setText(HistogramUtils.nanosecondsToString(fDataModel.getStartTime()));
    fTimeRangeEndText.setText(HistogramUtils.nanosecondsToString(fDataModel.getEndTime()));
    fMaxNbEventsText.setText(Long.toString(fScaledData.fMaxValue));
    fMaxNbEventsText.getParent().layout();
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (!fCanvas.isDisposed()) {
    int canvasWidth=fCanvas.getBounds().width;
    int canvasHeight=fCanvas.getBounds().height;
    if (canvasWidth <= 0 || canvasHeight <= 0)     return;
    fDataModel.setCurrentEvent(fCurrentEventTime);
    fScaledData=fDataModel.scaleTo(canvasWidth,canvasHeight);
    fCanvas.redraw();
    fTimeRangeStartText.setText(HistogramUtils.nanosecondsToString(fDataModel.getStartTime()));
    fTimeRangeEndText.setText(HistogramUtils.nanosecondsToString(fDataModel.getEndTime()));
    fMaxNbEventsText.setText(Long.toString(fScaledData.fMaxValue));
    fMaxNbEventsText.getParent().layout();
  }
}
Program: 92795
Project: 92795
Buggy source:
/** 
 * Refresh the histogram display
 */
protected void refresh(){
  if (!fCanvas.isDisposed() && fCanvas.getDisplay() != null) {
    fCanvas.getDisplay().asyncExec(new Runnable(){
      @Override public void run(){
        if (!fCanvas.isDisposed()) {
          int canvasWidth=fCanvas.getBounds().width;
          int canvasHeight=fCanvas.getBounds().height;
          fDataModel.setCurrentEvent(fCurrentEventTime);
          fScaledData=fDataModel.scaleTo(canvasWidth,canvasHeight);
          fCanvas.redraw();
          fTimeRangeStartText.setText(HistogramUtils.nanosecondsToString(fDataModel.getStartTime()));
          fTimeRangeEndText.setText(HistogramUtils.nanosecondsToString(fDataModel.getEndTime()));
          fMaxNbEventsText.setText(Long.toString(fScaledData.fMaxValue));
          fMaxNbEventsText.getParent().layout();
        }
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * Refresh the histogram display
 */
protected void refresh(){
  if (!fCanvas.isDisposed() && fCanvas.getDisplay() != null) {
    fCanvas.getDisplay().asyncExec(new Runnable(){
      @Override public void run(){
        if (!fCanvas.isDisposed()) {
          int canvasWidth=fCanvas.getBounds().width;
          int canvasHeight=fCanvas.getBounds().height;
          if (canvasWidth <= 0 || canvasHeight <= 0)           return;
          fDataModel.setCurrentEvent(fCurrentEventTime);
          fScaledData=fDataModel.scaleTo(canvasWidth,canvasHeight);
          fCanvas.redraw();
          fTimeRangeStartText.setText(HistogramUtils.nanosecondsToString(fDataModel.getStartTime()));
          fTimeRangeEndText.setText(HistogramUtils.nanosecondsToString(fDataModel.getEndTime()));
          fMaxNbEventsText.setText(Long.toString(fScaledData.fMaxValue));
          fMaxNbEventsText.getParent().layout();
        }
      }
    }
);
  }
}
Program: 92796
Project: 92796
Buggy source:
/** 
 * Scale the model data to the width and height requested.
 * @param width
 * @param height
 * @return the result array of size [width] and where the highest valuedoesn't exceed [height]
 */
public HistogramScaledData scaleTo(int width,int height){
}

Fixed version (ground truth):
/** 
 * Scale the model data to the width and height requested.
 * @param width
 * @param height
 * @return the result array of size [width] and where the highest valuedoesn't exceed [height]
 */
public HistogramScaledData scaleTo(int width,int height){
  if (width <= 0 || height <= 0)   throw new AssertionError("String_Node_Str" + width + "String_Node_Str"+ height+ "String_Node_Str");
  HistogramScaledData result=new HistogramScaledData(width,height);
  result.fMaxValue=0;
  int bucketsPerBar=fLastBucket / width + 1;
  result.fBucketDuration=bucketsPerBar * fBucketDuration;
  for (int i=0; i < width; i++) {
    int count=0;
    for (int j=i * bucketsPerBar; j < (i + 1) * bucketsPerBar; j++) {
      if (fNbBuckets <= j)       break;
      count+=fBuckets[j];
    }
    result.fData[i]=count;
    result.fLastBucket=i;
    if (result.fMaxValue < count)     result.fMaxValue=count;
  }
  if (result.fMaxValue > 0) {
    result.fScalingFactor=(double)height / result.fMaxValue;
  }
  if (fCurrentEventTime >= fFirstEventTime && fCurrentEventTime <= fLastEventTime)   result.fCurrentBucket=(int)((fCurrentEventTime - fFirstEventTime) / fBucketDuration) / bucketsPerBar;
 else   result.fCurrentBucket=HistogramScaledData.OUT_OF_RANGE_BUCKET;
  return result;
}
Program: 92797
Project: 92797
Buggy source:
private void selectTrace(LTTngTraceNode traceNode){
  if (fSelectedExperiment != null) {
    fSelectedExperiment.dispose();
  }
  try {
    ITmfTrace[] traces=new ITmfTrace[1];
    IResource res=traceNode.getFolder();
    String location=res.getLocation().toOSString();
    IProject project=traceNode.getProject().getProject();
    String traceLibPath=TraceHelper.getTraceLibDirFromProject(project);
    ITmfTrace trace=new LTTngTrace(location,traceLibPath,waitForCompletion,false);
    traces[0]=trace;
    fSelectedExperiment=new LTTngExperiment<LttngEvent>(LttngEvent.class,traceNode.getName(),traces);
    TmfExperiment.setCurrentExperiment(fSelectedExperiment);
    StateManagerFactory.getExperimentManager().experimentSelected_prep((TmfExperiment<LttngEvent>)fSelectedExperiment);
    broadcast(new TmfExperimentSelectedSignal<LttngEvent>(this,fSelectedExperiment));
  }
 catch (  FileNotFoundException e) {
    return;
  }
catch (  Exception e) {
    MessageDialog.openError(getViewSite().getShell(),Messages.SelectTrace_ErrorTitle,e.getMessage());
  }
}

Fixed version (ground truth):
private void selectTrace(LTTngTraceNode traceNode){
  if (fSelectedExperiment != null) {
    fSelectedExperiment.dispose();
  }
  try {
    ITmfTrace[] traces=new ITmfTrace[1];
    IResource res=traceNode.getFolder();
    String location=res.getLocation().toOSString();
    LTTngProjectNode projectNode=traceNode.getProject();
    IProject project=projectNode.getProject();
    String traceLibPath=TraceHelper.getTraceLibDirFromProject(project);
    ITmfTrace trace=new LTTngTrace(location,traceLibPath,waitForCompletion,false);
    traces[0]=trace;
    fSelectedExperiment=new LTTngExperiment<LttngEvent>(LttngEvent.class,traceNode.getName(),traces);
    TmfExperiment.setCurrentExperiment(fSelectedExperiment);
    StateManagerFactory.getExperimentManager().experimentSelected_prep((TmfExperiment<LttngEvent>)fSelectedExperiment);
    broadcast(new TmfExperimentSelectedSignal<LttngEvent>(this,fSelectedExperiment));
  }
 catch (  FileNotFoundException e) {
    return;
  }
catch (  Exception e) {
    MessageDialog.openError(getViewSite().getShell(),Messages.SelectTrace_ErrorTitle,e.getMessage());
  }
}
Program: 92798
Project: 92798
Buggy source:
/** 
 * @return
 */
public LTTngProjectNode getProject(){
  return (LTTngProjectNode)getParent().getParent();
}

Fixed version (ground truth):
/** 
 * @return
 */
public LTTngProjectNode getProject(){
  ILTTngProjectTreeNode projectNode=null;
  ILTTngProjectTreeNode parent=getParent();
  if (parent instanceof LTTngTraceFolderNode) {
    projectNode=parent.getParent();
  }
 else   if (parent instanceof LTTngExperimentNode) {
    projectNode=parent.getParent().getParent();
  }
  return (LTTngProjectNode)projectNode;
}
Program: 92799
Project: 92799
Buggy source:
public void transfer(String fromFile,String toFile){
  FileInputStream fis=null;
  String rfile=toFile;
  String lfile=fromFile;
  String command="String_Node_Str" + rfile;
  try {
    Channel channel=session.openChannel("String_Node_Str");
    ((ChannelExec)channel).setCommand(command);
    OutputStream out=channel.getOutputStream();
    InputStream in=channel.getInputStream();
    channel.connect();
    if (checkAck(in) != 0) {
      System.out.println("String_Node_Str");
    }
    long filesize=(new File(lfile)).length();
    command="String_Node_Str" + filesize + "String_Node_Str";
    if (lfile.lastIndexOf('/') > 0) {
      command+=lfile.substring(lfile.lastIndexOf('/') + 1);
    }
 else {
      command+=lfile;
    }
    command+="String_Node_Str";
    out.write(command.getBytes());
    out.flush();
    if (checkAck(in) != 0) {
      System.out.println("String_Node_Str");
    }
    fis=new FileInputStream(lfile);
    byte[] buf=new byte[1024];
    while (true) {
      int len=fis.read(buf,0,buf.length);
      if (len <= 0)       break;
      out.write(buf,0,len);
    }
    fis.close();
    fis=null;
    buf[0]=0;
    out.write(buf,0,1);
    out.flush();
    if (checkAck(in) != 0) {
      System.out.println("String_Node_Str");
    }
    out.close();
    channel.disconnect();
    session.disconnect();
  }
 catch (  Exception e) {
    try {
      if (fis != null)       fis.close();
    }
 catch (    Exception ee) {
    }
  }
}

Fixed version (ground truth):
public void transfer(String fromFile,String toFile) throws Exception {
  FileInputStream fis=null;
  String rfile=toFile;
  String lfile=fromFile;
  String command="String_Node_Str" + rfile;
  try {
    Channel channel=session.openChannel("String_Node_Str");
    ((ChannelExec)channel).setCommand(command);
    OutputStream out=channel.getOutputStream();
    InputStream in=channel.getInputStream();
    channel.connect();
    if (checkAck(in) != 0) {
      System.out.println("String_Node_Str");
    }
    long filesize=(new File(lfile)).length();
    command="String_Node_Str" + filesize + "String_Node_Str";
    if (lfile.lastIndexOf('/') > 0) {
      command+=lfile.substring(lfile.lastIndexOf('/') + 1);
    }
 else {
      command+=lfile;
    }
    command+="String_Node_Str";
    out.write(command.getBytes());
    out.flush();
    if (checkAck(in) != 0) {
      System.out.println("String_Node_Str");
    }
    fis=new FileInputStream(lfile);
    byte[] buf=new byte[1024];
    while (true) {
      int len=fis.read(buf,0,buf.length);
      if (len <= 0)       break;
      out.write(buf,0,len);
    }
    fis.close();
    fis=null;
    buf[0]=0;
    out.write(buf,0,1);
    out.flush();
    if (checkAck(in) != 0) {
      System.out.println("String_Node_Str");
    }
    out.close();
    channel.disconnect();
    session.disconnect();
  }
 catch (  Exception e) {
    try {
      if (fis != null)       fis.close();
    }
 catch (    Exception ee) {
    }
    throw e;
  }
}
Program: 92800
Project: 92800
Buggy source:
public ScpClient(){
  String user=ConsoleLogPlugin.getDefault().getPluginPreferences().getString(ConsoleLogPreferenceConstants.SCP_USER);
  String host=ConsoleLogPlugin.getDefault().getPluginPreferences().getString(ConsoleLogPreferenceConstants.HOST_NAME);
  try {
    JSch jsch=new JSch();
    session=jsch.getSession(user,host,22);
    session.setPassword(ConsoleLogPlugin.getDefault().getPluginPreferences().getString(ConsoleLogPreferenceConstants.SCP_PASSWORD));
    java.util.Properties config=new java.util.Properties();
    config.put("String_Node_Str","String_Node_Str");
    session.setConfig(config);
    session.connect();
  }
 catch (  Exception e) {
    e.printStackTrace(System.err);
    new ErrorMessage("String_Node_Str","String_Node_Str").open();
  }
}

Fixed version (ground truth):
public ScpClient() throws Exception {
  String user=ConsoleLogPlugin.getDefault().getPluginPreferences().getString(ConsoleLogPreferenceConstants.SCP_USER);
  String host=ConsoleLogPlugin.getDefault().getPluginPreferences().getString(ConsoleLogPreferenceConstants.HOST_NAME);
  try {
    JSch jsch=new JSch();
    session=jsch.getSession(user,host,22);
    session.setPassword(ConsoleLogPlugin.getDefault().getPluginPreferences().getString(ConsoleLogPreferenceConstants.SCP_PASSWORD));
    java.util.Properties config=new java.util.Properties();
    config.put("String_Node_Str","String_Node_Str");
    session.setConfig(config);
    session.connect();
  }
 catch (  Exception e) {
    e.printStackTrace(System.err);
    new ErrorMessage("String_Node_Str","String_Node_Str").open();
    throw e;
  }
}
Program: 92803
Project: 92803
Buggy source:
/** 
 * Return the top event in the events stack, determined by timestamp, in the trace (all the tracefiles). <p> Note : If the events were read before, the top event and the event currently loaded (currentEvent) are most likely the same.
 * @return The top event in the stack or null if no event is available.
 * @see org.eclipse.linuxtools.lttng.jni.JniEvent
 */
public JniEvent findNextEvent(){
  return eventsHeap.peek();
}

Fixed version (ground truth):
/** 
 * Return the top event in the events stack, determined by timestamp, in the trace (all the tracefiles). <p> Note : If the events were read before, the top event and the event currently loaded (currentEvent) are most likely the same.
 * @@return The top event in the stack or null if no event is available or if the heap is null.
 * @see org.eclipse.linuxtools.lttng.jni.JniEvent
 */
public JniEvent findNextEvent(){
  if (eventsHeap != null) {
    return eventsHeap.peek();
  }
  return null;
}
Program: 92804
Project: 92804
Buggy source:
@Override public void dispose(){
  currentJniTrace.closeTrace();
  super.dispose();
}

Fixed version (ground truth):
@Override public synchronized void dispose(){
  currentJniTrace.closeTrace();
  super.dispose();
}
Program: 92805
Project: 92805
Buggy source:
@Override public void handleCompleted(){
  nbRead[0]+=getNbRead();
  if (nbRead[0] >= request.getNbRequested() || (getNbRead() < CHUNK_SIZE[0])) {
    if (isCancelled()) {
      request.cancel();
    }
 else {
      request.done();
    }
    isFinished[0]=Boolean.TRUE;
  }
  super.handleCompleted();
}

Fixed version (ground truth):
@Override public void handleCompleted(){
  nbRead[0]+=getNbRead();
  if (nbRead[0] >= request.getNbRequested() || (getNbRead() < CHUNK_SIZE[0])) {
    if (this.isCancelled()) {
      request.cancel();
    }
 else     if (this.isFailed()) {
      request.fail();
    }
 else {
      request.done();
    }
    isFinished[0]=Boolean.TRUE;
  }
  super.handleCompleted();
}
Program: 92806
Project: 92806
Buggy source:
@Override public void run(){
  request.start();
  final Integer[] CHUNK_SIZE=new Integer[1];
  CHUNK_SIZE[0]=Math.min(request.getNbRequested(),blockSize + ((indexing) ? 1 : 0));
  final Integer[] nbRead=new Integer[1];
  nbRead[0]=0;
  final Boolean[] isFinished=new Boolean[1];
  isFinished[0]=Boolean.FALSE;
  while (!isFinished[0]) {
    TmfDataRequest<T> subRequest=new TmfDataRequest<T>(request.getDataType(),request.getIndex() + nbRead[0],CHUNK_SIZE[0],blockSize,ExecutionType.BACKGROUND){
      @Override public void handleData(      T data){
        super.handleData(data);
        request.handleData(data);
        if (getNbRead() > CHUNK_SIZE[0]) {
          System.out.println("String_Node_Str");
        }
      }
      @Override public void handleCompleted(){
        nbRead[0]+=getNbRead();
        if (nbRead[0] >= request.getNbRequested() || (getNbRead() < CHUNK_SIZE[0])) {
          if (isCancelled()) {
            request.cancel();
          }
 else {
            request.done();
          }
          isFinished[0]=Boolean.TRUE;
        }
        super.handleCompleted();
      }
    }
;
    if (!isFinished[0]) {
      queueRequest(subRequest);
      try {
        subRequest.waitForCompletion();
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
      CHUNK_SIZE[0]=Math.min(request.getNbRequested() - nbRead[0],blockSize);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  request.start();
  final Integer[] CHUNK_SIZE=new Integer[1];
  CHUNK_SIZE[0]=Math.min(request.getNbRequested(),blockSize + ((indexing) ? 1 : 0));
  final Integer[] nbRead=new Integer[1];
  nbRead[0]=0;
  final Boolean[] isFinished=new Boolean[1];
  isFinished[0]=Boolean.FALSE;
  while (!isFinished[0]) {
    TmfDataRequest<T> subRequest=new TmfDataRequest<T>(request.getDataType(),request.getIndex() + nbRead[0],CHUNK_SIZE[0],blockSize,ExecutionType.BACKGROUND){
      @Override public void handleData(      T data){
        super.handleData(data);
        request.handleData(data);
        if (getNbRead() > CHUNK_SIZE[0]) {
          System.out.println("String_Node_Str");
        }
      }
      @Override public void handleCompleted(){
        nbRead[0]+=getNbRead();
        if (nbRead[0] >= request.getNbRequested() || (getNbRead() < CHUNK_SIZE[0])) {
          if (this.isCancelled()) {
            request.cancel();
          }
 else           if (this.isFailed()) {
            request.fail();
          }
 else {
            request.done();
          }
          isFinished[0]=Boolean.TRUE;
        }
        super.handleCompleted();
      }
    }
;
    if (!isFinished[0]) {
      queueRequest(subRequest);
      try {
        subRequest.waitForCompletion();
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
      CHUNK_SIZE[0]=Math.min(request.getNbRequested() - nbRead[0],blockSize);
    }
  }
}
Program: 92809
Project: 92809
Buggy source:
@Override public void handleCompleted(){
  nbRead[0]+=this.getNbRead();
  if (nbRead[0] >= request.getNbRequested() || (this.getNbRead() < CHUNK_SIZE[0])) {
    if (isCancelled()) {
      request.cancel();
    }
 else {
      request.done();
    }
    isFinished[0]=Boolean.TRUE;
  }
  super.handleCompleted();
}

Fixed version (ground truth):
@Override public void handleCompleted(){
  nbRead[0]+=this.getNbRead();
  if (nbRead[0] >= request.getNbRequested() || (this.getNbRead() < CHUNK_SIZE[0])) {
    if (this.isCancelled()) {
      request.cancel();
    }
 else     if (this.isFailed()) {
      request.fail();
    }
 else {
      request.done();
    }
    isFinished[0]=Boolean.TRUE;
  }
  super.handleCompleted();
}
Program: 92811
Project: 92811
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public TmfCheckpoint restoreCheckPointByTimestamp(TmfTimestamp eventTime){
  TmfTimeRange experimentRange=fExperiment.getTimeRange();
  TmfCheckpoint checkpoint=new TmfCheckpoint(fTrace.getStartTime(),new TmfLocation<Long>(0L));
  if ((eventTime.getValue() < 0) || (eventTime.getValue() > experimentRange.getEndTime().getValue())) {
    return null;
  }
  if ((eventTime.getValue() < fTrace.getStartTime().getValue())) {
    eventTime=fTrace.getStartTime();
  }
  LttngTraceState traceState;
synchronized (fCheckPointsLock) {
    Collections.sort(timestampCheckpointsList);
    int index=Collections.binarySearch(timestampCheckpointsList,new TmfCheckpoint(eventTime,new TmfLocation<Long>(0L)));
    index=getPrevIndex(index);
    if (index == 0) {
      traceState=StateModelFactory.getStateEntryInstance(this);
    }
 else {
      checkpoint=timestampCheckpointsList.get(index);
      TmfLocation<Long> location=(TmfLocation<Long>)checkpoint.getLocation();
      traceState=stateCheckpointsList.get(location.getLocation()).clone();
    }
  }
synchronized (fStateModelLock) {
    fStateModel=traceState;
  }
  return checkpoint;
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public TmfCheckpoint restoreCheckPointByTimestamp(TmfTimestamp eventTime){
  TmfTimeRange experimentRange=fExperiment.getTimeRange();
  TmfCheckpoint checkpoint=new TmfCheckpoint(fTrace.getStartTime(),new TmfLocation<Long>(0L));
  if ((eventTime.getValue() < 0) || (!experimentRange.equals(TmfTimeRange.Null) && (eventTime.getValue() > experimentRange.getEndTime().getValue()))) {
    return null;
  }
  if ((eventTime.getValue() < fTrace.getStartTime().getValue())) {
    eventTime=fTrace.getStartTime();
  }
  LttngTraceState traceState;
synchronized (fCheckPointsLock) {
    Collections.sort(timestampCheckpointsList);
    int index=Collections.binarySearch(timestampCheckpointsList,new TmfCheckpoint(eventTime,new TmfLocation<Long>(0L)));
    index=getPrevIndex(index);
    if (index == 0) {
      traceState=StateModelFactory.getStateEntryInstance(this);
    }
 else {
      checkpoint=timestampCheckpointsList.get(index);
      TmfLocation<Long> location=(TmfLocation<Long>)checkpoint.getLocation();
      traceState=stateCheckpointsList.get(location.getLocation()).clone();
    }
  }
synchronized (fStateModelLock) {
    fStateModel=traceState;
  }
  return checkpoint;
}
Program: 92815
Project: 92815
Buggy source:
/** 
 * Registers as listener of time selection from other views
 * @param signal
 */
public void synchToTime(TmfTimeSynchSignal signal){
  if (synch) {
    Object source=signal.getSource();
    if (signal != null && source != null && source != this) {
      long selectedTime=signal.getCurrentTime().getValue();
      if (tsfviewer != null) {
        tsfviewer.setSelectedTime(selectedTime,true,source);
        ParamsUpdater paramUpdater=getParamsUpdater();
        Long savedSelTime=paramUpdater.getSelectedTime();
        if ((savedSelTime == null) || (savedSelTime != selectedTime)) {
          paramUpdater.setSelectedTime(selectedTime);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Registers as listener of time selection from other views
 * @param signal
 */
public void synchToTime(TmfTimeSynchSignal signal){
  if (synch) {
    Object source=signal.getSource();
    if (signal != null && source != null && source != this) {
      if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
        if (Display.getCurrent() != null) {
          long selectedTime=signal.getCurrentTime().getValue();
          if (tsfviewer != null) {
            tsfviewer.setSelectedTime(selectedTime,true,source);
            ParamsUpdater paramUpdater=getParamsUpdater();
            Long savedSelTime=paramUpdater.getSelectedTime();
            if ((savedSelTime == null) || (savedSelTime != selectedTime)) {
              paramUpdater.setSelectedTime(selectedTime);
            }
          }
        }
 else {
          final TmfTimeSynchSignal savedSignal=new TmfTimeSynchSignal(signal.getSource(),signal.getCurrentTime().clone());
          tsfviewer.getControl().getDisplay().asyncExec(new Runnable(){
            @Override public void run(){
              if ((tsfviewer != null) && (!tsfviewer.getControl().isDisposed())) {
                synchToTime(savedSignal);
              }
            }
          }
);
        }
      }
    }
  }
}
Program: 92816
Project: 92816
Buggy source:
/** 
 * @param tableComposite
 * @param table
 */
private synchronized void resizeTableColumns(Table table){
  if (table != null) {
    Composite parent=table.getParent();
    int tableWidthSum=parent.getBorderWidth();
    TableColumn[] columns=table.getColumns();
    for (    TableColumn column : columns) {
      column.pack();
      tableWidthSum+=column.getWidth();
    }
  }
}

Fixed version (ground truth):
/** 
 * @param tableComposite
 * @param table
 */
private synchronized void resizeTableColumns(Table table){
  if (table != null) {
    TableColumn[] columns=table.getColumns();
    for (    TableColumn column : columns) {
      column.pack();
    }
  }
}
Program: 92817
Project: 92817
Buggy source:
/** 
 * Moves to a certain message defined by timestamp in current page
 */
protected void moveToMessageInPage(){
  fLock.lock();
  try {
    TmfSyncMessage prevMessage=null;
    TmfSyncMessage syncMessage=null;
    boolean isExactTime=false;
    for (int i=0; i < fFrame.syncMessageCount(); i++) {
      if (fFrame.getSyncMessage(i) instanceof TmfSyncMessage) {
        syncMessage=(TmfSyncMessage)fFrame.getSyncMessage(i);
        if (syncMessage.getStartTime().compareTo(fCurrentTime,false) == 0) {
          isExactTime=true;
          break;
        }
 else         if (syncMessage.getStartTime().compareTo(fCurrentTime,false) > 0) {
          if (prevMessage != null) {
            syncMessage=prevMessage;
            break;
          }
        }
        prevMessage=syncMessage;
      }
    }
    if (fIsSelect && isExactTime) {
      fView.getSDWidget().moveTo(syncMessage);
    }
 else {
      fView.getSDWidget().ensureVisible(syncMessage);
      fView.getSDWidget().clearSelection();
      fView.getSDWidget().redraw();
    }
  }
  finally {
    fLock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Moves to a certain message defined by timestamp in current page
 */
protected void moveToMessageInPage(){
  fLock.lock();
  try {
    if (!fView.getSDWidget().isDisposed()) {
      if (Display.getCurrent() != null) {
        TmfSyncMessage prevMessage=null;
        TmfSyncMessage syncMessage=null;
        boolean isExactTime=false;
        for (int i=0; i < fFrame.syncMessageCount(); i++) {
          if (fFrame.getSyncMessage(i) instanceof TmfSyncMessage) {
            syncMessage=(TmfSyncMessage)fFrame.getSyncMessage(i);
            if (syncMessage.getStartTime().compareTo(fCurrentTime,false) == 0) {
              isExactTime=true;
              break;
            }
 else             if (syncMessage.getStartTime().compareTo(fCurrentTime,false) > 0) {
              if (prevMessage != null) {
                syncMessage=prevMessage;
                break;
              }
            }
            prevMessage=syncMessage;
          }
        }
        if (fIsSelect && isExactTime) {
          fView.getSDWidget().moveTo(syncMessage);
        }
 else {
          fView.getSDWidget().ensureVisible(syncMessage);
          fView.getSDWidget().clearSelection();
          fView.getSDWidget().redraw();
        }
      }
 else {
        fView.getSDWidget().getDisplay().asyncExec(new Runnable(){
          @Override public void run(){
            moveToMessageInPage();
          }
        }
);
      }
    }
  }
  finally {
    fLock.unlock();
  }
}
Program: 92818
Project: 92818
Buggy source:
public void refreshView(){
  if (messages != null) {
    messagesViewer.getTreeViewer().setInput(messages);
    if (hasDynamicContent && messages.length == 0) {
      showCoreAction.setEnabled(false);
      showToolPage();
    }
 else {
      showCoreAction.setEnabled(true);
      showCorePage();
    }
  }
  if (dynamicView != null) {
    dynamicView.refreshView();
  }
}

Fixed version (ground truth):
public void refreshView(){
  if (messages != null) {
    messagesViewer.getTreeViewer().setInput(messages);
    if (hasDynamicContent && messages[0] instanceof ValgrindInfo) {
      showCoreAction.setEnabled(false);
      showToolPage();
    }
 else {
      showCoreAction.setEnabled(true);
      showCorePage();
    }
  }
  if (dynamicView != null) {
    dynamicView.refreshView();
  }
}
Program: 92819
Project: 92819
Buggy source:
public IValgrindToolView createDynamicContent(String description,String toolID) throws CoreException {
  setContentDescription(description);
  IToolBarManager toolbar=getViewSite().getActionBars().getToolBarManager();
  if (dynamicActions != null) {
    for (    ActionContributionItem item : dynamicActions) {
      toolbar.remove(item);
    }
  }
  if (dynamicView != null) {
    dynamicView.dispose();
  }
  for (  Control child : dynamicViewHolder.getChildren()) {
    if (!child.isDisposed()) {
      child.dispose();
    }
  }
  if (toolID != null) {
    dynamicView=ValgrindUIPlugin.getDefault().getToolView(toolID);
    dynamicView.createPartControl(dynamicViewHolder);
    IAction[] actions=dynamicView.getToolbarActions();
    if (actions != null) {
      dynamicActions=new ActionContributionItem[actions.length];
      for (int i=0; i < actions.length; i++) {
        dynamicActions[i]=new ActionContributionItem(actions[i]);
        toolbar.appendToGroup(ValgrindUIPlugin.TOOLBAR_LOC_GROUP_ID,dynamicActions[i]);
      }
    }
  }
 else {
    dynamicView=null;
  }
  IMenuManager menu=getViewSite().getActionBars().getMenuManager();
  menu.removeAll();
  hasDynamicContent=dynamicViewHolder.getChildren().length > 0;
  if (hasDynamicContent) {
    menu.add(showCoreAction);
    menu.add(showToolAction);
  }
  menu.update(true);
  toolbar.update(true);
  dynamicViewHolder.layout(true);
  return dynamicView;
}

Fixed version (ground truth):
public IValgrindToolView createDynamicContent(String description,String toolID) throws CoreException {
  setContentDescription(description);
  IToolBarManager toolbar=getViewSite().getActionBars().getToolBarManager();
  if (dynamicActions != null) {
    for (    ActionContributionItem item : dynamicActions) {
      toolbar.remove(item);
    }
  }
  if (dynamicView != null) {
    dynamicView.dispose();
  }
  if (messages != null) {
    messagesViewer.getTreeViewer().setInput(null);
    messages=null;
  }
  for (  Control child : dynamicViewHolder.getChildren()) {
    if (!child.isDisposed()) {
      child.dispose();
    }
  }
  if (toolID != null) {
    dynamicView=ValgrindUIPlugin.getDefault().getToolView(toolID);
    dynamicView.createPartControl(dynamicViewHolder);
    IAction[] actions=dynamicView.getToolbarActions();
    if (actions != null) {
      dynamicActions=new ActionContributionItem[actions.length];
      for (int i=0; i < actions.length; i++) {
        dynamicActions[i]=new ActionContributionItem(actions[i]);
        toolbar.appendToGroup(ValgrindUIPlugin.TOOLBAR_LOC_GROUP_ID,dynamicActions[i]);
      }
    }
  }
 else {
    dynamicView=null;
  }
  IMenuManager menu=getViewSite().getActionBars().getMenuManager();
  menu.removeAll();
  hasDynamicContent=dynamicViewHolder.getChildren().length > 0;
  if (hasDynamicContent) {
    menu.add(showCoreAction);
    menu.add(showToolAction);
  }
  menu.update(true);
  toolbar.update(true);
  dynamicViewHolder.layout(true);
  return dynamicView;
}
Program: 92820
Project: 92820
Buggy source:
public ImportTraceWizardPage(IWorkbench workbench,IStructuredSelection selection){
  super(workbench,selection);
  LTTngProjectNode folder=(LTTngProjectNode)selection.getFirstElement();
  project=folder.getProject();
  String path=folder.getTracesFolder().getFolder().getFullPath().toOSString();
  initialContainerString=path;
  setContainerFieldValue(path);
}

Fixed version (ground truth):
public ImportTraceWizardPage(IWorkbench workbench,IStructuredSelection selection){
  super(workbench,selection);
  project=(IProject)selection.getFirstElement();
  IFolder folder=project.getFolder(LTTngProjectNode.TRACE_FOLDER_NAME);
  if (folder == null) {
    MessageDialog.openError(getShell(),Messages.ImportTrace_ErrorTitle,Messages.ImportTrace_InvalidProject);
  }
  String path=folder.getFullPath().toOSString();
  initialContainerString=path;
  setContainerFieldValue(path);
}
Program: 92823
Project: 92823
Buggy source:
/** 
 * Open an existing trace. <p> The tracepath should have been set already,
 * @exception JniOpenTraceFailedException Thrown if the open failed
 */
public void openTrace() throws JniException {
  if (tracepath == "String_Node_Str") {
    throw new JniTraceException("String_Node_Str");
  }
  if (thisTracePtr.getPointer() != NULL) {
    closeTrace();
  }
  int newLibraryId=initializeLibrary();
  if (newLibraryId != -1) {
    long newPtr=NULL;
    try {
      newPtr=ltt_openTraceLive(newLibraryId,tracepath,printLttDebug);
    }
 catch (    UnsatisfiedLinkError e) {
    }
    if (newPtr == NULL) {
      isLiveTraceSupported=false;
      newPtr=ltt_openTrace(newLibraryId,tracepath,printLttDebug);
    }
    if (newPtr == NULL) {
      thisTracePtr=new Jni_C_Pointer_And_Library_Id();
      throw new JniOpenTraceFailedException("String_Node_Str");
    }
    thisTracePtr=new Jni_C_Pointer_And_Library_Id(newLibraryId,newPtr);
    populateTraceInformation();
  }
 else {
    thisTracePtr=new Jni_C_Pointer_And_Library_Id();
    throw new JniTraceException("String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Open an existing trace. <p> The tracepath should have been set already,
 * @exception JniOpenTraceFailedException Thrown if the open failed
 */
public void openTrace() throws JniException {
  if (tracepath == "String_Node_Str") {
    throw new JniTraceException("String_Node_Str");
  }
  if (thisTracePtr.getPointer() != NULL) {
    closeTrace();
  }
  int newLibraryId=initializeLibrary();
  if (newLibraryId != -1) {
    long newPtr=NULL;
    try {
      newPtr=ltt_openTraceLive(newLibraryId,tracepath,printLttDebug);
    }
 catch (    UnsatisfiedLinkError e) {
    }
    if (newPtr == NULL) {
      isLiveTraceSupported=false;
      newPtr=ltt_openTrace(newLibraryId,tracepath,printLttDebug);
    }
    if (newPtr == NULL) {
      thisTracePtr=new Jni_C_Pointer_And_Library_Id();
      throw new JniOpenTraceFailedException("String_Node_Str");
    }
    thisTracePtr=new Jni_C_Pointer_And_Library_Id(newLibraryId,newPtr);
    populateTraceInformation();
  }
 else {
    thisTracePtr=new Jni_C_Pointer_And_Library_Id();
    throw new JniTraceException("String_Node_Str" + getTraceLibFullPath() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  }
}
Program: 92824
Project: 92824
Buggy source:
/** 
 * Function place holder to load the correct C library. <p> <br> Can be as simple as calling ltt_initializeHandle(LIBRARY_NAME) with the correct .so instead of LIBRARY_NAME.<br> You may also want to perform some check or some additionnal validations.<br> <br> <b>!! Override this with you version specific implementation.</b><br>
 * @return integer that is the library id, or -1 if the load wasunsuccessful
 */
public abstract int initializeLibrary();

Fixed version (ground truth):
/** 
 * Initialize the C library. <p> Call the library loader with the .so we wish to load.
 * @return The library id if successful, -1 if something went wrong
 */
public int initializeLibrary(){
  return ltt_initializeHandle(getTraceLibFullPath());
}