Program: 185931
Project: 185931
Buggy source:
private void recordProblems(List<?> errors){
  List<Message> errorsRecorded=new ArrayList<Message>();
  for (Iterator<?> iterator=errors.iterator(); iterator.hasNext(); ) {
    SyntaxException syntaxException=null;
    Message message=(Message)iterator.next();
    StringWriter sw=new StringWriter();
    message.write(new PrintWriter(sw));
    String msg=sw.toString();
    CategorizedProblem p=null;
    int line=0;
    int sev=0;
    int scol=0;
    int ecol=0;
    if (message instanceof LocatedMessage) {
      CSTNode context=((LocatedMessage)message).getContext();
      if (context instanceof Token) {
        line=context.getStartLine();
        scol=context.getStartColumn();
        String text=((Token)context).getText();
        ecol=scol + (text == null ? 1 : (text.length() - 1));
      }
    }
    if (message instanceof SimpleMessage) {
      SimpleMessage simpleMessage=(SimpleMessage)message;
      sev|=ProblemSeverities.Error;
      String simpleText=simpleMessage.getMessage();
      if (simpleText.length() > 1 && simpleText.charAt(0) == '\n') {
        simpleText=simpleText.substring(1);
      }
      msg="String_Node_Str" + simpleText;
      if (msg.indexOf("String_Node_Str") != -1) {
        msg=msg.substring(0,msg.indexOf("String_Node_Str"));
      }
    }
    if (message instanceof SyntaxErrorMessage) {
      SyntaxErrorMessage errorMessage=(SyntaxErrorMessage)message;
      syntaxException=errorMessage.getCause();
      sev|=ProblemSeverities.Error;
      String actualMessage=syntaxException.getMessage();
      if (actualMessage.length() > 1 && actualMessage.charAt(0) == '\n') {
        actualMessage=actualMessage.substring(1);
      }
      msg="String_Node_Str" + actualMessage;
      if (msg.indexOf("String_Node_Str") != -1) {
        msg=msg.substring(0,msg.indexOf("String_Node_Str"));
      }
      line=syntaxException.getLine();
      scol=errorMessage.getCause().getStartColumn();
      ecol=errorMessage.getCause().getEndColumn() - 1;
    }
    int soffset=-1;
    int eoffset=-1;
    if (message instanceof ExceptionMessage) {
      ExceptionMessage em=(ExceptionMessage)message;
      sev|=ProblemSeverities.Error;
      if (em.getCause() instanceof RuntimeParserException) {
        RuntimeParserException rpe=(RuntimeParserException)em.getCause();
        sev|=ProblemSeverities.Error;
        msg="String_Node_Str" + rpe.getMessage();
        if (msg.indexOf("String_Node_Str") != -1) {
          msg=msg.substring(0,msg.indexOf("String_Node_Str"));
        }
        ModuleNode errorModuleNode=rpe.getModule();
        ModuleNode thisModuleNode=this.getModuleNode();
        if (!errorModuleNode.equals(thisModuleNode)) {
          continue;
        }
        soffset=rpe.getNode().getStart();
        eoffset=rpe.getNode().getEnd() - 1;
        line=0;
        while (compilationResult.lineSeparatorPositions[line] < soffset && line < compilationResult.lineSeparatorPositions.length) {
          line++;
        }
        line++;
      }
    }
    if (syntaxException instanceof PreciseSyntaxException) {
      soffset=((PreciseSyntaxException)syntaxException).getStartOffset();
      eoffset=((PreciseSyntaxException)syntaxException).getEndOffset();
      line=0;
      while (line < compilationResult.lineSeparatorPositions.length && compilationResult.lineSeparatorPositions[line] < soffset) {
        line++;
      }
      ;
      line++;
    }
 else {
      if (soffset == -1) {
        soffset=getOffset(compilationResult.lineSeparatorPositions,line,scol);
      }
      if (eoffset == -1) {
        eoffset=getOffset(compilationResult.lineSeparatorPositions,line,ecol);
      }
    }
    if (soffset > eoffset) {
      eoffset=soffset;
    }
    if (soffset > sourceEnd) {
      soffset=sourceEnd;
      eoffset=sourceEnd;
    }
    char[] filename=getFileName();
    p=new DefaultProblemFactory().createProblem(filename,0,new String[]{msg},0,new String[]{msg},sev,soffset,eoffset,line,scol);
    this.problemReporter.record(p,compilationResult,this,false);
    errorsRecorded.add(message);
    log(String.valueOf(compilationResult.getFileName()) + "String_Node_Str" + line+ "String_Node_Str"+ msg);
  }
  errors.removeAll(errorsRecorded);
}

Fixed version (ground truth):
private void recordProblems(List<?> errors){
  List<Message> errorsRecorded=new ArrayList<Message>();
  for (Iterator<?> iterator=errors.iterator(); iterator.hasNext(); ) {
    SyntaxException syntaxException=null;
    Message message=(Message)iterator.next();
    StringWriter sw=new StringWriter();
    message.write(new PrintWriter(sw));
    String msg=sw.toString();
    CategorizedProblem p=null;
    int line=0;
    int sev=0;
    int scol=0;
    int ecol=0;
    if (message instanceof LocatedMessage) {
      CSTNode context=((LocatedMessage)message).getContext();
      if (context instanceof Token) {
        line=context.getStartLine();
        scol=context.getStartColumn();
        String text=((Token)context).getText();
        ecol=scol + (text == null ? 1 : (text.length() - 1));
      }
    }
    if (message instanceof SimpleMessage) {
      SimpleMessage simpleMessage=(SimpleMessage)message;
      sev|=ProblemSeverities.Error;
      String simpleText=simpleMessage.getMessage();
      if (simpleText.length() > 1 && simpleText.charAt(0) == '\n') {
        simpleText=simpleText.substring(1);
      }
      msg="String_Node_Str" + simpleText;
      if (msg.indexOf("String_Node_Str") != -1) {
        msg=msg.substring(0,msg.indexOf("String_Node_Str"));
      }
    }
    if (message instanceof SyntaxErrorMessage) {
      SyntaxErrorMessage errorMessage=(SyntaxErrorMessage)message;
      syntaxException=errorMessage.getCause();
      sev|=ProblemSeverities.Error;
      String actualMessage=syntaxException.getMessage();
      if (actualMessage.length() > 1 && actualMessage.charAt(0) == '\n') {
        actualMessage=actualMessage.substring(1);
      }
      msg="String_Node_Str" + actualMessage;
      if (msg.indexOf("String_Node_Str") != -1) {
        msg=msg.substring(0,msg.indexOf("String_Node_Str"));
      }
      line=syntaxException.getLine();
      scol=errorMessage.getCause().getStartColumn();
      ecol=errorMessage.getCause().getEndColumn() - 1;
    }
    int soffset=-1;
    int eoffset=-1;
    if (message instanceof ExceptionMessage) {
      ExceptionMessage em=(ExceptionMessage)message;
      sev|=ProblemSeverities.Error;
      if (em.getCause() instanceof RuntimeParserException) {
        RuntimeParserException rpe=(RuntimeParserException)em.getCause();
        sev|=ProblemSeverities.Error;
        msg="String_Node_Str" + rpe.getMessage();
        if (msg.indexOf("String_Node_Str") != -1) {
          msg=msg.substring(0,msg.indexOf("String_Node_Str"));
        }
        ModuleNode errorModuleNode=rpe.getModule();
        ModuleNode thisModuleNode=this.getModuleNode();
        if (!errorModuleNode.equals(thisModuleNode)) {
          continue;
        }
        soffset=rpe.getNode().getStart();
        eoffset=rpe.getNode().getEnd() - 1;
        line=0;
        while (compilationResult.lineSeparatorPositions[line] < soffset && line < compilationResult.lineSeparatorPositions.length) {
          line++;
        }
        line++;
      }
    }
    if (syntaxException instanceof PreciseSyntaxException) {
      soffset=((PreciseSyntaxException)syntaxException).getStartOffset();
      eoffset=((PreciseSyntaxException)syntaxException).getEndOffset();
      line=0;
      while (line < compilationResult.lineSeparatorPositions.length && compilationResult.lineSeparatorPositions[line] < soffset) {
        line++;
      }
      ;
      line++;
    }
 else {
      if (soffset == -1) {
        soffset=getOffset(compilationResult.lineSeparatorPositions,line,scol);
      }
      if (eoffset == -1) {
        eoffset=getOffset(compilationResult.lineSeparatorPositions,line,ecol);
      }
    }
    if (soffset > eoffset) {
      eoffset=soffset;
    }
    if (soffset > sourceEnd) {
      soffset=sourceEnd;
      eoffset=sourceEnd;
    }
    p=new DefaultProblemFactory().createProblem(getFileName(),0,new String[]{msg},0,new String[]{msg},sev,soffset,eoffset,line,scol);
    problemReporter.record(p,compilationResult,this,false);
    errorsRecorded.add(message);
    log(String.valueOf(compilationResult.getFileName()) + "String_Node_Str" + line+ "String_Node_Str"+ msg);
  }
  errors.removeAll(errorsRecorded);
}