Program: 33206
Project: 33206
Buggy source:
protected List<Document> loadDocuments(File file) throws GerbilException {
  String documentUriPrefix="String_Node_Str" + getName() + "String_Node_Str";
  BufferedReader bReader=null;
  CSVReader reader=null;
  List<Document> documents=new ArrayList<Document>();
  try {
    bReader=new BufferedReader(new InputStreamReader(new FileInputStream(file),Charset.forName("String_Node_Str")));
    reader=new CSVReader(bReader,SEPARATION_CHAR,QUOTATION_CHAR);
    String line[];
    Document currentDoc=null;
    StringBuilder textBuilder=new StringBuilder();
    List<Marking> markings=null;
    NamedEntity lastNE=null;
    Set<String> uris;
    line=reader.readNext();
    while (line != null) {
      if (line.length > TEXT_INDEX) {
        if (line[TEXT_INDEX].startsWith(DOCUMENT_START_TAG)) {
          if (currentDoc != null) {
            currentDoc.setText(textBuilder.toString().trim());
            textBuilder.setLength(0);
          }
          markings=new ArrayList<Marking>();
          currentDoc=new DocumentImpl(null,documentUriPrefix + documents.size(),markings);
          documents.add(currentDoc);
        }
 else {
          if (!line[TEXT_INDEX].isEmpty()) {
            if ((textBuilder.length() > 0) && (line[TEXT_INDEX].length() >= 1) && (Character.isLetterOrDigit(line[TEXT_INDEX].charAt(0)))) {
              textBuilder.append(' ');
            }
            if ((line.length > NE_TYPE_INDEX) && !line[NE_TYPE_INDEX].isEmpty()) {
              if (line[NE_TYPE_INDEX].equals(ANNOTATION_FIRST_WORD_TAG)) {
                if (line[ANNOTATION_TITLE_INDEX].equals(ANNOTATION_NOT_IN_WIKI_TAG)) {
                  uris=generateArtificialUri(documentUriPrefix,line[ANNOTATION_SURFACE_FORM_INDEX]);
                }
 else {
                  uris=WikipediaHelper.generateUriSet(line[ANNOTATION_TITLE_INDEX]);
                }
                lastNE=new NamedEntity(textBuilder.length(),0,uris);
                markings.add(lastNE);
              }
            }
 else {
              lastNE=null;
            }
            textBuilder.append(line[TEXT_INDEX]);
            if (lastNE != null) {
              lastNE.setLength(textBuilder.length() - lastNE.getStartPosition());
            }
          }
        }
      }
      line=reader.readNext();
    }
    if (currentDoc != null) {
      currentDoc.setText(textBuilder.toString().trim());
      textBuilder.setLength(0);
    }
  }
 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 file) throws GerbilException {
  String documentUriPrefix="String_Node_Str" + getName() + "String_Node_Str";
  BufferedReader bReader=null;
  CSVReader reader=null;
  List<Document> documents=new ArrayList<Document>();
  try {
    bReader=new BufferedReader(new InputStreamReader(new FileInputStream(file),Charset.forName("String_Node_Str")));
    reader=new CSVReader(bReader,SEPARATION_CHAR,QUOTATION_CHAR);
    String line[];
    Document currentDoc=null;
    StringBuilder textBuilder=new StringBuilder();
    List<Marking> markings=null;
    NamedEntity lastNE=null;
    Set<String> uris;
    line=reader.readNext();
    while (line != null) {
      if (line.length > TEXT_INDEX) {
        if (line[TEXT_INDEX].startsWith(DOCUMENT_START_TAG)) {
          if (currentDoc != null) {
            currentDoc.setText(textBuilder.toString().trim());
            textBuilder.setLength(0);
          }
          markings=new ArrayList<Marking>();
          currentDoc=new DocumentImpl(null,documentUriPrefix + documents.size(),markings);
          documents.add(currentDoc);
        }
 else {
          if (!line[TEXT_INDEX].isEmpty()) {
            if ((textBuilder.length() > 0) && (line[TEXT_INDEX].length() >= 1) && (Character.isLetterOrDigit(line[TEXT_INDEX].charAt(0)))) {
              textBuilder.append(' ');
            }
            if ((line.length > NE_TYPE_INDEX) && !line[NE_TYPE_INDEX].isEmpty()) {
              if (line[NE_TYPE_INDEX].equals(ANNOTATION_FIRST_WORD_TAG)) {
                if (line[ANNOTATION_TITLE_INDEX].equals(ANNOTATION_NOT_IN_WIKI_TAG)) {
                  uris=generateArtificialUri(documentUriPrefix,line[ANNOTATION_SURFACE_FORM_INDEX]);
                }
 else {
                  if (line[ANNOTATION_URI_INDEX].startsWith(WIKIPEDIA_URI_START)) {
                    uris=WikipediaHelper.generateUriSet(line[ANNOTATION_URI_INDEX].substring(WIKIPEDIA_URI_START.length()));
                  }
 else {
                    LOGGER.warn("String_Node_Str",line[ANNOTATION_URI_INDEX]);
                    uris=new HashSet<String>();
                  }
                  uris.add(line[ANNOTATION_URI_INDEX]);
                }
                lastNE=new NamedEntity(textBuilder.length(),0,uris);
                markings.add(lastNE);
              }
            }
 else {
              lastNE=null;
            }
            textBuilder.append(line[TEXT_INDEX]);
            if (lastNE != null) {
              lastNE.setLength(textBuilder.length() - lastNE.getStartPosition());
            }
          }
        }
      }
      line=reader.readNext();
    }
    if (currentDoc != null) {
      currentDoc.setText(textBuilder.toString().trim());
      textBuilder.setLength(0);
    }
  }
 catch (  IOException e) {
    throw new GerbilException("String_Node_Str",e,ErrorTypes.DATASET_LOADING_ERROR);
  }
 finally {
    IOUtils.closeQuietly(reader);
    IOUtils.closeQuietly(bReader);
  }
  return documents;
}