nus-yam/ex-repair huggingface dataset:
Program: 135964
Project: 135964
Buggy source:
public void run(){
  ObligationsView.refreshObligationView();
}

Fixed version (ground truth):
public void run(){
  if (nodeToProve != null) {
    module=(IFile)ResourceHelper.getResourceByModuleName(nodeToProve.getLocation().source());
    return;
  }
  TLAEditor editor=EditorUtil.getTLAEditorWithFocus();
  Assert.isNotNull(editor,"String_Node_Str");
  module=((FileEditorInput)editor.getEditorInput()).getFile();
  ParseResult parseResult=ResourceHelper.getValidParseResult(module);
  if (parseResult == null) {
    parseResult=new ModuleParserLauncher().parseModule(module,new NullProgressMonitor());
  }
  if (parseResult.getStatus() != IParseConstants.PARSED) {
    return;
  }
  String moduleName=ResourceHelper.getModuleName(module);
  IDocument document=editor.getDocumentProvider().getDocument(editor.getEditorInput());
  nodeToProve=ResourceHelper.getPfStepOrUseHideFromMod(parseResult,moduleName,(ITextSelection)editor.getSelectionProvider().getSelection(),document);
  if (nodeToProve == null) {
    nodeToProve=parseResult.getSpecObj().getExternalModuleTable().getModuleNode(UniqueString.uniqueStringOf(moduleName));
    return;
  }
}
Program: 135966
Project: 135966
Buggy source:
/** 
 * Constructor taking the path to the module for which there is output, the monitor that can be used to report information about progress, and the description of the prover launch. This contains information about the parameters used to launch the prover.
 * @param moduleFile
 * @param monitor
 * @param description the description of the prover launch. Contains information aboutthe parameters used to launch the prover.
 */
public void initializeSink(IFile moduleFile,ProverLaunchDescription description,IProgressMonitor monitor){
  currentMessageBuffer=new StringBuilder();
  this.moduleFile=moduleFile;
  this.monitor=monitor;
  this.description=description;
}

Fixed version (ground truth):
/** 
 * Constructor taking the path to the module for which there is output, the monitor that can be used to report information about progress, and the description of the prover launch. This contains information about the parameters used to launch the prover.
 * @param moduleFile
 * @param monitor
 * @param description the description of the prover launch. Contains information aboutthe parameters used to launch the prover.
 */
public void initializeSink(IFile moduleFile,ProverLaunchDescription description,IProgressMonitor monitor){
  currentSearchTextBuffer=new StringBuilder();
  this.moduleFile=moduleFile;
  this.monitor=monitor;
  this.description=description;
}
Program: 135968
Project: 135968
Buggy source:
/** 
 * Creates an error without any replacement of text from the error message reported by TLC.
 */
protected TLCError createError(TLCRegion tlcRegion,IDocument tlcOutputDocument){
  TLCError topError=new TLCError();
  if (tlcRegion instanceof TLCRegionContainer) {
    TLCRegionContainer container=(TLCRegionContainer)tlcRegion;
    ITypedRegion[] regions=container.getSubRegions();
    Assert.isTrue(regions.length < 3,"String_Node_Str");
    for (int i=0; i < regions.length; i++) {
      if (regions[i] instanceof TLCRegion) {
        TLCError cause=createError((TLCRegion)regions[i],tlcOutputDocument);
        topError.setCause(cause);
      }
 else {
        try {
          topError.setMessage(tlcOutputDocument.get(tlcRegion.getOffset(),tlcRegion.getLength()));
          topError.setErrorCode(tlcRegion.getMessageCode());
        }
 catch (        BadLocationException e) {
          TLCUIActivator.logError("String_Node_Str",e);
        }
      }
    }
  }
  return topError;
}

Fixed version (ground truth):
/** 
 * Creates an error without any replacement of text from the error message reported by TLC. This overrides the method in TLCModelLaunchDataProvider because that method does a lot of work to search for Strings such as inv_2354234343434 in the error message and replace them with the actual invariant from the MC.tla file. The user should never see anything from the TE file, so this work is unnecessary for the trace explorer. <br>This is a factory method
 * @param tlcRegion a region marking the error information in the document
 * @param message the message represented by the region
 * @return the TLC Error representing the error
 */
protected TLCError createError(TLCRegion tlcRegion,String message){
  TLCError topError=new TLCError();
  if (tlcRegion instanceof TLCRegionContainer) {
    TLCRegionContainer container=(TLCRegionContainer)tlcRegion;
    ITypedRegion[] regions=container.getSubRegions();
    Assert.isTrue(regions.length < 3,"String_Node_Str");
    for (int i=0; i < regions.length; i++) {
      if (regions[i] instanceof TLCRegion) {
        TLCError cause=createError((TLCRegion)regions[i],message);
        topError.setCause(cause);
      }
 else {
        topError.setMessage(message);
        topError.setErrorCode(tlcRegion.getMessageCode());
      }
    }
  }
  return topError;
}
Program: 135971
Project: 135971
Buggy source:
/** 
 * If parseResult's status is not equal to PARSED, returns null.  Else, it tries to find a   {@link LevelNode}representing a proof step or a top level USE/HIDE node in module moduleName "at" the point textSelection.  More precisely, the caret is at a LevelNode if the level node is the innermost proof step or USE/HIDE node whose step or proof contains the line with the caret and that is first on the line containing the caret. That is, if there is more than one proof and/or step on the line with the caret, this method returns the first on the line. The method assumes that document is the document for the module.
 * @param parseResult
 * @param moduleName
 * @param textSelection
 * @param document
 * @return
 */
public static LevelNode getPfStepOrUseHideFromMod(ParseResult parseResult,String moduleName,ITextSelection textSelection,IDocument document){
  try {
    if ((parseResult == null) || (parseResult.getStatus() != IParseConstants.PARSED)) {
      return null;
    }
    ModuleNode module=parseResult.getSpecObj().getExternalModuleTable().getModuleNode(UniqueString.uniqueStringOf(moduleName));
    if (module == null) {
      return null;
    }
    LevelNode[] topLevelNodes=module.getTopLevel();
    for (int i=0; i < topLevelNodes.length; i++) {
      if (topLevelNodes[i].getLocation().source().equals(moduleName)) {
        LevelNode node=getLevelNodeFromTree(topLevelNodes[i],document.getLineOfOffset(textSelection.getOffset()) + 1);
        if (node != null) {
          return node;
        }
      }
    }
  }
 catch (  BadLocationException e) {
    Activator.logError("String_Node_Str",e);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * If parseResult's status is not equal to PARSED, returns null.  Else, it tries to find a   {@link LevelNode}representing a proof step or a top level USE/HIDE node in module moduleName "at" the point textSelection.  More precisely, the caret is at a LevelNode if the level node is the innermost proof step or USE/HIDE node whose step or proof contains the line with the caret and that is first on the line containing the caret. That is, if there is more than one proof and/or step on the line with the caret, this method returns the first on the line. The method assumes that document is the document for the module. Returns null if no step is found.
 * @param parseResult
 * @param moduleName
 * @param textSelection
 * @param document
 * @return
 */
public static LevelNode getPfStepOrUseHideFromMod(ParseResult parseResult,String moduleName,ITextSelection textSelection,IDocument document){
  try {
    if ((parseResult == null) || (parseResult.getStatus() != IParseConstants.PARSED)) {
      return null;
    }
    ModuleNode module=parseResult.getSpecObj().getExternalModuleTable().getModuleNode(UniqueString.uniqueStringOf(moduleName));
    return getPfStepOrUseHideFromModuleNode(module,document.getLineOfOffset(textSelection.getOffset()) + 1);
  }
 catch (  BadLocationException e) {
    Activator.logError("String_Node_Str",e);
  }
  return null;
}
Program: 135973
Project: 135973
Buggy source:
/** 
 * Parses the location string returned by the prover into an instance of   {@link Location}. Null if parsing is unsuccessful.
 * @param locString
 * @return
 */
protected static Location parseLocation(String locString,String moduleName){
  try {
    String[] coordinates=locString.split("String_Node_Str");
    Assert.isTrue(coordinates.length >= 4,"String_Node_Str" + locString);
    return new Location(UniqueString.uniqueStringOf(moduleName),Integer.parseInt(coordinates[0]),Integer.parseInt(coordinates[1]),Integer.parseInt(coordinates[2]),Integer.parseInt(coordinates[3]));
  }
 catch (  NumberFormatException e) {
    ProverUIActivator.logError("String_Node_Str" + locString,e);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Parses the location string returned by the prover into an instance of   {@link Location}. Null if parsing is unsuccessful.
 * @param locString
 * @return
 */
protected static Location parseLocation(String locString,String moduleName){
  try {
    String[] coordinates=locString.split("String_Node_Str");
    Assert.isTrue(coordinates.length >= 4,"String_Node_Str" + locString);
    return new Location(UniqueString.uniqueStringOf(moduleName),Integer.parseInt(coordinates[0]),Integer.parseInt(coordinates[1]),Integer.parseInt(coordinates[2]),Integer.parseInt(coordinates[3]) - 1);
  }
 catch (  NumberFormatException e) {
    ProverUIActivator.logError("String_Node_Str" + locString,e);
  }
  return null;
}
Program: 135983
Project: 135983
Buggy source:
/** 
 * Refreshes the editor. This currently just involves checking if the prover is running on the module. If it is, the editor is set to be read only. If it isn't, the editor is set to be editable.
 */
private void refresh(){
  if (getSourceViewer() != null) {
    getSourceViewer().setEditable(!EditorUtil.isReadOnly(((FileEditorInput)getEditorInput()).getFile()));
  }
}

Fixed version (ground truth):
/** 
 * Refreshes the editor. This currently just involves checking if the resource has been marked read-only by   {@link EditorUtil#setReadOnly(org.eclipse.core.resources.IResource,boolean)}. If it is, the editor is set to be read only. If it isn't, the editor is set to be editable.
 */
private void refresh(){
  if (getSourceViewer() != null) {
    getSourceViewer().setEditable(!EditorUtil.isReadOnly(((FileEditorInput)getEditorInput()).getFile()));
  }
}
Program: 135984
Project: 135984
Buggy source:
public void createPartControl(Composite parent){
  super.createPartControl(parent);
  ProjectionViewer viewer=(ProjectionViewer)getSourceViewer();
  projectionSupport=new ProjectionSupport(viewer,getAnnotationAccess(),getSharedColors());
  projectionSupport.addSummarizableAnnotationType("String_Node_Str");
  projectionSupport.addSummarizableAnnotationType("String_Node_Str");
  projectionSupport.install();
  viewer.doOperation(ProjectionViewer.TOGGLE);
  this.annotationModel=viewer.getProjectionAnnotationModel();
  this.visualAnnotationModel=viewer.getAnnotationModel();
  this.proofStructureProvider=new TLAProofFoldingStructureProvider(this);
}

Fixed version (ground truth):
public void createPartControl(Composite parent){
  super.createPartControl(parent);
  ProjectionViewer viewer=(ProjectionViewer)getSourceViewer();
  projectionSupport=new ProjectionSupport(viewer,getAnnotationAccess(),getSharedColors());
  projectionSupport.addSummarizableAnnotationType("String_Node_Str");
  projectionSupport.addSummarizableAnnotationType("String_Node_Str");
  projectionSupport.install();
  viewer.doOperation(ProjectionViewer.TOGGLE);
  this.annotationModel=viewer.getProjectionAnnotationModel();
  this.visualAnnotationModel=viewer.getAnnotationModel();
  this.proofStructureProvider=new TLAProofFoldingStructureProvider(this);
  refresh();
}
Program: 135988
Project: 135988
Buggy source:
private int[] detectLocation(String message){
  String LINE="String_Node_Str";
  String COLUMN="String_Node_Str";
  int lineStarts=message.indexOf(LINE);
  int lineEnds=message.indexOf(COLUMN);
  if (lineStarts != -1 && lineEnds != -1) {
    String line=message.substring(lineStarts + LINE.length(),lineEnds);
    String column=message.substring(lineEnds + COLUMN.length());
    int lineNumber=-1;
    int columnNumber=-1;
    try {
      lineNumber=Integer.parseInt(line);
    }
 catch (    NumberFormatException e) {
    }
    try {
      columnNumber=Integer.parseInt(column);
    }
 catch (    NumberFormatException e) {
    }
    return new int[]{lineNumber,columnNumber,lineNumber,columnNumber + 1};
  }
  return new int[]{-1,-1,-1,-1};
}

Fixed version (ground truth):
private int[] detectLocation(String message){
  String LINE="String_Node_Str";
  String COLUMN="String_Node_Str";
  int lineStarts=message.indexOf(LINE);
  int lineEnds=message.indexOf(COLUMN);
  if (lineStarts != -1 && lineEnds != -1) {
    String line=message.substring(lineStarts + LINE.length(),lineEnds);
    String afterColumnString=message.substring(lineEnds + COLUMN.length());
    Matcher matcher=Pattern.compile("String_Node_Str").matcher(afterColumnString);
    Assert.isTrue(matcher.find(),"String_Node_Str" + message);
    String column=matcher.group().trim();
    int lineNumber=-1;
    int columnNumber=-1;
    try {
      lineNumber=Integer.parseInt(line);
    }
 catch (    NumberFormatException e) {
    }
    try {
      columnNumber=Integer.parseInt(column);
    }
 catch (    NumberFormatException e) {
    }
    return new int[]{lineNumber,columnNumber,lineNumber,columnNumber + 1};
  }
  return new int[]{-1,-1,-1,-1};
}
Program: 135997
Project: 135997
Buggy source:
public ObligationsView(){
  items=new HashMap();
}

Fixed version (ground truth):
public ObligationsView(){
  items=new HashMap();
  viewers=new HashMap();
}
Program: 136000
Project: 136000
Buggy source:
protected void addPages(){
  try {
    if (getContainer() instanceof CTabFolder) {
      ((CTabFolder)getContainer()).setTabPosition(SWT.TOP);
    }
    for (int i=0; i < pagesToAdd.length; i++) {
      addPage(pagesToAdd[i]);
      if (pagesToAdd[i].getPartControl() == null) {
        pagesToAdd[i].createPartControl(getContainer());
        setControl(i,pagesToAdd[i].getPartControl());
        pagesToAdd[i].getPartControl().setMenu(getContainer().getMenu());
      }
    }
    UIHelper.runUIAsync(validateRunable);
  }
 catch (  PartInitException e) {
    TLCUIActivator.logError("String_Node_Str",e);
  }
  ModuleNode rootModule=SemanticHelper.getRootModuleNode();
  if (rootModule != null && rootModule.getVariableDecls().length == 0 && rootModule.getConstantDecls().length == 0) {
    showResultPage();
  }
}

Fixed version (ground truth):
protected void addPages(){
  try {
    if (getContainer() instanceof CTabFolder) {
      ((CTabFolder)getContainer()).setTabPosition(SWT.TOP);
      ((CTabFolder)getContainer()).addCTabFolder2Listener(listener);
    }
 else {
      TLCUIActivator.logDebug("String_Node_Str");
    }
    for (int i=0; i < pagesToAdd.length; i++) {
      addPage(pagesToAdd[i]);
      if (pagesToAdd[i].getPartControl() == null) {
        pagesToAdd[i].createPartControl(getContainer());
        setControl(i,pagesToAdd[i].getPartControl());
        pagesToAdd[i].getPartControl().setMenu(getContainer().getMenu());
      }
    }
    UIHelper.runUIAsync(validateRunable);
  }
 catch (  PartInitException e) {
    TLCUIActivator.logError("String_Node_Str",e);
  }
  ModuleNode rootModule=SemanticHelper.getRootModuleNode();
  if (rootModule != null && rootModule.getVariableDecls().length == 0 && rootModule.getConstantDecls().length == 0) {
    showResultPage();
  }
}
Program: 136002
Project: 136002
Buggy source:
public Object getAdapter(Class required){
  if (projectionSupport != null) {
    Object adapter=projectionSupport.getAdapter(getSourceViewer(),required);
    if (adapter != null)     return adapter;
  }
  return super.getAdapter(required);
}

Fixed version (ground truth):
public Object getAdapter(Class required){
  if (projectionSupport != null) {
    Object adapter=projectionSupport.getAdapter(getSourceViewer(),required);
    if (adapter != null)     return adapter;
  }
  if (ISelectionProvider.class.equals(required)) {
    return getSelectionProvider();
  }
  return super.getAdapter(required);
}
Program: 136004
Project: 136004
Buggy source:
public void launch(ILaunchConfiguration configuration,String mode,ILaunch launch,IProgressMonitor monitor) throws CoreException {
  System.out.println("String_Node_Str");
  if (!MODE_TRACE_EXPLORE.equals(mode)) {
    throw new CoreException(new Status(IStatus.ERROR,TLCActivator.PLUGIN_ID,"String_Node_Str" + mode));
  }
  IProject project=ResourceHelper.getProject(specName);
  if (project == null) {
    throw new CoreException(new Status(IStatus.ERROR,TLCActivator.PLUGIN_ID,"String_Node_Str" + specName));
  }
  TLCJob tlcjob=new TLCProcessJob(specName,modelName,launch);
  tlcjob.setWorkers(1);
  tlcjob.setPriority(Job.LONG);
  tlcjob.setUser(true);
  tlcjob.setRule(mutexRule);
  tlcjob.schedule();
}

Fixed version (ground truth):
public void launch(ILaunchConfiguration configuration,String mode,ILaunch launch,IProgressMonitor monitor) throws CoreException {
  System.out.println("String_Node_Str");
  if (!MODE_TRACE_EXPLORE.equals(mode)) {
    throw new CoreException(new Status(IStatus.ERROR,TLCActivator.PLUGIN_ID,"String_Node_Str" + mode));
  }
  IProject project=ResourceHelper.getProject(specName);
  if (project == null) {
    throw new CoreException(new Status(IStatus.ERROR,TLCActivator.PLUGIN_ID,"String_Node_Str" + specName));
  }
  TLCJob tlcjob=new TraceExplorerJob(specName,modelName,launch);
  tlcjob.setWorkers(1);
  tlcjob.setPriority(Job.SHORT);
  tlcjob.setUser(true);
  tlcjob.setRule(mutexRule);
  tlcjob.schedule();
}
Program: 136006
Project: 136006
Buggy source:
/** 
 * Writes current unique string to the stream
 * @param dos
 * @return
 * @throws IOException
 */
public final void write(BufferedDataOutputStream dos) throws IOException {
  dos.writeInt(this.tok);
  dos.writeInt(this.loc);
  dos.writeInt(this.s.length());
  dos.writeString(this.s);
}

Fixed version (ground truth):
/** 
 * Writes current unique string to the stream
 * @param dos
 * @return
 * @throws IOException
 */
public final void write(BufferedDataOutputStream dos) throws IOException {
  dos.writeInt(this.tok);
  dos.writeInt(this.getVarLoc());
  dos.writeInt(this.s.length());
  dos.writeString(this.s);
}
Program: 136008
Project: 136008
Buggy source:
public final boolean getTrace(){
  String rfname=this.traceFile + this.ticnt;
  File tfile=new File(rfname);
  ToolIO.out.println("String_Node_Str" + tfile + "String_Node_Str");
  if (!tfile.exists())   return false;
  SpecObj spec=new SpecObj(rfname,null);
  try {
    SANY.frontEndInitialize(spec,ToolIO.out);
    SANY.frontEndParse(spec,ToolIO.out);
    SANY.frontEndSemanticAnalysis(spec,ToolIO.out,true);
  }
 catch (  Throwable e) {
    String msg=e.getMessage();
    Assert.fail(EC.CHECK_COULD_NOT_READ_TRACE,msg);
  }
  if (!spec.initErrors.isSuccess() || !spec.parseErrors.isSuccess() || !spec.semanticErrors.isSuccess()) {
    Assert.fail(EC.TLC_PARSING_FAILED);
  }
  ExternalModuleTable mt=spec.getExternalModuleTable();
  ModuleNode module=mt.getModuleNode(UniqueString.uniqueStringOf(rfname));
  OpDefNode[] opDefs=module.getOpDefs();
  int len=opDefs.length;
  this.states=new TLCState[len];
  for (int i=0; i < len; i++) {
    TLCState state=this.tool.makeState(opDefs[i].getBody());
    this.states[i]=state;
  }
  this.sidx=0;
  this.ticnt++;
  return true;
}

Fixed version (ground truth):
public final boolean getTrace(){
  String rfname=this.traceFile + this.ticnt;
  File tfile=new File(rfname);
  ToolIO.out.println("String_Node_Str" + tfile + "String_Node_Str");
  if (!tfile.exists())   return false;
  SpecObj spec=new SpecObj(rfname,null);
  try {
    SANY.frontEndInitialize(spec,ToolIO.out);
    SANY.frontEndParse(spec,ToolIO.out);
    SANY.frontEndSemanticAnalysis(spec,ToolIO.out,true);
  }
 catch (  Throwable e) {
    String msg=(e.getMessage() == null) ? e.toString() : e.getMessage();
    Assert.fail(EC.CHECK_COULD_NOT_READ_TRACE,msg);
  }
  if (!spec.initErrors.isSuccess() || !spec.parseErrors.isSuccess() || !spec.semanticErrors.isSuccess()) {
    Assert.fail(EC.TLC_PARSING_FAILED);
  }
  ExternalModuleTable mt=spec.getExternalModuleTable();
  ModuleNode module=mt.getModuleNode(UniqueString.uniqueStringOf(rfname));
  OpDefNode[] opDefs=module.getOpDefs();
  int len=opDefs.length;
  this.states=new TLCState[len];
  for (int i=0; i < len; i++) {
    TLCState state=this.tool.makeState(opDefs[i].getBody());
    this.states[i]=state;
  }
  this.sidx=0;
  this.ticnt++;
  return true;
}
Program: 136012
Project: 136012
Buggy source:
/** 
 * This method attempts to load the java class with the given name.
 */
public synchronized Class loadClass(String name){
  Class cl=null;
  try {
    try {
      cl=Class.forName(name);
    }
 catch (    Exception e) {
    }
    if (cl == null) {
      try {
        cl=Class.forName(this.pkg + name);
      }
 catch (      Exception e) {
      }
    }
  }
 catch (  Throwable e) {
    Assert.fail(EC.TLC_ERROR_REPLACING_MODULES,new String[]{name,e.getMessage()});
  }
  return cl;
}

Fixed version (ground truth):
/** 
 * This method attempts to load the java class with the given name.
 */
public synchronized Class loadClass(String name){
  Class cl=null;
  try {
    try {
      cl=Class.forName(name);
    }
 catch (    Exception e) {
    }
    if (cl == null) {
      try {
        cl=Class.forName(this.pkg + name);
      }
 catch (      Exception e) {
      }
    }
  }
 catch (  Throwable e) {
    Assert.fail(EC.TLC_ERROR_REPLACING_MODULES,new String[]{name,(e.getMessage() == null) ? e.toString() : e.getMessage()});
  }
  return cl;
}
Program: 136013
Project: 136013
Buggy source:
/** 
 * This method gets a state from the queue, generates all the possible next states of the state, checks the invariants, and updates the state set and state queue.
 */
public final void run(){
  TLCState curState=null;
  try {
    while (true) {
      curState=(TLCState)this.squeue.sDequeue();
      if (curState == null) {
synchronized (this.tlc) {
          this.tlc.setDone();
          this.tlc.notify();
        }
        this.squeue.finishAll();
        return;
      }
      if (this.tlc.doNext(curState,this.astCounts))       return;
    }
  }
 catch (  Throwable e) {
synchronized (this.tlc) {
      if (this.tlc.setErrState(curState,null,true)) {
        MP.printError(EC.GENERAL,e.getMessage());
      }
      this.squeue.finishAll();
      this.tlc.notify();
    }
    return;
  }
}

Fixed version (ground truth):
/** 
 * This method gets a state from the queue, generates all the possible next states of the state, checks the invariants, and updates the state set and state queue.
 */
public final void run(){
  TLCState curState=null;
  try {
    while (true) {
      curState=(TLCState)this.squeue.sDequeue();
      if (curState == null) {
synchronized (this.tlc) {
          this.tlc.setDone();
          this.tlc.notify();
        }
        this.squeue.finishAll();
        return;
      }
      if (this.tlc.doNext(curState,this.astCounts))       return;
    }
  }
 catch (  Throwable e) {
synchronized (this.tlc) {
      if (this.tlc.setErrState(curState,null,true)) {
        MP.printError(EC.GENERAL,(e.getMessage() == null) ? e.toString() : e.getMessage());
      }
      this.squeue.finishAll();
      this.tlc.notify();
    }
    return;
  }
}
Program: 136014
Project: 136014
Buggy source:
public final void run(){
  try {
    while (true) {
      int idx=getNextOOS();
      if (idx == -1 || hasErrFound())       break;
      this.oos=LiveCheck.solutions[idx];
      this.dg=LiveCheck.dgraphs[idx];
      this.dg.createCache();
      PossibleErrorModel[] pems=this.oos.pems;
      for (int i=0; i < pems.length; i++) {
        if (!hasErrFound()) {
          this.pem=pems[i];
          this.checkSccs();
        }
      }
      this.dg.destroyCache();
    }
  }
 catch (  Exception e) {
    MP.printError(EC.GENERAL,e.getMessage());
    return;
  }
}

Fixed version (ground truth):
public final void run(){
  try {
    while (true) {
      int idx=getNextOOS();
      if (idx == -1 || hasErrFound())       break;
      this.oos=LiveCheck.solutions[idx];
      this.dg=LiveCheck.dgraphs[idx];
      this.dg.createCache();
      PossibleErrorModel[] pems=this.oos.pems;
      for (int i=0; i < pems.length; i++) {
        if (!hasErrFound()) {
          this.pem=pems[i];
          this.checkSccs();
        }
      }
      this.dg.destroyCache();
    }
  }
 catch (  Exception e) {
    MP.printError(EC.GENERAL,(e.getMessage() == null) ? e.toString() : e.getMessage());
    return;
  }
}
Program: 136015
Project: 136015
Buggy source:
final void enqueueInner(TLCState state){
  if (this.enqIndex == this.enqBuf.length) {
    try {
      String pstr=Integer.toString(this.hiPool);
      File file=new File(this.filePrefix + pstr);
      this.enqBuf=this.writer.doWork(this.enqBuf,file);
      this.hiPool++;
      this.enqIndex=0;
    }
 catch (    Exception e) {
      Assert.fail(EC.SYSTEM_ERROR_WRITING_STATES,new String[]{"String_Node_Str",e.getMessage()});
    }
  }
  this.enqBuf[this.enqIndex++]=state;
}

Fixed version (ground truth):
final void enqueueInner(TLCState state){
  if (this.enqIndex == this.enqBuf.length) {
    try {
      String pstr=Integer.toString(this.hiPool);
      File file=new File(this.filePrefix + pstr);
      this.enqBuf=this.writer.doWork(this.enqBuf,file);
      this.hiPool++;
      this.enqIndex=0;
    }
 catch (    Exception e) {
      Assert.fail(EC.SYSTEM_ERROR_WRITING_STATES,new String[]{"String_Node_Str",(e.getMessage() == null) ? e.toString() : e.getMessage()});
    }
  }
  this.enqBuf[this.enqIndex++]=state;
}
Program: 136016
Project: 136016
Buggy source:
private final void fillDeqBuffer(){
  try {
    if (this.loPool + 1 <= this.hiPool) {
      if (this.loPool + 1 >= this.hiPool) {
        this.writer.ensureWritten();
      }
      this.deqBuf=this.reader.doWork(this.deqBuf,this.loFile);
      this.deqIndex=0;
      this.loPool++;
      String pstr=Integer.toString(this.loPool);
      this.loFile=new File(this.filePrefix + pstr);
    }
 else {
      this.writer.ensureWritten();
      TLCState[] buf=this.reader.getCache(this.deqBuf,this.loFile);
      if (buf != null) {
        this.deqBuf=buf;
        this.deqIndex=0;
        this.loPool++;
        String pstr=Integer.toString(this.loPool);
        this.loFile=new File(this.filePrefix + pstr);
      }
 else {
        this.deqIndex=this.deqBuf.length - this.enqIndex;
        System.arraycopy(this.enqBuf,0,this.deqBuf,this.deqIndex,this.enqIndex);
        this.enqIndex=0;
      }
    }
  }
 catch (  Exception e) {
    Assert.fail(EC.SYSTEM_ERROR_READING_STATES,new String[]{"String_Node_Str",e.getMessage()});
  }
}

Fixed version (ground truth):
private final void fillDeqBuffer(){
  try {
    if (this.loPool + 1 <= this.hiPool) {
      if (this.loPool + 1 >= this.hiPool) {
        this.writer.ensureWritten();
      }
      this.deqBuf=this.reader.doWork(this.deqBuf,this.loFile);
      this.deqIndex=0;
      this.loPool++;
      String pstr=Integer.toString(this.loPool);
      this.loFile=new File(this.filePrefix + pstr);
    }
 else {
      this.writer.ensureWritten();
      TLCState[] buf=this.reader.getCache(this.deqBuf,this.loFile);
      if (buf != null) {
        this.deqBuf=buf;
        this.deqIndex=0;
        this.loPool++;
        String pstr=Integer.toString(this.loPool);
        this.loFile=new File(this.filePrefix + pstr);
      }
 else {
        this.deqIndex=this.deqBuf.length - this.enqIndex;
        System.arraycopy(this.enqBuf,0,this.deqBuf,this.deqIndex,this.enqIndex);
        this.enqIndex=0;
      }
    }
  }
 catch (  Exception e) {
    Assert.fail(EC.SYSTEM_ERROR_READING_STATES,new String[]{"String_Node_Str",(e.getMessage() == null) ? e.toString() : e.getMessage()});
  }
}
Program: 136017
Project: 136017
Buggy source:
private final boolean isAvail(){
  if (this.finish)   return false;
  while (this.len < 1 || this.stop) {
    this.numWaiting++;
    if (this.numWaiting >= TLCGlobals.getNumWorkers()) {
      if (this.len < 1) {
        this.numWaiting--;
        return false;
      }
synchronized (this.mu) {
        this.mu.notify();
      }
    }
    try {
      this.wait();
    }
 catch (    Exception e) {
      MP.printError(EC.GENERAL,e.getMessage());
      System.exit(1);
    }
    this.numWaiting--;
    if (this.finish)     return false;
  }
  return true;
}

Fixed version (ground truth):
private final boolean isAvail(){
  if (this.finish)   return false;
  while (this.len < 1 || this.stop) {
    this.numWaiting++;
    if (this.numWaiting >= TLCGlobals.getNumWorkers()) {
      if (this.len < 1) {
        this.numWaiting--;
        return false;
      }
synchronized (this.mu) {
        this.mu.notify();
      }
    }
    try {
      this.wait();
    }
 catch (    Exception e) {
      MP.printError(EC.GENERAL,(e.getMessage() == null) ? e.toString() : e.getMessage());
      System.exit(1);
    }
    this.numWaiting--;
    if (this.finish)     return false;
  }
  return true;
}
Program: 136018
Project: 136018
Buggy source:
public final boolean suspendAll(){
  boolean needWait=false;
synchronized (this) {
    if (this.finish)     return false;
    this.stop=true;
    needWait=this.numWaiting < TLCGlobals.getNumWorkers();
  }
  while (needWait) {
synchronized (this.mu) {
      try {
        this.mu.wait();
      }
 catch (      Exception e) {
        MP.printError(EC.GENERAL,e.getMessage());
        System.exit(1);
      }
    }
synchronized (this) {
      if (this.finish)       return false;
      needWait=this.numWaiting < TLCGlobals.getNumWorkers();
    }
  }
  return true;
}

Fixed version (ground truth):
public final boolean suspendAll(){
  boolean needWait=false;
synchronized (this) {
    if (this.finish)     return false;
    this.stop=true;
    needWait=this.numWaiting < TLCGlobals.getNumWorkers();
  }
  while (needWait) {
synchronized (this.mu) {
      try {
        this.mu.wait();
      }
 catch (      Exception e) {
        MP.printError(EC.GENERAL,(e.getMessage() == null) ? e.toString() : e.getMessage());
        System.exit(1);
      }
    }
synchronized (this) {
      if (this.finish)       return false;
      needWait=this.numWaiting < TLCGlobals.getNumWorkers();
    }
  }
  return true;
}
Program: 136019
Project: 136019
Buggy source:
public SetPredValue(Object vars,Value inVal,SemanticNode pred,Tool tool,Context con,TLCState s0,TLCState s1,int control){
  this.vars=vars;
  this.inVal=inVal;
  this.pred=pred;
  this.tool=tool;
  this.con=con;
  this.state=s0;
  this.pstate=s1;
  this.control=control;
}

Fixed version (ground truth):
public SetPredValue(Object vars,Value inVal,SemanticNode pred,Tool tool,Context con,TLCState s0,TLCState s1,int control){
  this.vars=vars;
  this.inVal=inVal;
  this.pred=pred;
  this.tool=tool;
  this.con=con;
  this.state=s0.copy();
  if (s1 != null) {
    this.pstate=s1.copy();
  }
 else {
    this.pstate=null;
  }
  this.control=control;
}
Program: 136022
Project: 136022
Buggy source:
public void selectionChanged(SelectionChangedEvent event){
  if (!((IStructuredSelection)event.getSelection()).isEmpty()) {
    Object selection=((IStructuredSelection)event.getSelection()).getFirstElement();
    valueViewer.setDocument(new Document(selection.toString()));
  }
 else {
    valueViewer.setDocument(EMPTY_DOCUMENT());
  }
}

Fixed version (ground truth):
public void selectionChanged(SelectionChangedEvent event){
  if (!((IStructuredSelection)event.getSelection()).isEmpty()) {
    Object selection=((IStructuredSelection)event.getSelection()).getFirstElement();
    valueViewer.setDocument(new Document(selection.toString()));
  }
 else {
    valueViewer.setDocument(NO_VALUE_DOCUMENT());
  }
}
Program: 136024
Project: 136024
Buggy source:
public Object execute(ExecutionEvent event) throws ExecutionException {
  BusyIndicator.showWhile(null,new Runnable(){
    public void run(){
      UIHelper.getActiveWindow().getWorkbench().getHelpSystem().displayDynamicHelp();
      IViewPart helpView=UIHelper.findView("String_Node_Str");
      if (helpView != null && UIHelper.getActiveWindow() != null && UIHelper.getActiveWindow().getActivePage() != null) {
        UIHelper.getActiveWindow().getActivePage().activate(helpView);
      }
    }
  }
);
  return null;
}

Fixed version (ground truth):
public Object execute(ExecutionEvent event) throws ExecutionException {
  UIHelper.showDynamicHelp();
  return null;
}
Program: 136028
Project: 136028
Buggy source:
/** 
 * Returns a string describing the state with the variables representing trace explorer expressions replaced with the expressions.
 * @return
 */
public String getDescriptionWithTraceExpressions(){
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a string describing the state with the variables representing trace explorer expressions replaced with the expressions.
 * @return
 */
public String getDescriptionWithTraceExpressions(){
  StringBuffer result=new StringBuffer();
  for (int i=0; i < variables.length; i++) {
    TLCVariable var=variables[i];
    result.append("String_Node_Str");
    if (var.isTraceExplorerVar()) {
      result.append(var.getSingleLineName());
    }
 else {
      result.append(var.getName());
    }
    result.append("String_Node_Str");
    if (var.getValue().toString() != null) {
      result.append(var.getValue().toString()).append("String_Node_Str");
    }
 else {
      result.append(var.getValue().toSimpleString());
    }
  }
  return result.toString();
}
Program: 136029
Project: 136029
Buggy source:
public void selectionChanged(SelectionChangedEvent event){
  if (!((IStructuredSelection)event.getSelection()).isEmpty()) {
    Object selection=((IStructuredSelection)event.getSelection()).getFirstElement();
    valueViewer.setDocument(new Document(selection.toString()));
  }
 else {
    valueViewer.setDocument(NO_VALUE_DOCUMENT());
  }
}

Fixed version (ground truth):
public void selectionChanged(SelectionChangedEvent event){
  if (!((IStructuredSelection)event.getSelection()).isEmpty()) {
    Object selection=((IStructuredSelection)event.getSelection()).getFirstElement();
    if (selection instanceof TLCState) {
      TLCState state=(TLCState)selection;
      valueViewer.setDocument(new Document(state.getDescriptionWithTraceExpressions()));
    }
 else {
      valueViewer.setDocument(new Document(selection.toString()));
    }
  }
 else {
    valueViewer.setDocument(NO_VALUE_DOCUMENT());
  }
}
Program: 136033
Project: 136033
Buggy source:
public void onDone(){
  if (lastDetectedError != null) {
    this.errors.add(lastDetectedError);
    informPresenter(ITLCModelLaunchDataPresenter.ERRORS);
  }
  this.setCurrentStatus(NOT_RUNNING);
  informPresenter(ITLCModelLaunchDataPresenter.CURRENT_STATUS);
  isDone=true;
}

Fixed version (ground truth):
public void onDone(){
  if (lastDetectedError != null) {
    this.errors.add(lastDetectedError);
    informPresenter(ITLCModelLaunchDataPresenter.ERRORS);
  }
  registerTraceForTraceExplorer();
  this.setCurrentStatus(NOT_RUNNING);
  informPresenter(ITLCModelLaunchDataPresenter.CURRENT_STATUS);
  isDone=true;
}
Program: 136034
Project: 136034
Buggy source:
/** 
 * A factory for Back to state states
 * @param number2
 * @return
 */
private static TLCState BACK_TO_STATE(int number){
  TLCState state=new TLCState(number);
  state.isBackToState=true;
  return state;
}

Fixed version (ground truth):
/** 
 * A factory for Back to state states
 * @param number2
 * @return
 */
protected static TLCState BACK_TO_STATE(int number){
  TLCState state=new TLCState(number);
  state.isBackToState=true;
  return state;
}
Program: 136035
Project: 136035
Buggy source:
/** 
 * A factory for stuttering states
 */
public static TLCState STUTTERING_STATE(int number){
  TLCState state=new TLCState(number);
  state.stuttering=true;
  return state;
}

Fixed version (ground truth):
/** 
 * A factory for stuttering states
 */
protected static TLCState STUTTERING_STATE(int number){
  TLCState state=new TLCState(number);
  state.stuttering=true;
  return state;
}
Program: 136036
Project: 136036
Buggy source:
public TLCVariable(String name,TLCVariableValue value){
  this.name=name;
  this.value=value;
}

Fixed version (ground truth):
public TLCVariable(String name,TLCVariableValue value){
  this.name=name;
  this.value=value;
  this.isTraceExplorerVar=false;
}
Program: 136038
Project: 136038
Buggy source:
public ILaunchConfigurationWorkingCopy getConfig(){
  return configurationCopy;
}

Fixed version (ground truth):
/** 
 * Returns a working copy of the launch configuration for this model.
 * @return
 */
public ILaunchConfigurationWorkingCopy getConfig(){
  return configurationCopy;
}
Program: 136039
Project: 136039
Buggy source:
/** 
 * Saves the expressions in the table to the configuration whose errors are currently loaded in the error view where this composite appears.
 * @return a handle on the underlying configuration file, can return null
 */
private ILaunchConfiguration saveInput(){
  try {
    if (view.getCurrentConfigFileHandle() != null) {
      ILaunchConfigurationWorkingCopy configCopy=view.getCurrentConfigFileHandle().getWorkingCopy();
      configCopy.setAttribute(IModelConfigurationConstants.TRACE_EXPLORE_EXPRESSIONS,FormHelper.getSerializedInput(tableViewer));
      ILaunchConfiguration savedConfig=configCopy.doSave();
      return savedConfig;
    }
  }
 catch (  CoreException e) {
    TLCUIActivator.logError("String_Node_Str",e);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Saves the expressions in the table to the configuration whose errors are currently loaded in the error view where this composite appears.
 * @return a handle on the underlying configuration file, can return null
 */
private ILaunchConfiguration saveInput(){
  try {
    if (view.getCurrentConfigFileHandle() != null) {
      ModelEditor modelEditor=((ModelEditor)ModelHelper.getEditorWithModelOpened(view.getCurrentConfigFileHandle()));
      ILaunchConfigurationWorkingCopy configCopy=null;
      if (modelEditor != null) {
        configCopy=modelEditor.getConfig();
      }
 else {
        configCopy=view.getCurrentConfigFileHandle().getWorkingCopy();
      }
      configCopy.setAttribute(IModelConfigurationConstants.TRACE_EXPLORE_EXPRESSIONS,FormHelper.getSerializedInput(tableViewer));
      ILaunchConfiguration savedConfig=configCopy.doSave();
      return savedConfig;
    }
  }
 catch (  CoreException e) {
    TLCUIActivator.logError("String_Node_Str",e);
  }
  return null;
}
Program: 136041
Project: 136041
Buggy source:
/** 
 * Converts four-int-location to a region TODO: unit test!
 * @param document
 * @param location
 * @return
 * @throws BadLocationException 
 */
public static IRegion locationToRegion(IDocument document,Location location) throws BadLocationException {
  int offset=document.getLineOffset(location.beginLine() - 1) + location.beginColumn() - 1;
  int length=location.endColumn() - location.beginColumn() + 1;
  for (int i=location.beginLine(); i < location.endLine(); i++) {
    length+=document.getLineOffset(i);
  }
  return new Region(offset,length);
}

Fixed version (ground truth):
/** 
 * Converts four-int-location to a region TODO: unit test!
 * @param document
 * @param location
 * @return
 * @throws BadLocationException 
 */
public static IRegion locationToRegion(IDocument document,Location location) throws BadLocationException {
  int offset=document.getLineOffset(location.beginLine() - 1) + location.beginColumn() - 1;
  int length=document.getLineOffset(location.endLine() - 1) + location.endColumn() - offset;
  return new Region(offset,length);
}
Program: 136044
Project: 136044
Buggy source:
/** 
 * Appends the error description to the buffer
 * @param buffer string buffer to append the error description to
 * @param error error object
 */
private static void appendError(StringBuffer buffer,TLCError error){
  String message=error.getMessage();
  if (message != null && !message.equals("String_Node_Str")) {
    buffer.append(message).append("String_Node_Str");
  }
  if (error.getCause() != null) {
    appendError(buffer,error.getCause());
  }
}

Fixed version (ground truth):
/** 
 * Appends the error description to the buffer
 * @param buffer string buffer to append the error description to
 * @param error error object
 */
private static void appendError(StringBuffer buffer,TLCError error){
  String message=error.getMessage();
  if (message != null && !message.equals("String_Node_Str")) {
    buffer.append(message).append("String_Node_Str");
  }
  TLCError cause=error.getCause();
  while (cause != null) {
    if (message == null || !message.contains(cause.getMessage())) {
      appendError(buffer,cause);
      break;
    }
 else {
      cause=cause.getCause();
    }
  }
}
Program: 136045
Project: 136045
Buggy source:
/** 
 * Converts four-int-location to a region TODO: unit test!
 * @param document
 * @param location
 * @return
 * @throws BadLocationException 
 */
public static IRegion locationToRegion(IDocument document,Location location) throws BadLocationException {
  int offset=document.getLineOffset(location.beginLine()) + location.beginColumn();
  int length=location.endColumn() - location.beginColumn();
  for (int i=location.beginLine(); i < location.endLine(); i++) {
    length+=document.getLineOffset(i);
  }
  return new Region(offset,length);
}

Fixed version (ground truth):
/** 
 * Converts four-int-location to a region TODO: unit test!
 * @param document
 * @param location
 * @return
 * @throws BadLocationException 
 */
public static IRegion locationToRegion(IDocument document,Location location) throws BadLocationException {
  int offset=document.getLineOffset(location.beginLine() - 1) + location.beginColumn();
  int length=location.endColumn() - location.beginColumn();
  for (int i=location.beginLine(); i < location.endLine(); i++) {
    length+=document.getLineOffset(i);
  }
  return new Region(offset,length);
}
Program: 136046
Project: 136046
Buggy source:
/** 
 * Finds the locations in the given text and return the array of  regions pointing to those or an empty array, if no location were found. A location is a pointer in the TLA file, e.G. "line 11, col 8 to line 14, col 26 of module Foo"
 * @param text text containing locations (error text)
 * @return array of regions or empty array
 */
public static IRegion[] findLocations(String text){
  if (text == null || text.length() == 0) {
    return new IRegion[0];
  }
  Matcher matcher=Location.LOCATION_MATCHER.matcher(text);
  Vector regions=new Vector();
  while (matcher.find()) {
    regions.add(new Region(matcher.start(),matcher.end() - matcher.start()));
  }
  return (IRegion[])regions.toArray(new IRegion[regions.size()]);
}

Fixed version (ground truth):
/** 
 * Finds the locations in the given text and return the array of  regions pointing to those or an empty array, if no location were found. A location is a pointer in the TLA file, e.G. "line 11, col 8 to line 14, col 26 of module Foo"
 * @param text text containing locations (error text)
 * @return array of regions or empty array
 */
public static IRegion[] findLocations(String text){
  if (text == null || text.length() == 0) {
    return new IRegion[0];
  }
  Matcher matcher=Location.LOCATION_MATCHER.matcher(text);
  Vector regions=new Vector();
  while (matcher.find()) {
    regions.add(new Region(matcher.start(),matcher.end() - matcher.start()));
  }
  matcher=Location.LOCATION_MATCHER4.matcher(text);
  while (matcher.find()) {
    regions.add(new Region(matcher.start(),matcher.end() - matcher.start()));
  }
  return (IRegion[])regions.toArray(new IRegion[regions.size()]);
}
Program: 136047
Project: 136047
Buggy source:
/** 
 * Parses location from its string representation  
 * @param locationString the string representation produced by {@link Location#toString()} method
 * @return location if it could be parsed, or a {@link Location#nullLoc} otherwise
 */
public static Location parseLocation(String locationString){
  if (locationString == null || locationString.length() == 0 || UNKNOWN_LOCATION.equals(locationString)) {
    return nullLoc;
  }
  Matcher matcher;
  if ((matcher=LOCATION_MATCHER2.matcher(locationString)).matches()) {
    return moduleLocation(matcher.group(1));
  }
 else   if ((matcher=LOCATION_MATCHER.matcher(locationString)).matches()) {
    try {
      return new Location(UniqueString.uniqueStringOf(matcher.group(5)),Integer.parseInt(matcher.group(1)),Integer.parseInt(matcher.group(2)),Integer.parseInt(matcher.group(3)),Integer.parseInt(matcher.group(4)));
    }
 catch (    NumberFormatException e) {
      return nullLoc;
    }
  }
 else   if ((matcher=LOCATION_MATCHER3.matcher(locationString.trim())).matches()) {
    try {
      return new Location(UniqueString.uniqueStringOf(matcher.group(5)),Integer.parseInt(matcher.group(1)),Integer.parseInt(matcher.group(2)),Integer.parseInt(matcher.group(3)),Integer.parseInt(matcher.group(4)));
    }
 catch (    NumberFormatException e) {
      return nullLoc;
    }
  }
 else {
    return nullLoc;
  }
}

Fixed version (ground truth):
/** 
 * Parses location from its string representation  
 * @param locationString the string representation produced by {@link Location#toString()} method
 * @return location if it could be parsed, or a {@link Location#nullLoc} otherwise
 */
public static Location parseLocation(String locationString){
  if (locationString == null || locationString.length() == 0 || UNKNOWN_LOCATION.equals(locationString)) {
    return nullLoc;
  }
  Matcher matcher;
  if ((matcher=LOCATION_MATCHER2.matcher(locationString)).matches()) {
    return moduleLocation(matcher.group(1));
  }
 else   if ((matcher=LOCATION_MATCHER.matcher(locationString)).matches()) {
    try {
      return new Location(UniqueString.uniqueStringOf(matcher.group(5)),Integer.parseInt(matcher.group(1)),Integer.parseInt(matcher.group(2)),Integer.parseInt(matcher.group(3)),Integer.parseInt(matcher.group(4)));
    }
 catch (    NumberFormatException e) {
      return nullLoc;
    }
  }
 else   if ((matcher=LOCATION_MATCHER3.matcher(locationString.trim())).matches()) {
    try {
      return new Location(UniqueString.uniqueStringOf(matcher.group(5)),Integer.parseInt(matcher.group(1)),Integer.parseInt(matcher.group(2)),Integer.parseInt(matcher.group(3)),Integer.parseInt(matcher.group(4)));
    }
 catch (    NumberFormatException e) {
      return nullLoc;
    }
  }
 else   if ((matcher=LOCATION_MATCHER4.matcher(locationString.trim())).matches()) {
    try {
      return new Location(UniqueString.uniqueStringOf(matcher.group(5)),Integer.parseInt(matcher.group(1)),Integer.parseInt(matcher.group(2)),Integer.parseInt(matcher.group(3)),Integer.parseInt(matcher.group(4)));
    }
 catch (    NumberFormatException e) {
      return nullLoc;
    }
  }
 else {
    return nullLoc;
  }
}