nus-yam/ex-repair huggingface dataset:
Program: 33161
Project: 33161
Buggy source:
/** 
 * Tries to find the JVM assuming the layout used by javafxpackager. Then execute it in a new process and quit this process. We have to do it this way because JavaFX is designed to only be started once and there's no easy way to hack around that: we need to tear down the entire process and start again.
 */
public static void restartApp(Path appInstallDir,String[] args) throws IOException {
  Path path=findAppExecutable(appInstallDir);
  if (path == null)   throw new UnsupportedOperationException();
  String[] cmd=new String[args.length + 1];
  System.arraycopy(args,0,cmd,1,args.length);
  cmd[0]=path.toAbsolutePath().toString();
  log.info("String_Node_Str",Arrays.toString(cmd));
  new ProcessBuilder(cmd).start();
  Runtime.getRuntime().exit(0);
}

Fixed version (ground truth):
/** 
 * Tries to find the JVM assuming the layout used by javafxpackager. Then execute it in a new process and quit this process. We have to do it this way because JavaFX is designed to only be started once and there's no easy way to hack around that: we need to tear down the entire process and start again.
 */
public static void restartApp() throws IOException {
  Path path=findAppExecutable(appInstallDir);
  if (path == null)   throw new UnsupportedOperationException();
  String[] cmd=new String[initArgs.length + 1];
  System.arraycopy(initArgs,0,cmd,1,initArgs.length);
  cmd[0]=path.toAbsolutePath().toString();
  log.info("String_Node_Str",Arrays.toString(cmd));
  new ProcessBuilder(cmd).start();
  Runtime.getRuntime().exit(0);
}
Program: 33162
Project: 33162
Buggy source:
public static void bootstrap(Class mainClass,Path updatesDirectory,String[] args){
  try {
    Path codePath=findCodePath(mainClass);
    Path appInstallDir=codePathToInstallDir(codePath);
    if (Files.isDirectory(codePath)) {
      log.info("String_Node_Str");
      runRealMain(appInstallDir,args,mainClass);
    }
    Path bestJarSeen=findBestJar(codePath,updatesDirectory);
    invoke(appInstallDir,mainClass,args,bestJarSeen);
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public static void bootstrap(Class mainClass,Path updatesDirectory,String[] args){
  try {
    Path codePath=findCodePath(mainClass);
    Path appInstallDir=codePathToInstallDir(codePath);
    if (Files.isDirectory(codePath)) {
      log.info("String_Node_Str");
      runRealMain(appInstallDir,args,mainClass);
      return;
    }
    Path bestJarSeen=findBestJar(codePath,updatesDirectory);
    invoke(appInstallDir,mainClass,args,bestJarSeen);
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
}
Program: 33163
Project: 33163
Buggy source:
private void processDownloadedUpdates(List<UFXProtocol.Update> updates,List<Path> files) throws IOException {
  int cursor=0;
  for (  Path path : files) {
    UFXProtocol.Update update=updates.get(cursor);
    Path base=pathToOrigJar;
    if (update.getVersion() > 2)     base=localUpdatesDir.resolve((update.getVersion() - 1) + "String_Node_Str");
    Path next=localUpdatesDir.resolve(update.getVersion() + "String_Node_Str");
    log.info("String_Node_Str",path,base);
    new GDiffPatcher().patch(base.toFile(),path.toFile(),next.toFile());
    Preconditions.checkState(update.getVersion() > newHighestVersion);
    newHighestVersion=update.getVersion();
    cursor++;
  }
}

Fixed version (ground truth):
private void processDownloadedUpdates(List<UFXProtocol.Update> updates,List<Path> files) throws IOException {
  int cursor=0;
  for (  Path path : files) {
    UFXProtocol.Update update=updates.get(cursor);
    Path base=pathToOrigJar;
    if (update.getVersion() > currentVersion + 1)     base=localUpdatesDir.resolve((update.getVersion() - 1) + "String_Node_Str");
    Path next=localUpdatesDir.resolve(update.getVersion() + "String_Node_Str");
    log.info("String_Node_Str",path,base);
    new GDiffPatcher().patch(base.toFile(),path.toFile(),next.toFile());
    Preconditions.checkState(update.getVersion() > newHighestVersion);
    newHighestVersion=update.getVersion();
    cursor++;
  }
}
Program: 33164
Project: 33164
Buggy source:
public static void realMain(Path appInstallDir,String[] args){
  ExampleApp.appInstallDir=appInstallDir;
  launch(ExampleApp.class,args);
}

Fixed version (ground truth):
public static void realMain(String[] args){
  launch(args);
}
Program: 33165
Project: 33165
Buggy source:
@Override public void start(Stage primaryStage) throws Exception {
  AppDirectory.initAppDir("String_Node_Str");
  log.info("String_Node_Str" + VERSION);
  log.info("String_Node_Str" + appInstallDir);
  ProgressIndicator indicator=showGiantProgressWheel(primaryStage);
  List<ECPoint> pubkeys=Crypto.decode("String_Node_Str");
  Updater updater=new Updater("String_Node_Str","String_Node_Str" + VERSION,VERSION,AppDirectory.dir(),UpdateFX.findCodePath(ExampleApp.class),pubkeys,1){
    @Override protected void updateProgress(    long workDone,    long max){
      super.updateProgress(workDone,max);
      Uninterruptibles.sleepUninterruptibly(100,TimeUnit.MILLISECONDS);
    }
  }
;
  indicator.progressProperty().bind(updater.progressProperty());
  log.info("String_Node_Str");
  updater.setOnSucceeded(event -> {
    try {
      UpdateSummary summary=updater.get();
      if (summary.newVersion > VERSION) {
        log.info("String_Node_Str" + summary.newVersion);
        UpdateFX.restartApp(appInstallDir,new String[]{});
      }
    }
 catch (    Throwable e) {
      log.error("String_Node_Str",e);
    }
  }
);
  new Thread(updater,"String_Node_Str").start();
  primaryStage.show();
}

Fixed version (ground truth):
@Override public void start(Stage primaryStage) throws Exception {
  Thread.currentThread().setContextClassLoader(ExampleApp.class.getClassLoader());
  AppDirectory.initAppDir("String_Node_Str");
  log.info("String_Node_Str" + VERSION);
  ProgressIndicator indicator=showGiantProgressWheel(primaryStage);
  List<ECPoint> pubkeys=Crypto.decode("String_Node_Str");
  Updater updater=new Updater("String_Node_Str","String_Node_Str" + VERSION,VERSION,AppDirectory.dir(),UpdateFX.findCodePath(ExampleApp.class),pubkeys,1){
    @Override protected void updateProgress(    long workDone,    long max){
      super.updateProgress(workDone,max);
      Uninterruptibles.sleepUninterruptibly(100,TimeUnit.MILLISECONDS);
    }
  }
;
  indicator.progressProperty().bind(updater.progressProperty());
  log.info("String_Node_Str");
  updater.setOnSucceeded(event -> {
    try {
      UpdateSummary summary=updater.get();
      if (summary.newVersion > VERSION) {
        log.info("String_Node_Str" + summary.newVersion);
        UpdateFX.restartApp();
      }
    }
 catch (    Throwable e) {
      log.error("String_Node_Str",e);
    }
  }
);
  new Thread(updater,"String_Node_Str").start();
  primaryStage.show();
}
Program: 33166
Project: 33166
Buggy source:
public FOXAnnotator(String serviceUrl){
  this.serviceUrl=serviceUrl;
}

Fixed version (ground truth):
public FOXAnnotator(String serviceUrl){
  annotator=new NIFBasedAnnotatorWebservice(serviceUrl,NAME);
}
Program: 33167
Project: 33167
Buggy source:
@Override public List<Meaning> performC2KB(Document document) throws GerbilException {
  return requestAnnotations(document).getMarkings(Meaning.class);
}

Fixed version (ground truth):
@Override public List<Meaning> performC2KB(Document document) throws GerbilException {
  return annotator.performC2KB(document);
}
Program: 33168
Project: 33168
Buggy source:
protected Document requestAnnotations(Document document) throws GerbilException {
  Document resultDoc=new DocumentImpl(document.getText(),document.getDocumentURI());
  HttpEntity entity=new StringEntity(new JSONObject().put("String_Node_Str",document.getText()).put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").toString(),ContentType.APPLICATION_JSON);
  HttpPost request=null;
  try {
    request=createPostRequest(serviceUrl);
  }
 catch (  IllegalArgumentException e) {
    throw new GerbilException("String_Node_Str",e,ErrorTypes.UNEXPECTED_EXCEPTION);
  }
  request.addHeader(HttpHeaders.CONTENT_TYPE,ContentType.APPLICATION_JSON.toString());
  request.addHeader(HttpHeaders.ACCEPT_CHARSET,ContentType.APPLICATION_JSON.getCharset().name());
  request.setEntity(entity);
  entity=null;
  CloseableHttpResponse response=null;
  try {
    response=sendRequest(request);
    entity=response.getEntity();
    try {
      String content=IOUtils.toString(entity.getContent(),ContentType.APPLICATION_JSON.getCharset().name());
      JSONObject outObj=new JSONObject(content);
      if (outObj.has("String_Node_Str")) {
        JSONArray graph=outObj.getJSONArray("String_Node_Str");
        for (int i=0; i < graph.length(); i++) {
          parseType(graph.getJSONObject(i),resultDoc);
        }
      }
 else {
        parseType(outObj,resultDoc);
      }
    }
 catch (    Exception e) {
      LOGGER.error("String_Node_Str",e);
      throw new GerbilException("String_Node_Str",e,ErrorTypes.UNEXPECTED_EXCEPTION);
    }
  }
  finally {
    if (entity != null) {
      try {
        EntityUtils.consume(entity);
      }
 catch (      IOException e1) {
      }
    }
    if (response != null) {
      try {
        response.close();
      }
 catch (      IOException e) {
      }
    }
    closeRequest(request);
  }
  return resultDoc;
}

Fixed version (ground truth):
protected Document requestAnnotations(Document document) throws GerbilException {
  Document resultDoc=annotator.request(document);
  return DocumentTextEditRevoker.revokeTextEdits(resultDoc,document.getText());
}
Program: 33171
Project: 33171
Buggy source:
private static DocumentTextComparisonResult determineOperation(DocumentTextComparisonResult[][] matrix,int i,int j){
  DocumentTextEdits editType;
  DocumentTextComparisonResult formerResult;
  if (matrix[i][j - 1].editDistance < matrix[i - 1][j - 1].editDistance) {
    if (matrix[i][j - 1].editDistance < matrix[i - 1][j].editDistance) {
      formerResult=matrix[i][j - 1];
      editType=DocumentTextEdits.INSERT;
    }
 else {
      formerResult=matrix[i - 1][j];
      editType=DocumentTextEdits.DELETE;
    }
  }
 else {
    if (matrix[i - 1][j - 1].editDistance < matrix[i - 1][j].editDistance) {
      formerResult=matrix[i - 1][j - 1];
      editType=DocumentTextEdits.SUBSTITUTE;
    }
 else {
      formerResult=matrix[i - 1][j];
      editType=DocumentTextEdits.DELETE;
    }
  }
  return DocumentTextComparisonResult.create(formerResult,editType);
}

Fixed version (ground truth):
private static DocumentTextComparisonResult determineOperation(DocumentTextComparisonResult[] currentLine,DocumentTextComparisonResult[] oldLine,int i,int j){
  DocumentTextEdits editType;
  DocumentTextComparisonResult formerResult;
  if (currentLine[j - 1].editDistance < oldLine[j - 1].editDistance) {
    if (currentLine[j - 1].editDistance < oldLine[j].editDistance) {
      formerResult=currentLine[j - 1];
      editType=DocumentTextEdits.INSERT;
    }
 else {
      formerResult=oldLine[j];
      editType=DocumentTextEdits.DELETE;
    }
  }
 else {
    if (oldLine[j - 1].editDistance < oldLine[j].editDistance) {
      formerResult=oldLine[j - 1];
      editType=DocumentTextEdits.SUBSTITUTE;
    }
 else {
      formerResult=oldLine[j];
      editType=DocumentTextEdits.DELETE;
    }
  }
  return DocumentTextComparisonResult.create(formerResult,editType);
}
Program: 33172
Project: 33172
Buggy source:
public void addStep(DocumentTextEdits newStep){
  ++numberOfSteps;
  int currentCell=numberOfSteps / 32;
  if (currentCell >= steps.length) {
    steps=Arrays.copyOf(steps,currentCell);
  }
  if (newStep != DocumentTextEdits.NONE) {
    ++this.editDistance;
    long mask=0;
switch (newStep) {
case SUBSTITUTE:
      mask=3;
    break;
case DELETE:
  mask=2;
break;
case INSERT:
mask=1;
break;
case NONE:
break;
}
int currentBit=((numberOfSteps - 1) % 32) * 2;
steps[currentCell]|=mask << currentBit;
}
}

Fixed version (ground truth):
public void addStep(DocumentTextEdits newStep){
  int currentCell=numberOfSteps / 32;
  if (currentCell >= steps.length) {
    steps=Arrays.copyOf(steps,currentCell + 1);
  }
  if (newStep != DocumentTextEdits.NONE) {
    ++this.editDistance;
    long mask=0;
switch (newStep) {
case SUBSTITUTE:
      mask=3;
    break;
case DELETE:
  mask=2;
break;
case INSERT:
mask=1;
break;
case NONE:
break;
}
int currentBit=(numberOfSteps % 32) * 2;
steps[currentCell]|=mask << currentBit;
}
++numberOfSteps;
}
Program: 33173
Project: 33173
Buggy source:
public DocumentTextEdits getStep(int index){
  if (index < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (index >= numberOfSteps) {
    throw new IllegalArgumentException("String_Node_Str" + index + "String_Node_Str"+ numberOfSteps+ "String_Node_Str");
  }
  int currentCell=index / 32;
  int currentBit=(index % 32) * 2;
  int value=(int)(steps[currentCell] & (3L << currentBit)) >> currentBit;
switch (value) {
case 0:
    return DocumentTextEdits.NONE;
case 1:
  return DocumentTextEdits.INSERT;
case 2:
return DocumentTextEdits.DELETE;
case 3:
return DocumentTextEdits.SUBSTITUTE;
default :
throw new IllegalStateException("String_Node_Str");
}
}

Fixed version (ground truth):
public DocumentTextEdits getStep(int index){
  if (index < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (index >= numberOfSteps) {
    throw new IllegalArgumentException("String_Node_Str" + index + "String_Node_Str"+ numberOfSteps+ "String_Node_Str");
  }
  int currentCell=index / 32;
  int currentBit=(index % 32) * 2;
  int value=(int)((steps[currentCell] & (3L << currentBit)) >>> currentBit);
switch (value) {
case 0:
    return DocumentTextEdits.NONE;
case 1:
  return DocumentTextEdits.INSERT;
case 2:
return DocumentTextEdits.DELETE;
case 3:
return DocumentTextEdits.SUBSTITUTE;
default :
throw new IllegalStateException("String_Node_Str");
}
}
Program: 33175
Project: 33175
Buggy source:
@Test public void testTerm() throws GerbilException, IOException {
  File indexFolder=createTempDirectory();
  assertTrue(indexFolder != null);
  Indexer index=new Indexer(indexFolder.getAbsolutePath());
  index.index("String_Node_Str",getList("String_Node_Str"));
  index.index("String_Node_Str",getList("String_Node_Str"));
  index.index("String_Node_Str",getList("String_Node_Str"));
  index.close();
  Searcher search=new Searcher("String_Node_Str");
  assertFalse(search.search("String_Node_Str").isEmpty());
  assertTrue(search.search("String_Node_Str").isEmpty());
  assertFalse(search.search("String_Node_Str").isEmpty());
  assertTrue(search.search("String_Node_Str").isEmpty());
  search.close();
}

Fixed version (ground truth):
@Test public void testTerm() throws GerbilException, IOException {
  File indexFolder=createTempDirectory();
  assertTrue(indexFolder != null);
  Indexer index=new Indexer(indexFolder.getAbsolutePath());
  index.index("String_Node_Str",getList("String_Node_Str"));
  index.index("String_Node_Str",getList("String_Node_Str"));
  index.index("String_Node_Str",getList("String_Node_Str"));
  index.close();
  Searcher search=new Searcher(indexFolder.getAbsolutePath());
  assertFalse(search.search("String_Node_Str").isEmpty());
  assertTrue(search.search("String_Node_Str").isEmpty());
  assertFalse(search.search("String_Node_Str").isEmpty());
  assertTrue(search.search("String_Node_Str").isEmpty());
  search.close();
}
Program: 33176
Project: 33176
Buggy source:
public InstanceListBasedAnnotator(String annotatorName,List<Document> instances){
  super(annotatorName);
  this.uriInstanceMapping=new HashMap<String,Document>(instances.size());
  for (  Document document : instances) {
    uriInstanceMapping.put(document.getDocumentURI(),document);
  }
}

Fixed version (ground truth):
public InstanceListBasedAnnotator(String annotatorName,List<Document> instances){
  super(annotatorName);
  this.uriInstanceMapping=new HashMap<String,Document>(instances.size());
  for (  Document document : instances) {
    uriInstanceMapping.put(document.getDocumentURI() + document.getText().length(),document);
  }
}
Program: 33177
Project: 33177
Buggy source:
@Override public List<Meaning> performC2KB(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),Meaning.class);
}

Fixed version (ground truth):
@Override public List<Meaning> performC2KB(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),document.getText().length(),Meaning.class);
}
Program: 33178
Project: 33178
Buggy source:
@Override public List<TypedSpan> performRT2KBTask(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),TypedSpan.class);
}

Fixed version (ground truth):
@Override public List<TypedSpan> performRT2KBTask(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),document.getText().length(),TypedSpan.class);
}
Program: 33179
Project: 33179
Buggy source:
@Override public List<MeaningSpan> performA2KBTask(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),MeaningSpan.class);
}

Fixed version (ground truth):
@Override public List<MeaningSpan> performA2KBTask(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),document.getText().length(),MeaningSpan.class);
}
Program: 33180
Project: 33180
Buggy source:
protected Document getDocument(String uri){
  if (uriInstanceMapping.containsKey(uri)) {
    return uriInstanceMapping.get(uri);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
protected Document getDocument(String uri,int textLength){
  String mappingUri=uri + textLength;
  if (uriInstanceMapping.containsKey(mappingUri)) {
    return uriInstanceMapping.get(mappingUri);
  }
 else {
    return null;
  }
}
Program: 33181
Project: 33181
Buggy source:
@Override public List<MeaningSpan> performD2KBTask(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),MeaningSpan.class);
}

Fixed version (ground truth):
@Override public List<MeaningSpan> performD2KBTask(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),document.getText().length(),MeaningSpan.class);
}
Program: 33182
Project: 33182
Buggy source:
@Override public List<TypedNamedEntity> performTask1(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),TypedNamedEntity.class);
}

Fixed version (ground truth):
@Override public List<TypedNamedEntity> performTask1(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),document.getText().length(),TypedNamedEntity.class);
}
Program: 33183
Project: 33183
Buggy source:
@Override public List<TypedSpan> performTyping(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),TypedSpan.class);
}

Fixed version (ground truth):
@Override public List<TypedSpan> performTyping(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),document.getText().length(),TypedSpan.class);
}
Program: 33184
Project: 33184
Buggy source:
@Override public List<TypedNamedEntity> performTask2(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),TypedNamedEntity.class);
}

Fixed version (ground truth):
@Override public List<TypedNamedEntity> performTask2(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),document.getText().length(),TypedNamedEntity.class);
}
Program: 33185
Project: 33185
Buggy source:
@Override public List<Span> performRecognition(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),Span.class);
}

Fixed version (ground truth):
@Override public List<Span> performRecognition(Document document) throws GerbilException {
  return getDocumentMarkings(document.getDocumentURI(),document.getText().length(),Span.class);
}
Program: 33186
Project: 33186
Buggy source:
protected <T extends Marking>List<T> getDocumentMarkings(String uri,Class<T> clazz){
  Document result=this.getDocument(uri);
  if (result == null) {
    return new ArrayList<T>(0);
  }
 else {
    return result.getMarkings(clazz);
  }
}

Fixed version (ground truth):
protected <T extends Marking>List<T> getDocumentMarkings(String uri,int textLength,Class<T> clazz){
  Document result=this.getDocument(uri,textLength);
  if (result == null) {
    return new ArrayList<T>(0);
  }
 else {
    return result.getMarkings(clazz);
  }
}
Program: 33187
Project: 33187
Buggy source:
@Override protected void testTaskResults(Task task){
  Assert.assertEquals(ExperimentDAO.TASK_FINISHED,experimentDAO.getExperimentState(experimentTaskId));
  ExperimentTaskResult result=experimentDAO.getTaskResult(experimentTaskId);
  Assert.assertEquals(expectedResults[MACRO_PREC_INDEX],result.getMacroPrecision(),DELTA);
  Assert.assertEquals(expectedResults[MACRO_REC_INDEX],result.getMacroRecall(),DELTA);
  Assert.assertEquals(expectedResults[MACRO_F1_INDEX],result.getMacroF1Measure(),DELTA);
  Assert.assertEquals(expectedResults[MICRO_PREC_INDEX],result.getMicroPrecision(),DELTA);
  Assert.assertEquals(expectedResults[MICRO_REC_INDEX],result.getMicroRecall(),DELTA);
  Assert.assertEquals(expectedResults[MICRO_F1_INDEX],result.getMicroF1Measure(),DELTA);
  Assert.assertEquals(expectedResults[ERROR_COUNT_INDEX],result.getErrorCount(),DELTA);
}

Fixed version (ground truth):
@Override protected void testTaskResults(Task task){
  Assert.assertEquals(ExperimentDAO.TASK_FINISHED,experimentDAO.getExperimentState(experimentTaskId));
  ExperimentTaskResult result=experimentDAO.getTaskResult(experimentTaskId);
  String errorMsg="String_Node_Str" + result.annotator + "String_Node_Str"+ result.dataset+ "String_Node_Str"+ result.type.toString();
  Assert.assertEquals(errorMsg,expectedResults[MACRO_PREC_INDEX],result.getMacroPrecision(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MACRO_REC_INDEX],result.getMacroRecall(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MACRO_F1_INDEX],result.getMacroF1Measure(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MICRO_PREC_INDEX],result.getMicroPrecision(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MICRO_REC_INDEX],result.getMicroRecall(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MICRO_F1_INDEX],result.getMicroF1Measure(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[ERROR_COUNT_INDEX],result.getErrorCount(),DELTA);
}
Program: 33188
Project: 33188
Buggy source:
public InstanceListBasedAnnotator(String annotatorName,List<Document> instances){
  super(annotatorName);
  this.uriInstanceMapping=new HashMap<String,Document>(instances.size());
  for (  Document document : instances) {
    uriInstanceMapping.put(document.getDocumentURI() + document.getText().length(),document);
  }
}

Fixed version (ground truth):
public InstanceListBasedAnnotator(String annotatorName,List<Document> instances){
  super(annotatorName);
  this.uriInstanceMapping=new HashMap<String,Document>(instances.size());
  for (  Document document : instances) {
    uriInstanceMapping.put(generateDocUri(document.getDocumentURI(),document.getText().length()),document);
  }
}
Program: 33189
Project: 33189
Buggy source:
protected Document getDocument(String uri,int textLength){
  String mappingUri=uri + textLength;
  if (uriInstanceMapping.containsKey(mappingUri)) {
    return uriInstanceMapping.get(mappingUri);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
protected Document getDocument(String uri,int textLength){
  String mappingUri=generateDocUri(uri,textLength);
  if (uriInstanceMapping.containsKey(mappingUri)) {
    return uriInstanceMapping.get(mappingUri);
  }
 else {
    return null;
  }
}
Program: 33190
Project: 33190
Buggy source:
@Override protected void testTaskResults(Task task){
  Assert.assertEquals(ExperimentDAO.TASK_FINISHED,experimentDAO.getExperimentState(experimentTaskId));
  ExperimentTaskResult result=experimentDAO.getTaskResult(experimentTaskId);
  String errorMsg="String_Node_Str" + result.annotator + "String_Node_Str"+ result.dataset+ "String_Node_Str"+ result.type.toString();
  Assert.assertEquals(errorMsg,expectedResults[MACRO_PREC_INDEX],result.getMacroPrecision(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MACRO_REC_INDEX],result.getMacroRecall(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MACRO_F1_INDEX],result.getMacroF1Measure(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MICRO_PREC_INDEX],result.getMicroPrecision(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MICRO_REC_INDEX],result.getMicroRecall(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MICRO_F1_INDEX],result.getMicroF1Measure(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[ERROR_COUNT_INDEX],result.getErrorCount(),DELTA);
}

Fixed version (ground truth):
@Override protected void testTaskResults(Task task){
  Assert.assertEquals(ExperimentDAO.TASK_FINISHED,experimentDAO.getExperimentState(experimentTaskId));
  ExperimentTaskResult result=experimentDAO.getTaskResult(experimentTaskId);
  String errorMsg="String_Node_Str" + result.annotator + "String_Node_Str"+ result.dataset+ "String_Node_Str"+ result.type.getName();
  Assert.assertEquals(errorMsg,expectedResults[MACRO_PREC_INDEX],result.getMacroPrecision(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MACRO_REC_INDEX],result.getMacroRecall(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MACRO_F1_INDEX],result.getMacroF1Measure(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MICRO_PREC_INDEX],result.getMicroPrecision(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MICRO_REC_INDEX],result.getMicroRecall(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[MICRO_F1_INDEX],result.getMicroF1Measure(),DELTA);
  Assert.assertEquals(errorMsg,expectedResults[ERROR_COUNT_INDEX],result.getErrorCount(),DELTA);
}
Program: 33191
Project: 33191
Buggy source:
public void analyzeDataset(DatasetConfiguration config) throws GerbilException {
  if (config.isApplicableForExperiment(ExperimentType.D2KB)) {
    analyze(config,ExperimentType.D2KB);
  }
 else   if (config.isApplicableForExperiment(ExperimentType.OKE_Task2)) {
    analyze(config,ExperimentType.OKE_Task2);
  }
 else   if (config.isApplicableForExperiment(ExperimentType.C2KB)) {
    analyze(config,ExperimentType.C2KB);
  }
 else {
    LOGGER.error("String_Node_Str" + config.toString());
  }
}

Fixed version (ground truth):
public void analyzeDataset(DatasetConfiguration config) throws GerbilException {
  if (config.isApplicableForExperiment(ExperimentType.D2KB)) {
    analyze(config,ExperimentType.D2KB);
  }
 else   if (config.isApplicableForExperiment(ExperimentType.ETyping)) {
    analyze(config,ExperimentType.ETyping);
  }
 else   if (config.isApplicableForExperiment(ExperimentType.OKE_Task2)) {
    analyze(config,ExperimentType.OKE_Task2);
  }
 else   if (config.isApplicableForExperiment(ExperimentType.C2KB)) {
    analyze(config,ExperimentType.C2KB);
  }
 else   if (config.isApplicableForExperiment(ExperimentType.ERec)) {
    analyze(config,ExperimentType.ERec);
  }
 else {
    LOGGER.error("String_Node_Str" + config.toString());
  }
}
Program: 33192
Project: 33192
Buggy source:
private int countTokensInText(String text){
  WhitespaceTokenizer tokenizer=new WhitespaceTokenizer();
  tokenizer.setReader(new StringReader(text));
  int tokens=0;
  try {
    while (tokenizer.incrementToken()) {
      ++tokens;
    }
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
 finally {
    IOUtils.closeQuietly(tokenizer);
  }
  return tokens;
}

Fixed version (ground truth):
private int countTokensInText(String text){
  WhitespaceTokenizer tokenizer=new WhitespaceTokenizer();
  tokenizer.setReader(new StringReader(text));
  int tokens=0;
  try {
    tokenizer.reset();
    while (tokenizer.incrementToken()) {
      ++tokens;
    }
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str",e);
  }
 finally {
    IOUtils.closeQuietly(tokenizer);
  }
  return tokens;
}
Program: 33194
Project: 33194
Buggy source:
@Override @SuppressWarnings({"String_Node_Str","String_Node_Str","String_Node_Str"}) protected Evaluator createEvaluator(ExperimentType type,ExperimentTaskConfiguration configuration,Dataset dataset,UriKBClassifier globalClassifier,SubClassInferencer inferencer){
switch (type) {
case D2KB:
{
      return new SearcherBasedNotMatchingMarkingFilter<MeaningSpan>(new StrongSpanMatchingsSearcher<MeaningSpan>(),new ClassifyingEvaluatorDecorator<MeaningSpan,ClassifiedSpanMeaning>(new GSInKBClassifyingEvaluatorDecorator<ClassifiedSpanMeaning>(new ClassConsideringFMeasureCalculator<ClassifiedSpanMeaning>(new MatchingsCounterImpl<ClassifiedSpanMeaning>(new CompoundMatchingsSearcher<ClassifiedSpanMeaning>((MatchingsSearcher<ClassifiedSpanMeaning>)MatchingsSearcherFactory.createSpanMatchingsSearcher(configuration.matching),new ClassifiedMeaningMatchingsSearcher<ClassifiedSpanMeaning>())),MarkingClasses.IN_KB,MarkingClasses.EE,MarkingClasses.GS_IN_KB),new StrongSpanMatchingsSearcher<ClassifiedSpanMeaning>()),new UriBasedMeaningClassifier<ClassifiedSpanMeaning>(globalClassifier,MarkingClasses.IN_KB),new EmergingEntityMeaningClassifier<ClassifiedSpanMeaning>()),true);
    }
case Sa2KB:
case A2KB:
case C2KB:
case ERec:
case ETyping:
case OKE_Task1:
case OKE_Task2:
default :
{
    throw new IllegalArgumentException("String_Node_Str");
  }
}
}

Fixed version (ground truth):
@Override @SuppressWarnings({"String_Node_Str","String_Node_Str","String_Node_Str"}) public Evaluator createEvaluator(ExperimentType type,ExperimentTaskConfiguration configuration,Dataset dataset,UriKBClassifier globalClassifier,SubClassInferencer inferencer){
switch (type) {
case D2KB:
{
      return new SearcherBasedNotMatchingMarkingFilter<MeaningSpan>(new StrongSpanMatchingsSearcher<MeaningSpan>(),new ClassifyingEvaluatorDecorator<MeaningSpan,ClassifiedSpanMeaning>(new GSInKBClassifyingEvaluatorDecorator<ClassifiedSpanMeaning>(new ClassConsideringFMeasureCalculator<ClassifiedSpanMeaning>(new MatchingsCounterImpl<ClassifiedSpanMeaning>(new CompoundMatchingsSearcher<ClassifiedSpanMeaning>((MatchingsSearcher<ClassifiedSpanMeaning>)MatchingsSearcherFactory.createSpanMatchingsSearcher(configuration.matching),new ClassifiedMeaningMatchingsSearcher<ClassifiedSpanMeaning>())),MarkingClasses.IN_KB,MarkingClasses.EE,MarkingClasses.GS_IN_KB),new StrongSpanMatchingsSearcher<ClassifiedSpanMeaning>()),new UriBasedMeaningClassifier<ClassifiedSpanMeaning>(globalClassifier,MarkingClasses.IN_KB),new EmergingEntityMeaningClassifier<ClassifiedSpanMeaning>()),true);
    }
case Sa2KB:
case A2KB:
case C2KB:
case ERec:
case ETyping:
case OKE_Task1:
case OKE_Task2:
default :
{
    throw new IllegalArgumentException("String_Node_Str");
  }
}
}
Program: 33195
Project: 33195
Buggy source:
public void runTest(int experimentTaskId,ExperimentDAO experimentDAO,SameAsRetriever sameAsRetriever,EvaluatorFactory evFactory,ExperimentTaskConfiguration configuration,TaskObserver observer){
  ExperimentTask task=new ExperimentTask(experimentTaskId,experimentDAO,sameAsRetriever,evFactory,configuration);
  Overseer overseer=new SimpleOverseer();
  overseer.addObserver(observer);
  @SuppressWarnings("String_Node_Str") Reporter reporter=new LogReporter(overseer);
  overseer.startTask(task);
  try {
    mutex.acquire();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
  Assert.assertNull("String_Node_Str" + testError,testError);
  SameAsRetrieverSingleton4Tests.storeCache();
}

Fixed version (ground truth):
public void runTest(int experimentTaskId,ExperimentDAO experimentDAO,SameAsRetriever sameAsRetriever,EvaluatorFactory evFactory,ExperimentTaskConfiguration configuration,TaskObserver observer){
  ExperimentTask task=new ExperimentTask(experimentTaskId,experimentDAO,sameAsRetriever,evFactory,configuration);
  Overseer overseer=new SimpleOverseer();
  overseer.addObserver(observer);
  @SuppressWarnings("String_Node_Str") Reporter reporter=new LogReporter(overseer);
  overseer.startTask(task);
  try {
    mutex.acquire();
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
  Assert.assertNull("String_Node_Str" + testError + "String_Node_Str"+ configuration.toString(),testError);
  SameAsRetrieverSingleton4Tests.storeCache();
}
Program: 33196
Project: 33196
Buggy source:
@Override @SuppressWarnings({"String_Node_Str","String_Node_Str","String_Node_Str"}) protected Evaluator createEvaluator(ExperimentType type,ExperimentTaskConfiguration configuration,Dataset dataset,UriKBClassifier globalClassifier,SubClassInferencer inferencer){
switch (type) {
case D2KB:
{
      return new SearcherBasedNotMatchingMarkingFilter<MeaningSpan>(new StrongSpanMatchingsSearcher<MeaningSpan>(),new ClassifyingEvaluatorDecorator<MeaningSpan,ClassifiedSpanMeaning>(new GSInKBClassifyingEvaluatorDecorator<ClassifiedSpanMeaning>(new ClassConsideringFMeasureCalculator<ClassifiedSpanMeaning>(new MatchingsCounterImpl<ClassifiedSpanMeaning>(new CompoundMatchingsSearcher<ClassifiedSpanMeaning>((MatchingsSearcher<ClassifiedSpanMeaning>)MatchingsSearcherFactory.createSpanMatchingsSearcher(configuration.matching),new ClassifiedMeaningMatchingsSearcher<ClassifiedSpanMeaning>())),MarkingClasses.IN_KB,MarkingClasses.EE,MarkingClasses.GS_IN_KB),new StrongSpanMatchingsSearcher<ClassifiedSpanMeaning>()),new UriBasedMeaningClassifier<ClassifiedSpanMeaning>(globalClassifier,MarkingClasses.IN_KB),new EmergingEntityMeaningClassifier<ClassifiedSpanMeaning>()),true);
    }
case Sa2KB:
case A2KB:
case C2KB:
case ERec:
case ETyping:
case OKE_Task1:
case OKE_Task2:
default :
{
    throw new IllegalArgumentException("String_Node_Str");
  }
}
}

Fixed version (ground truth):
@Override @SuppressWarnings({"String_Node_Str","String_Node_Str","String_Node_Str"}) public Evaluator createEvaluator(ExperimentType type,ExperimentTaskConfiguration configuration,Dataset dataset,UriKBClassifier globalClassifier,SubClassInferencer inferencer){
switch (type) {
case D2KB:
{
      return new SearcherBasedNotMatchingMarkingFilter<MeaningSpan>(new StrongSpanMatchingsSearcher<MeaningSpan>(),new ClassifyingEvaluatorDecorator<MeaningSpan,ClassifiedSpanMeaning>(new GSInKBClassifyingEvaluatorDecorator<ClassifiedSpanMeaning>(new ClassConsideringFMeasureCalculator<ClassifiedSpanMeaning>(new MatchingsCounterImpl<ClassifiedSpanMeaning>(new CompoundMatchingsSearcher<ClassifiedSpanMeaning>((MatchingsSearcher<ClassifiedSpanMeaning>)MatchingsSearcherFactory.createSpanMatchingsSearcher(configuration.matching),new ClassifiedMeaningMatchingsSearcher<ClassifiedSpanMeaning>())),MarkingClasses.IN_KB,MarkingClasses.EE,MarkingClasses.GS_IN_KB),new StrongSpanMatchingsSearcher<ClassifiedSpanMeaning>()),new UriBasedMeaningClassifier<ClassifiedSpanMeaning>(globalClassifier,MarkingClasses.IN_KB),new EmergingEntityMeaningClassifier<ClassifiedSpanMeaning>()),true);
    }
case Sa2KB:
case A2KB:
case C2KB:
case ERec:
case ETyping:
case OKE_Task1:
case OKE_Task2:
default :
{
    throw new IllegalArgumentException("String_Node_Str");
  }
}
}
Program: 33197
Project: 33197
Buggy source:
public void close() throws IOException {
  indexReader.close();
}

Fixed version (ground truth):
public void close() throws IOException {
  IOUtils.closeQuietly(indexReader);
  IOUtils.closeQuietly(indexDirectory);
}
Program: 33198
Project: 33198
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @RequestMapping("String_Node_Str") public @ResponseBody String testWebService(@RequestParam(value="String_Node_Str") String experimentType,@RequestParam(value="String_Node_Str") String url){
  LOGGER.info("String_Node_Str",url,experimentType);
  NIFBasedAnnotatorWebservice annotator=new NIFBasedAnnotatorWebservice(url,"String_Node_Str");
  JSONObject result=new JSONObject();
  Document document=new DocumentImpl();
  document.setText(NIF_WS_TEST_TEXT);
  try {
switch (ExperimentType.valueOf(experimentType)) {
case Rc2KB:
case Sc2KB:
case C2KB:
{
        annotator.performC2KB(document);
        break;
      }
case D2KB:
{
      annotator.performD2KBTask(document);
      break;
    }
case A2KB:
case Sa2KB:
{
    annotator.performA2KBTask(document);
    break;
  }
case ERec:
{
  annotator.performRecognition(document);
  break;
}
case OKE_Task1:
{
annotator.performTask1(document);
break;
}
case OKE_Task2:
{
annotator.performTask2(document);
break;
}
default :
{
throw new IllegalArgumentException("String_Node_Str" + experimentType + "String_Node_Str");
}
}
result.put(RETURN_STATUS_NAME,true);
}
 catch (Exception e) {
LOGGER.error("String_Node_Str",url,e);
result.put(RETURN_STATUS_NAME,false);
result.put(RETURN_ERROR_MSG_NAME,e.getMessage());
}
 finally {
try {
annotator.close();
}
 catch (IOException e) {
}
}
return JSONValue.toJSONString(result);
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @RequestMapping("String_Node_Str") public @ResponseBody String testWebService(@RequestParam(value="String_Node_Str") String experimentType,@RequestParam(value="String_Node_Str") String url){
  LOGGER.info("String_Node_Str",url,experimentType);
  NIFBasedAnnotatorWebservice annotator=new NIFBasedAnnotatorWebservice(url,"String_Node_Str");
  JSONObject result=new JSONObject();
  Document document=new DocumentImpl();
  document.setText(NIF_WS_TEST_TEXT);
  try {
switch (ExperimentType.valueOf(experimentType)) {
case Rc2KB:
case Sc2KB:
case C2KB:
{
        annotator.performC2KB(document);
        break;
      }
case D2KB:
{
      annotator.performD2KBTask(document);
      break;
    }
case A2KB:
case Sa2KB:
{
    annotator.performA2KBTask(document);
    break;
  }
case ERec:
{
  annotator.performRecognition(document);
  break;
}
case OKE_Task1:
{
annotator.performTask1(document);
break;
}
case OKE_Task2:
{
annotator.performTask2(document);
break;
}
case ETyping:
{
annotator.performTyping(document);
}
default :
{
throw new IllegalArgumentException("String_Node_Str" + experimentType + "String_Node_Str");
}
}
result.put(RETURN_STATUS_NAME,true);
}
 catch (Exception e) {
LOGGER.error("String_Node_Str",url,e);
result.put(RETURN_STATUS_NAME,false);
result.put(RETURN_ERROR_MSG_NAME,e.getMessage());
}
 finally {
try {
annotator.close();
}
 catch (IOException e) {
}
}
return JSONValue.toJSONString(result);
}
Program: 33199
Project: 33199
Buggy source:
public static List<Marking> findMarkings(String tweet){
  int start=0;
  List<Marking> markings=new ArrayList<Marking>();
  String[] line=tweet.split("String_Node_Str");
  for (  String tokenFull : line) {
    String[] token=tokenFull.split("String_Node_Str");
    token[1]=token[1].trim();
    if (!token[1].trim().equals("String_Node_Str") && !token[1].trim().equals("String_Node_Str")) {
      markings.add(new NamedEntity(start,token[0].length(),token[1]));
    }
    start+=tokenFull.length() + 1;
  }
  return markings;
}

Fixed version (ground truth):
public static List<Marking> findMarkings(String tweet){
  int start=0;
  List<Marking> markings=new ArrayList<Marking>();
  realTweet=new StringBuilder();
  String[] line=tweet.split("String_Node_Str");
  for (  String tokenFull : line) {
    String[] token=tokenFull.split("String_Node_Str");
    realTweet.append(token[0] + "String_Node_Str");
    token[1]=token[1].trim();
    if (!token[1].trim().equals("String_Node_Str") && !token[1].trim().equals("String_Node_Str")) {
      markings.add(new NamedEntity(start,token[0].length(),token[1]));
    }
    start+=tokenFull.length() + 1;
  }
  return markings;
}
Program: 33200
Project: 33200
Buggy source:
protected List<Document> loadDocuments(File tweetsFile) throws GerbilException {
  BufferedReader bReader=null;
  CSVReader reader=null;
  List<Document> documents=new ArrayList<Document>();
  String documentUriPrefix="String_Node_Str" + getName() + "String_Node_Str";
  try {
    bReader=new BufferedReader(new InputStreamReader(new FileInputStream(tweetsFile),Charset.forName("String_Node_Str")));
    reader=new CSVReader(bReader,SEPARATION_CHAR);
    String line[]=reader.readNext();
    int tweetIndex=0;
    List<Marking> markings=new ArrayList<Marking>();
    StringBuilder tweet=new StringBuilder("String_Node_Str").append(line[0]);
    while (line != null) {
      if (line.length == 0) {
        findMarkings(tweet.toString());
        documents.add(new DocumentImpl(tweet.toString(),documentUriPrefix + tweetIndex,markings));
        tweet.delete(0,tweet.length());
        tweetIndex++;
      }
      line=reader.readNext();
    }
  }
 catch (  IOException e) {
    throw new GerbilException("String_Node_Str",e,ErrorTypes.DATASET_LOADING_ERROR);
  }
 finally {
    IOUtils.closeQuietly(reader);
    IOUtils.closeQuietly(bReader);
  }
  return documents;
}

Fixed version (ground truth):
protected List<Document> loadDocuments(File tweetsFile) throws GerbilException {
  BufferedReader reader=null;
  List<Document> documents=new ArrayList<Document>();
  String documentUriPrefix="String_Node_Str" + getName() + "String_Node_Str";
  try {
    reader=new BufferedReader(new InputStreamReader(new FileInputStream(tweetsFile),Charset.forName("String_Node_Str")));
    String line=reader.readLine();
    int tweetIndex=0;
    List<Marking> markings=new ArrayList<Marking>();
    StringBuilder tweet=new StringBuilder("String_Node_Str").append(line);
    while (line != null) {
      if (line.trim().isEmpty()) {
        markings=findMarkings(tweet.toString());
        documents.add(new DocumentImpl(realTweet.toString(),documentUriPrefix + tweetIndex,markings));
        tweet.delete(0,tweet.length());
        line=reader.readLine();
        tweetIndex++;
        continue;
      }
      tweet.append(line + "String_Node_Str");
      line=reader.readLine();
    }
  }
 catch (  IOException e) {
    throw new GerbilException("String_Node_Str",e,ErrorTypes.DATASET_LOADING_ERROR);
  }
 finally {
    IOUtils.closeQuietly(reader);
  }
  return documents;
}
Program: 33201
Project: 33201
Buggy source:
public static void index(Indexer index,Searcher search) throws GerbilException {
  int offset=0, limit=20000;
  boolean test=true;
  Query q=QueryFactory.create(SPARQL_GET);
  q.setLimit(limit);
  Set<String> sameAsBlock=new HashSet<String>();
  RDFNode old=null;
  do {
    q.setOffset(offset);
    QueryExecution qexec=QueryExecutionFactory.sparqlService(service,q);
    ResultSet res=qexec.execSelect();
    int size=0;
    while (res.hasNext()) {
      size++;
      QuerySolution solution=res.next();
      RDFNode node1=solution.get("String_Node_Str");
      RDFNode node2=solution.get("String_Node_Str");
      if (node1.equals(old)) {
        sameAsBlock.add(node2.toString());
      }
 else       if (old != null) {
        if (!search.search(old.toString()).isEmpty()) {
          index.index(sameAsBlock);
        }
        sameAsBlock.clear();
        sameAsBlock.add(node1.toString());
      }
 else {
        sameAsBlock.add(node1.toString());
      }
    }
    if (size < limit) {
      test=false;
    }
    offset+=limit;
  }
 while (test);
  if (!sameAsBlock.isEmpty()) {
    index.index(sameAsBlock);
    sameAsBlock.clear();
  }
}

Fixed version (ground truth):
public static void index(Indexer index,Searcher search) throws GerbilException {
  int offset=0, limit=10000;
  boolean test=true;
  Query q=QueryFactory.create(SPARQL_GET);
  q.setLimit(limit);
  Set<String> sameAsBlock=new HashSet<String>();
  RDFNode old=null;
  int rounds=0, size=0;
  long total=0;
  do {
    q.setOffset(offset);
    QueryExecution qexec=QueryExecutionFactory.sparqlService(service,q);
    ResultSet res=qexec.execSelect();
    size=0;
    rounds++;
    while (res.hasNext()) {
      size++;
      QuerySolution solution=res.next();
      RDFNode node1=solution.get("String_Node_Str");
      RDFNode node2=solution.get("String_Node_Str");
      if (node1.equals(old)) {
        sameAsBlock.add(node2.toString());
      }
 else       if (old != null) {
        if (search.search(old.toString()).isEmpty()) {
          index.index(sameAsBlock);
          total+=sameAsBlock.size();
        }
        sameAsBlock.clear();
        sameAsBlock.add(node1.toString());
        old=node1;
      }
 else {
        sameAsBlock.add(node1.toString());
        sameAsBlock.add(node2.toString());
        old=node1;
      }
    }
    if (size < limit) {
      test=false;
    }
    offset+=limit;
    LOGGER.info("String_Node_Str",size,limit * (rounds - 1) + size);
  }
 while (test);
  if (!sameAsBlock.isEmpty()) {
    index.index(sameAsBlock);
    sameAsBlock.clear();
  }
  LOGGER.info("String_Node_Str",total);
}
Program: 33202
Project: 33202
Buggy source:
public static void main(String[] args) throws GerbilException {
  Indexer index=new Indexer(OUTPUT_FOLDER,STRATEGY);
  Searcher search=new Searcher(OUTPUT_FOLDER,STRATEGY);
  index(index,search);
}

Fixed version (ground truth):
public static void main(String[] args) throws GerbilException {
  Indexer index=new Indexer(OUTPUT_FOLDER,STRATEGY);
  Searcher search=new Searcher(OUTPUT_FOLDER,STRATEGY);
  SimpleDateFormat format=new SimpleDateFormat();
  LOGGER.info("String_Node_Str",format.format(Calendar.getInstance().getTime()));
  index(index,search);
  LOGGER.info("String_Node_Str",format.format(Calendar.getInstance().getTime()));
}
Program: 33203
Project: 33203
Buggy source:
public static List<Marking> findMarkings(String tweet){
  int start=0;
  List<Marking> markings=new ArrayList<Marking>();
  realTweet=new StringBuilder();
  String[] line=tweet.split("String_Node_Str");
  for (  String tokenFull : line) {
    String[] token=tokenFull.split("String_Node_Str");
    realTweet.append(token[0] + "String_Node_Str");
    token[1]=token[1].trim();
    if (!token[1].trim().equals("String_Node_Str") && !token[1].trim().equals("String_Node_Str")) {
      markings.add(new NamedEntity(start,token[0].length(),token[1]));
    }
    start+=tokenFull.length() + 1;
  }
  return markings;
}

Fixed version (ground truth):
public static List<Marking> findMarkings(String tweet){
  int start=0;
  List<Marking> markings=new ArrayList<Marking>();
  realTweet=new StringBuilder();
  String[] line=tweet.split("String_Node_Str");
  int i=0;
  for (  String tokenFull : line) {
    String[] token=tokenFull.split("String_Node_Str");
    realTweet.append(token[0] + "String_Node_Str");
    token[1]=token[1].trim();
    if (token.length > 2 && token[2].startsWith("String_Node_Str")) {
      String[] marking=getWholeMarking(line,i);
      Set<String> types=new HashSet<String>();
      types.add(marking[2]);
      markings.add(new TypedNamedEntity(start,marking[0].length(),marking[1],types));
    }
    start+=token[0].length() + 1;
    i++;
  }
  return markings;
}
Program: 33205
Project: 33205
Buggy source:
@Override public void evaluate(List<List<T>> annotatorResults,List<List<T>> goldStandard,EvaluationResultContainer results){
  ScoredEvaluationCountsArray counts=generateMatchingCounts(annotatorResults,goldStandard);
  double threshold=calculateMicroFMeasure(counts,results);
  calculateMacroFMeasure(counts,results,threshold);
}

Fixed version (ground truth):
@Override public void evaluate(List<List<T>> annotatorResults,List<List<T>> goldStandard,EvaluationResultContainer results){
  ScoredEvaluationCountsArray counts=generateMatchingCounts(annotatorResults,goldStandard);
  if ((counts.truePositiveSums.length > 0) && (counts.falseNegativeSums.length > 0) && (counts.falsePositiveSums.length > 0)) {
    double threshold=calculateMicroFMeasure(counts,results);
    calculateMacroFMeasure(counts,results,threshold);
  }
}
Program: 33207
Project: 33207
Buggy source:
@Override public Dataset getDataset(ExperimentType experimentType) throws GerbilException {
  if (applicableForExperiment.equalsOrContainsType(experimentType)) {
    try {
      return loadDataset();
    }
 catch (    Exception e) {
      throw new GerbilException(e,ErrorTypes.DATASET_LOADING_ERROR);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public Dataset getDataset(ExperimentType experimentType) throws GerbilException {
  if (applicableForExperiment.equalsOrContainsType(experimentType)) {
    try {
      return getPreparedDataset();
    }
 catch (    Exception e) {
      throw new GerbilException(e,ErrorTypes.DATASET_LOADING_ERROR);
    }
  }
  return null;
}