nus-yam/ex-repair huggingface dataset:
Program: 189140
Project: 189140
Buggy source:
private List<RenderedMatch> findNonSubstringMatches(List<RenderedMatch> renderedMatches){
  Collections.sort(renderedMatches,new Comparator<RenderedMatch>(){
    @Override public int compare(    RenderedMatch renderedMatch,    RenderedMatch renderedMatch2){
      int length1=renderedMatch.getEnd() - renderedMatch.getStart();
      int length2=renderedMatch2.getEnd() - renderedMatch.getEnd();
      return length2 - length1;
    }
  }
);
  ArrayList<RenderedMatch> out=new ArrayList<RenderedMatch>(renderedMatches.size());
  for (  RenderedMatch match : renderedMatches) {
    boolean addMatch=true;
    Iterator<RenderedMatch> superIter=out.iterator();
    while (superIter.hasNext()) {
      RenderedMatch supermatch=superIter.next();
      if (match.getStart() >= supermatch.getStart() && match.getEnd() <= supermatch.getEnd()) {
        addMatch=false;
        break;
      }
 else       if ((match.getStart() > supermatch.getStart() && match.getStart() < supermatch.getEnd()) || (match.getEnd() > supermatch.getStart() && match.getEnd() < supermatch.getEnd())) {
        addMatch=false;
        superIter.remove();
        break;
      }
    }
    if (addMatch) {
      out.add(match);
    }
  }
  return out;
}

Fixed version (ground truth):
private List<RenderedMatch> findNonSubstringMatches(List<RenderedMatch> renderedMatches){
  Collections.sort(renderedMatches,new Comparator<RenderedMatch>(){
    @Override public int compare(    RenderedMatch renderedMatch,    RenderedMatch renderedMatch2){
      int length1=renderedMatch.getEnd() - renderedMatch.getStart();
      int length2=renderedMatch2.getEnd() - renderedMatch2.getStart();
      return length2 - length1;
    }
  }
);
  ArrayList<RenderedMatch> out=new ArrayList<RenderedMatch>(renderedMatches.size());
  for (  RenderedMatch match : renderedMatches) {
    boolean addMatch=true;
    Iterator<RenderedMatch> superIter=out.iterator();
    while (superIter.hasNext()) {
      RenderedMatch supermatch=superIter.next();
      if (match.getStart() >= supermatch.getStart() && match.getEnd() <= supermatch.getEnd()) {
        addMatch=false;
        break;
      }
 else       if ((match.getStart() > supermatch.getStart() && match.getStart() < supermatch.getEnd()) || (match.getEnd() > supermatch.getStart() && match.getEnd() < supermatch.getEnd())) {
        addMatch=false;
        superIter.remove();
        break;
      }
    }
    if (addMatch) {
      out.add(match);
    }
  }
  return out;
}
Program: 189141
Project: 189141
Buggy source:
@Override public int compare(RenderedMatch renderedMatch,RenderedMatch renderedMatch2){
  int length1=renderedMatch.getEnd() - renderedMatch.getStart();
  int length2=renderedMatch2.getEnd() - renderedMatch.getEnd();
  return length1 - length2;
}

Fixed version (ground truth):
@Override public int compare(RenderedMatch renderedMatch,RenderedMatch renderedMatch2){
  int length1=renderedMatch.getEnd() - renderedMatch.getStart();
  int length2=renderedMatch2.getEnd() - renderedMatch.getEnd();
  return length2 - length1;
}
Program: 189142
Project: 189142
Buggy source:
void renderField(String field,String content,List<String> matches,StringBuffer out){
  List<RenderedMatch> renderedMatches=new LinkedList<RenderedMatch>();
  for (  String match : matches) {
    renderedMatches.addAll(renderMatch(field,content,match));
  }
  if (renderedMatches.size() == 0) {
    out.append("String_Node_Str");
    return;
  }
  renderedMatches=findNonSubstringMatches(renderedMatches);
  Collections.sort(renderedMatches);
  int renderStart=renderedMatches.get(0).getStart() - BUFFER_CHARS;
  if (renderStart <= 0) {
    renderStart=0;
  }
  int renderEnd=renderedMatches.get(renderedMatches.size() - 1).getEnd() + BUFFER_CHARS;
  if (renderEnd >= content.length()) {
    renderEnd=content.length();
  }
  if (renderStart > 0) {
    out.append("String_Node_Str");
  }
  int curr=renderStart;
  for (  RenderedMatch render : renderedMatches) {
    int myStart=render.getStart();
    if (myStart - curr < (BUFFER_CHARS * 2)) {
      out.append(escape(content.substring(curr,myStart)));
    }
 else {
      out.append(escape(content.substring(curr,curr + BUFFER_CHARS)));
      out.append("String_Node_Str");
      out.append(escape(content.substring(myStart - BUFFER_CHARS,myStart)));
    }
    out.append(render.getRender());
    curr=render.getEnd();
  }
  out.append(escape(content.substring(curr,renderEnd)));
  if (renderEnd < content.length()) {
    out.append("String_Node_Str");
  }
}

Fixed version (ground truth):
void renderField(String field,String content,List<String> matches,StringBuffer out){
  List<RenderedMatch> renderedMatches=new LinkedList<RenderedMatch>();
  for (  String match : matches) {
    renderedMatches.addAll(renderMatch(field,content,match));
  }
  if (renderedMatches.size() == 0) {
    out.append("String_Node_Str");
    return;
  }
  renderedMatches=findNonSubstringMatches(renderedMatches);
  Collections.sort(renderedMatches);
  int renderStart=0;
  int renderEnd=content.length();
  if (renderedMatches.size() > 0) {
    renderStart=renderedMatches.get(0).getStart() - BUFFER_CHARS;
    if (renderStart <= 0) {
      renderStart=0;
    }
    renderEnd=renderedMatches.get(renderedMatches.size() - 1).getEnd() + BUFFER_CHARS;
    if (renderEnd >= content.length()) {
      renderEnd=content.length();
    }
  }
  if (renderStart > 0) {
    out.append("String_Node_Str");
  }
  int curr=renderStart;
  for (  RenderedMatch render : renderedMatches) {
    int myStart=render.getStart();
    if (myStart - curr < (BUFFER_CHARS * 2)) {
      out.append(escape(content.substring(curr,myStart)));
    }
 else {
      out.append(escape(content.substring(curr,curr + BUFFER_CHARS)));
      out.append("String_Node_Str");
      out.append(escape(content.substring(myStart - BUFFER_CHARS,myStart)));
    }
    out.append(render.getRender());
    curr=render.getEnd();
  }
  out.append(escape(content.substring(curr,renderEnd)));
  if (renderEnd < content.length()) {
    out.append("String_Node_Str");
  }
}
Program: 189143
Project: 189143
Buggy source:
private List<RenderedMatch> findNonSubstringMatches(List<RenderedMatch> renderedMatches){
  Collections.sort(renderedMatches,new Comparator<RenderedMatch>(){
    @Override public int compare(    RenderedMatch renderedMatch,    RenderedMatch renderedMatch2){
      int length1=renderedMatch.getEnd() - renderedMatch.getStart();
      int length2=renderedMatch2.getEnd() - renderedMatch.getEnd();
      return length1 - length2;
    }
  }
);
  Iterator<RenderedMatch> matchIter=renderedMatches.iterator();
  ArrayList<RenderedMatch> out=new ArrayList<RenderedMatch>(renderedMatches.size());
  while (matchIter.hasNext()) {
    RenderedMatch match=matchIter.next();
    boolean addMatch=true;
    for (    RenderedMatch supermatch : out) {
      if (match.getStart() >= supermatch.getStart() && match.getEnd() <= supermatch.getEnd()) {
        addMatch=false;
        break;
      }
    }
    if (addMatch) {
      out.add(match);
    }
  }
  return out;
}

Fixed version (ground truth):
private List<RenderedMatch> findNonSubstringMatches(List<RenderedMatch> renderedMatches){
  Collections.sort(renderedMatches,new Comparator<RenderedMatch>(){
    @Override public int compare(    RenderedMatch renderedMatch,    RenderedMatch renderedMatch2){
      int length1=renderedMatch.getEnd() - renderedMatch.getStart();
      int length2=renderedMatch2.getEnd() - renderedMatch.getEnd();
      return length2 - length1;
    }
  }
);
  ArrayList<RenderedMatch> out=new ArrayList<RenderedMatch>(renderedMatches.size());
  for (  RenderedMatch match : renderedMatches) {
    boolean addMatch=true;
    Iterator<RenderedMatch> superIter=out.iterator();
    while (superIter.hasNext()) {
      RenderedMatch supermatch=superIter.next();
      if (match.getStart() >= supermatch.getStart() && match.getEnd() <= supermatch.getEnd()) {
        addMatch=false;
        break;
      }
 else       if ((match.getStart() > supermatch.getStart() && match.getStart() < supermatch.getEnd()) || (match.getEnd() > supermatch.getStart() && match.getEnd() < supermatch.getEnd())) {
        addMatch=false;
        superIter.remove();
        break;
      }
    }
    if (addMatch) {
      out.add(match);
    }
  }
  return out;
}
Program: 189151
Project: 189151
Buggy source:
protected Event getUpdateEvent(Comment comment){
  return new UpdateIssueEvent(issue,issue.getProject(),getSession().getUser(),comment,"String_Node_Str");
}

Fixed version (ground truth):
protected Event getUpdateEvent(Comment comment){
  return new CommentEvent(issue,issue.getProject(),getSession().getUser(),comment,"String_Node_Str");
}
Program: 189152
Project: 189152
Buggy source:
protected Event getUpdateEvent(Comment comment){
  return new UpdateIssueEvent(issue,issue.getProject(),getSession().getUser(),comment,"String_Node_Str");
}

Fixed version (ground truth):
protected Event getUpdateEvent(Comment comment){
  return new CommentEvent(issue,issue.getProject(),getSession().getUser(),comment,"String_Node_Str");
}
Program: 189153
Project: 189153
Buggy source:
protected Event getUpdateEvent(Comment comment){
  return new UpdateIssueEvent(getIssue(),getIssue().getProject(),getSession().getUser(),comment,"String_Node_Str");
}

Fixed version (ground truth):
protected Event getUpdateEvent(Comment comment){
  return new ProgressEvent(getIssue(),getIssue().getProject(),getSession().getUser(),duration,"String_Node_Str");
}
Program: 189154
Project: 189154
Buggy source:
public IssuesApplication(){
  links=new LinkedList<MenuLink>();
  links.add(menuItemCreate);
  eventTypes=new LinkedList<String>();
  eventTypes.add("String_Node_Str");
  eventTypes.add("String_Node_Str");
  eventTypes.add("String_Node_Str");
}

Fixed version (ground truth):
public IssuesApplication(){
  links=new LinkedList<MenuLink>();
  links.add(menuItemCreate);
  eventTypes=new LinkedList<String>();
  eventTypes.add("String_Node_Str");
  eventTypes.add("String_Node_Str");
  eventTypes.add("String_Node_Str");
  eventTypes.add("String_Node_Str");
  eventTypes.add("String_Node_Str");
}
Program: 189155
Project: 189155
Buggy source:
public Class[] getPersistantClasses(){
  return new Class[]{CloseIssueEvent.class,CreateIssueEvent.class,UpdateIssueEvent.class};
}

Fixed version (ground truth):
public Class[] getPersistantClasses(){
  return new Class[]{CloseIssueEvent.class,CreateIssueEvent.class,UpdateIssueEvent.class,CommentEvent.class,ProgressEvent.class};
}
Program: 189156
Project: 189156
Buggy source:
protected Event getUpdateEvent(Comment comment){
  return new UpdateIssueEvent(getIssue(),getIssue().getProject(),getSession().getUser(),comment,"String_Node_Str");
}

Fixed version (ground truth):
protected Event getUpdateEvent(Comment comment){
  return new ProgressEvent(getIssue(),getIssue().getProject(),getSession().getUser(),duration,"String_Node_Str");
}
Program: 189157
Project: 189157
Buggy source:
@Override protected void onSubmit(){
  super.onSubmit();
  quickIssue.setReporter(page.getSession().getUser());
  quickIssue.getWatchers().add(page.getSession().getUser());
  quickIssue.setTimeRequired(quickIssue.getTimeEstimate());
  IssuesDAO dao=new IssuesDAO();
  dao.save(quickIssue);
  quickIssue=createIssue();
}

Fixed version (ground truth):
@Override protected void onSubmit(){
  super.onSubmit();
  quickIssue.setReporter(page.getSession().getUser());
  quickIssue.getWatchers().add(page.getSession().getUser());
  quickIssue.setTimeRequired(quickIssue.getTimeEstimate());
  saveIssue(quickIssue);
  quickIssue=createIssue();
}
Program: 189159
Project: 189159
Buggy source:
@Override protected void onSubmit(){
  MilestonesDAO dao=new MilestonesDAO();
  boolean alreadyExists=dao.find(quickMilestone.getName(),quickMilestone.getProject()) != null;
  if (alreadyExists) {
    warn("String_Node_Str");
    return;
  }
  quickMilestone.setUpdated(new Date());
  dao.save(quickMilestone);
  User currentUser=((HeadsUpSession)getSession()).getUser();
  quickMilestone=createMilestone(group);
}

Fixed version (ground truth):
@Override protected void onSubmit(){
  MilestonesDAO dao=new MilestonesDAO();
  boolean alreadyExists=dao.find(quickMilestone.getName(),quickMilestone.getProject()) != null;
  if (alreadyExists) {
    warn("String_Node_Str");
    return;
  }
  quickMilestone.setUpdated(new Date());
  dao.save(quickMilestone);
  saveMilestone(quickMilestone);
  User currentUser=((HeadsUpSession)getSession()).getUser();
  quickMilestone=createMilestone(group);
}
Program: 189162
Project: 189162
Buggy source:
@Override public void onClick(){
  Comment comm=(Comment)((HibernateStorage)storage).merge(comment);
  doc.getComments().remove(comm);
  Document d=(Document)((HibernateStorage)storage).merge(doc);
  commentList.remove(comm);
  d.setUpdated(new Date());
  ((HibernateStorage)storage).delete(comm);
}

Fixed version (ground truth):
@Override public void onClick(){
  Storage storage=Manager.getStorageInstance();
  Comment comm=(Comment)((HibernateStorage)storage).merge(comment);
  doc.getComments().remove(comm);
  Document d=(Document)((HibernateStorage)storage).merge(doc);
  commentList.remove(comm);
  d.setUpdated(new Date());
  ((HibernateStorage)storage).delete(comm);
}
Program: 189163
Project: 189163
Buggy source:
public CommentPanel(String id,IModel model,Project project,List commentList,Document doc,HeadsUpPage page){
  super(id,model);
  this.project=project;
  this.commentList=commentList;
  this.doc=doc;
  this.page=page;
  this.storage=page.getStorage();
  layout();
}

Fixed version (ground truth):
public CommentPanel(String id,IModel model,Project project,List commentList,Document doc){
  super(id,model);
  this.project=project;
  this.commentList=commentList;
  this.doc=doc;
  layout();
}
Program: 189165
Project: 189165
Buggy source:
protected void populateItem(ListItem<Comment> listItem){
  listItem.add(new CommentPanel("String_Node_Str",listItem.getModel(),getProject(),commentList,doc,(HeadsUpPage)getPage()));
}

Fixed version (ground truth):
protected void populateItem(ListItem<Comment> listItem){
  listItem.add(new CommentPanel("String_Node_Str",listItem.getModel(),getProject(),commentList,doc));
}
Program: 189167
Project: 189167
Buggy source:
protected void populateItem(ListItem<Comment> listItem){
  comment=listItem.getModelObject();
  listItem.add(new Image("String_Node_Str",new ResourceReference(HeadsUpPage.class,"String_Node_Str")));
  listItem.add(new Label("String_Node_Str",comment.getUser().getFullnameOrUsername()));
  listItem.add(new Label("String_Node_Str",new FormattedDateModel(comment.getCreated(),((HeadsUpSession)getSession()).getTimeZone())));
  PageParameters params=page.getProjectPageParameters();
  params.put("String_Node_Str",milestone.getName());
  params.put("String_Node_Str",comment.getId());
  Link edit=new BookmarkablePageLink("String_Node_Str",EditComment.class,params);
  listItem.add(edit.setVisible(userHasPermission));
  Link remove=new Link("String_Node_Str"){
    @Override public void onClick(){
      Comment comm=(Comment)((HibernateStorage)getStorage()).merge(comment);
      milestone.getComments().remove(comm);
      Milestone mile=(Milestone)((HibernateStorage)getStorage()).merge(milestone);
      commentList.remove(comm);
      mile.setUpdated(new Date());
      ((HibernateStorage)getStorage()).delete(comm);
    }
  }
;
  listItem.add(remove.setVisible(userHasPermission));
  listItem.add(new Label("String_Node_Str",new MarkedUpTextModel(comment.getComment(),getProject())).setEscapeModelStrings(false));
}

Fixed version (ground truth):
protected void populateItem(ListItem<Comment> listItem){
  CommentPanel panel=new CommentPanel("String_Node_Str",listItem.getModel(),getProject(),commentList,milestone);
  listItem.add(panel);
}
Program: 189168
Project: 189168
Buggy source:
public UpdateMilestoneEvent(Milestone milestone,Project project,User user,Comment comment,String type){
  super(type + "String_Node_Str" + milestone.getName()+ "String_Node_Str"+ user.getFullnameOrUsername(),comment.getComment(),milestone.getUpdated());
  setApplicationId(MilestonesApplication.ID);
  setProject(project);
  setUser(user);
  setObjectId(milestone.getName());
}

Fixed version (ground truth):
public UpdateMilestoneEvent(Milestone milestone,Project project,User user,Comment comment,String action){
  super(user.getFullnameOrUsername() + "String_Node_Str" + action+ "String_Node_Str"+ milestone.getName(),comment.getComment(),milestone.getUpdated());
  setApplicationId(MilestonesApplication.ID);
  setProject(project);
  setUser(user);
  setObjectId(milestone.getName());
  setSubObjectId(String.valueOf(comment.getId()));
}
Program: 189169
Project: 189169
Buggy source:
public String getBody(){
  String name=getObjectId();
  Milestone milestone=dao.find(name,getProject());
  if (milestone == null) {
    return "String_Node_Str" + getObjectId() + "String_Node_Str"+ getProject().getAlias()+ "String_Node_Str";
  }
  addLinks(ViewMilestone.getLinks(milestone));
  return CreateMilestoneEvent.renderMilestone(milestone);
}

Fixed version (ground truth):
public String getBody(){
  String name=getObjectId();
  Milestone milestone=dao.find(name,getProject());
  if (milestone == null) {
    return "String_Node_Str" + getObjectId() + "String_Node_Str"+ getProject().getAlias()+ "String_Node_Str";
  }
  addLinks(ViewMilestone.getLinks(milestone));
  if (getSubObjectId() == null || "String_Node_Str".equals(getSubObjectId())) {
    return CreateMilestoneEvent.renderMilestone(milestone);
  }
 else {
    Comment comment=MilestonesApplication.getComment(Long.parseLong(getSubObjectId()));
    if (comment == null) {
      return "String_Node_Str" + getSubObjectId() + "String_Node_Str";
    }
    return renderComment(comment,milestone);
  }
}
Program: 189170
Project: 189170
Buggy source:
private String renderComment(final Comment comment){
  if (comment == null) {
    return "String_Node_Str";
  }
  String content=new RenderUtil(){
    public Panel getPanel(){
      return new CommentPanel(RenderUtil.PANEL_ID,comment,getProject());
    }
  }
.getRenderedContent();
  return "String_Node_Str" + content + "String_Node_Str";
}

Fixed version (ground truth):
private String renderComment(final Comment comment,final Document doc){
  if (comment == null) {
    return "String_Node_Str";
  }
  String content=new RenderUtil(){
    public Panel getPanel(){
      return new CommentPanel(RenderUtil.PANEL_ID,new Model(comment),getProject(),null,doc);
    }
  }
.getRenderedContent();
  return "String_Node_Str" + content + "String_Node_Str";
}
Program: 189171
Project: 189171
Buggy source:
public String getBody(){
  if (getSubObjectId() == null || "String_Node_Str".equals(getSubObjectId())) {
    return super.getBody();
  }
 else {
    Comment comment=DocsApplication.getComment(Long.parseLong(getSubObjectId()));
    if (comment == null) {
      return "String_Node_Str" + getSubObjectId() + "String_Node_Str";
    }
    return renderComment(comment);
  }
}

Fixed version (ground truth):
public String getBody(){
  String name=getObjectId();
  Document doc=DocsApplication.getDocument(name,getProject());
  if (doc == null) {
    return "String_Node_Str" + name + "String_Node_Str"+ getProject().getAlias()+ "String_Node_Str";
  }
  if (getSubObjectId() == null || "String_Node_Str".equals(getSubObjectId())) {
    return super.getBody();
  }
 else {
    Comment comment=DocsApplication.getComment(Long.parseLong(getSubObjectId()));
    if (comment == null) {
      return "String_Node_Str" + getSubObjectId() + "String_Node_Str";
    }
    return renderComment(comment,doc);
  }
}
Program: 189172
Project: 189172
Buggy source:
public Panel getPanel(){
  return new CommentPanel(RenderUtil.PANEL_ID,comment,getProject());
}

Fixed version (ground truth):
public Panel getPanel(){
  return new CommentPanel(RenderUtil.PANEL_ID,new Model(comment),getProject(),null,doc);
}
Program: 189173
Project: 189173
Buggy source:
public void layout(){
  super.layout();
  add(CSSPackageResource.getHeaderContribution(getClass(),"String_Node_Str"));
  name=getPageParameters().getString("String_Node_Str");
  MilestoneGroup group=dao.find(name,getProject());
  if (group == null) {
    notFoundError();
    return;
  }
  addLink(new BookmarkableMenuLink(getPageClass("String_Node_Str"),getPageParameters(),"String_Node_Str"));
  final MilestoneGroup finalGroup=group;
  add(new EditMilestoneGroupForm("String_Node_Str",finalGroup,false,this){
    public void submitParent(){
      super.submitParent();
      getHeadsUpApplication().addEvent(new UpdateMilestoneGroupEvent(finalGroup,finalGroup.getProject(),EditMilestoneGroup.this.getSession().getUser()));
    }
  }
.add(new OnePressButton("String_Node_Str")));
}

Fixed version (ground truth):
public void layout(){
  super.layout();
  add(CSSPackageResource.getHeaderContribution(getClass(),"String_Node_Str"));
  name=getPageParameters().getString("String_Node_Str");
  MilestoneGroup group=dao.find(name,getProject());
  if (group == null) {
    notFoundError();
    return;
  }
  addLink(new BookmarkableMenuLink(getPageClass("String_Node_Str"),getPageParameters(),"String_Node_Str"));
  final MilestoneGroup finalGroup=group;
  add(new EditMilestoneGroupForm("String_Node_Str",finalGroup,false,this){
    public void submitParent(){
      super.submitParent();
      getHeadsUpApplication().addEvent(new UpdateMilestoneGroupEvent(finalGroup,finalGroup.getProject(),EditMilestoneGroup.this.getSession().getUser()));
    }
  }
);
}
Program: 189174
Project: 189174
Buggy source:
public void layout(){
  super.layout();
  add(CSSPackageResource.getHeaderContribution(getClass(),"String_Node_Str"));
  Issue create=new Issue(getProject());
  create.setReporter(getSession().getUser());
  create.getWatchers().add(getSession().getUser());
  create.setStatus(Issue.STATUS_NEW);
  String mName=getPageParameters().getString("String_Node_Str");
  Milestone milestone=getMilestone(mName,getProject());
  if (milestone != null) {
    create.setMilestone(milestone);
    if (milestone.getStartDate() != null && milestone.getStartDate().after(new Date())) {
      create.setIncludeInInitialEstimates(true);
    }
  }
  removeLink(((IssuesApplication)getHeadsUpApplication()).getMenuItemCreate());
  add(new EditIssueForm("String_Node_Str",create,true,this){
    public void onSubmit(    Issue create){
      boolean timeBurndown=Boolean.parseBoolean(getProject().getConfigurationValue(StoredProject.CONFIGURATION_TIMETRACKING_BURNDOWN));
      create.setCreated(new Date());
      if (create.getTimeEstimate() != null) {
        if (timeBurndown) {
          create.setTimeRequired(create.getTimeEstimate());
        }
 else {
          create.setTimeRequired(new Duration(0));
        }
      }
      ((IssuesApplication)getHeadsUpApplication()).addIssue(create);
      getHeadsUpApplication().addEvent(new CreateIssueEvent(create,create.getProject()));
    }
  }
);
}

Fixed version (ground truth):
public void layout(){
  super.layout();
  add(CSSPackageResource.getHeaderContribution(getClass(),"String_Node_Str"));
  Issue create=new Issue(getProject());
  create.setReporter(getSession().getUser());
  create.setStatus(Issue.STATUS_NEW);
  String mName=getPageParameters().getString("String_Node_Str");
  Milestone milestone=getMilestone(mName,getProject());
  if (milestone != null) {
    create.setMilestone(milestone);
    if (milestone.getStartDate() != null && milestone.getStartDate().after(new Date())) {
      create.setIncludeInInitialEstimates(true);
    }
  }
  removeLink(((IssuesApplication)getHeadsUpApplication()).getMenuItemCreate());
  add(new EditIssueForm("String_Node_Str",create,true,this){
    public void onSubmit(    Issue create){
      boolean timeBurndown=Boolean.parseBoolean(getProject().getConfigurationValue(StoredProject.CONFIGURATION_TIMETRACKING_BURNDOWN));
      create.setCreated(new Date());
      if (create.getTimeEstimate() != null) {
        if (timeBurndown) {
          create.setTimeRequired(create.getTimeEstimate());
        }
 else {
          create.setTimeRequired(new Duration(0));
        }
      }
      ((IssuesApplication)getHeadsUpApplication()).addIssue(create);
      getHeadsUpApplication().addEvent(new CreateIssueEvent(create,create.getProject()));
    }
  }
);
}
Program: 189177
Project: 189177
Buggy source:
protected void submitChild(Comment comment){
  duration.setUser(getSession().getUser());
  duration.setIssue(getIssue());
  if (willChildConsumeComment()) {
    duration.setComment(comment);
  }
  Iterator<DurationWorked> iterator=getIssue().getTimeWorked().iterator();
  while (iterator.hasNext()) {
    DurationWorked delete=iterator.next();
    if (delete.getId() == duration.getId()) {
      ((HibernateStorage)getStorage()).delete(delete);
      iterator.remove();
    }
  }
  ((HibernateStorage)getStorage()).save(duration);
  getIssue().getTimeWorked().add(duration);
  boolean timeBurndown=Boolean.parseBoolean(getProject().getConfigurationValue(StoredProject.CONFIGURATION_TIMETRACKING_BURNDOWN));
  if (timeBurndown) {
    duration.setUpdatedRequired(getIssue().getTimeRequired());
  }
 else {
    double hours=0;
    if (getIssue().getTimeRequired() == null) {
      if (getIssue().getTimeEstimate() != null) {
        hours=getIssue().getTimeEstimate().getHours();
      }
    }
 else {
      hours=getIssue().getTimeRequired().getHours();
    }
    hours+=duration.getWorked().getHours();
    Duration required=new Duration(hours);
    duration.setUpdatedRequired(required);
    getIssue().setTimeRequired(required);
  }
  if (getIssue().getAssignee() == null) {
    getIssue().setAssignee(getSession().getUser());
  }
  getIssue().getWatchers().add(getSession().getUser());
  getIssue().setStatus(Issue.STATUS_INPROGRESS);
}

Fixed version (ground truth):
protected void submitChild(Comment comment){
  duration=(DurationWorked)((HibernateStorage)getStorage()).merge(duration);
  duration.setUser(getSession().getUser());
  duration.setIssue(getIssue());
  if (willChildConsumeComment()) {
    duration.setComment(comment);
  }
  boolean timeBurndown=Boolean.parseBoolean(getProject().getConfigurationValue(StoredProject.CONFIGURATION_TIMETRACKING_BURNDOWN));
  if (timeBurndown) {
    duration.setUpdatedRequired(getIssue().getTimeRequired());
  }
 else {
    double hours=0;
    if (getIssue().getTimeRequired() == null) {
      if (getIssue().getTimeEstimate() != null) {
        hours=getIssue().getTimeEstimate().getHours();
      }
    }
 else {
      hours=getIssue().getTimeRequired().getHours();
    }
    hours+=duration.getWorked().getHours();
    Duration required=new Duration(hours);
    duration.setUpdatedRequired(required);
    getIssue().setTimeRequired(required);
  }
  if (getIssue().getAssignee() == null) {
    getIssue().setAssignee(getSession().getUser());
  }
  getIssue().getWatchers().add(getSession().getUser());
  getIssue().setStatus(Issue.STATUS_INPROGRESS);
}
Program: 189178
Project: 189178
Buggy source:
public void layout(){
  super.layout();
  add(CSSPackageResource.getHeaderContribution(getClass(),"String_Node_Str"));
  Issue create=new Issue(getProject());
  create.setReporter(getSession().getUser());
  create.getWatchers().add(getSession().getUser());
  create.setStatus(Issue.STATUS_NEW);
  String mName=getPageParameters().getString("String_Node_Str");
  Milestone milestone=getMilestone(mName,getProject());
  if (milestone != null) {
    create.setMilestone(milestone);
    if (milestone.getStartDate() != null && milestone.getStartDate().after(new Date())) {
      create.setIncludeInInitialEstimates(true);
    }
  }
  removeLink(((IssuesApplication)getHeadsUpApplication()).getMenuItemCreate());
  add(new EditIssueForm("String_Node_Str",create,true,this){
    public void onSubmit(    Issue create){
      boolean timeBurndown=Boolean.parseBoolean(getProject().getConfigurationValue(StoredProject.CONFIGURATION_TIMETRACKING_BURNDOWN));
      create.setCreated(new Date());
      if (create.getTimeEstimate() != null) {
        if (timeBurndown) {
          create.setTimeRequired(create.getTimeEstimate());
        }
 else {
          create.setTimeRequired(new Duration(0));
        }
      }
      ((IssuesApplication)getHeadsUpApplication()).addIssue(create);
      getHeadsUpApplication().addEvent(new CreateIssueEvent(create,create.getProject()));
    }
  }
);
}

Fixed version (ground truth):
public void layout(){
  super.layout();
  add(CSSPackageResource.getHeaderContribution(getClass(),"String_Node_Str"));
  Issue create=new Issue(getProject());
  create.setReporter(getSession().getUser());
  create.setStatus(Issue.STATUS_NEW);
  String mName=getPageParameters().getString("String_Node_Str");
  Milestone milestone=getMilestone(mName,getProject());
  if (milestone != null) {
    create.setMilestone(milestone);
    if (milestone.getStartDate() != null && milestone.getStartDate().after(new Date())) {
      create.setIncludeInInitialEstimates(true);
    }
  }
  removeLink(((IssuesApplication)getHeadsUpApplication()).getMenuItemCreate());
  add(new EditIssueForm("String_Node_Str",create,true,this){
    public void onSubmit(    Issue create){
      boolean timeBurndown=Boolean.parseBoolean(getProject().getConfigurationValue(StoredProject.CONFIGURATION_TIMETRACKING_BURNDOWN));
      create.setCreated(new Date());
      if (create.getTimeEstimate() != null) {
        if (timeBurndown) {
          create.setTimeRequired(create.getTimeEstimate());
        }
 else {
          create.setTimeRequired(new Duration(0));
        }
      }
      ((IssuesApplication)getHeadsUpApplication()).addIssue(create);
      getHeadsUpApplication().addEvent(new CreateIssueEvent(create,create.getProject()));
    }
  }
);
}
Program: 189181
Project: 189181
Buggy source:
@Override protected void layoutChild(Form form){
  boolean timeRequired=Boolean.parseBoolean(getProject().getConfigurationValue(StoredProject.CONFIGURATION_TIMETRACKING_REQUIRED));
  boolean timeBurndown=Boolean.parseBoolean(getProject().getConfigurationValue(StoredProject.CONFIGURATION_TIMETRACKING_BURNDOWN));
  for (  DurationWorked dur : getIssue().getTimeWorked()) {
    if (dur.getId() == itemId) {
      duration=dur;
      break;
    }
  }
  form.add(new DurationEditPanel("String_Node_Str",new Model<Duration>(duration.getWorked())).setRequired(timeRequired));
  WebMarkupContainer update=new WebMarkupContainer("String_Node_Str");
  update.setVisible(timeBurndown);
  if (getIssue().getTimeRequired() == null) {
    getIssue().setTimeRequired(new Duration(0,Duration.UNIT_HOURS));
  }
  update.add(new DurationEditPanel("String_Node_Str",new Model<Duration>(getIssue().getTimeRequired())).setRequired(timeRequired));
  form.add(update);
  form.add(new DateTimeWithSecondField("String_Node_Str",new PropertyModel<Date>(duration,"String_Node_Str")));
  create.setComment(duration.getComment().getComment());
  setSubmitLabel("String_Node_Str");
}

Fixed version (ground truth):
@Override protected void layoutChild(Form form){
  boolean timeRequired=Boolean.parseBoolean(getProject().getConfigurationValue(StoredProject.CONFIGURATION_TIMETRACKING_REQUIRED));
  boolean timeBurndown=Boolean.parseBoolean(getProject().getConfigurationValue(StoredProject.CONFIGURATION_TIMETRACKING_BURNDOWN));
  for (  DurationWorked dur : getIssue().getTimeWorked()) {
    if (dur.getId() == itemId) {
      duration=dur;
      break;
    }
  }
  form.add(new DurationEditPanel("String_Node_Str",new Model<Duration>(duration.getWorked())).setRequired(timeRequired));
  WebMarkupContainer update=new WebMarkupContainer("String_Node_Str");
  update.setVisible(timeBurndown);
  if (getIssue().getTimeRequired() == null) {
    getIssue().setTimeRequired(new Duration(0,Duration.UNIT_HOURS));
  }
  update.add(new DurationEditPanel("String_Node_Str",new Model<Duration>(getIssue().getTimeRequired())).setRequired(timeRequired));
  form.add(update);
  form.add(new DateTimeWithSecondField("String_Node_Str",new PropertyModel<Date>(duration,"String_Node_Str")));
  if (duration.getComment() != null) {
    create.setComment(duration.getComment().getComment());
  }
  setSubmitLabel("String_Node_Str");
}
Program: 189183
Project: 189183
Buggy source:
@Override protected void populateItem(Item<MilestoneGroup> item){
  MilestoneGroup group=item.getModelObject();
  PageParameters params=new PageParameters();
  params.add("String_Node_Str",group.getProject().getId());
  params.add("String_Node_Str",group.getName());
  BookmarkablePageLink nameLink=new BookmarkablePageLink("String_Node_Str",getPageClass("String_Node_Str"),params);
  nameLink.add(new Label("String_Node_Str",group.getName()));
  item.add(nameLink);
  double part=group.getCompleteness();
  int percent=(int)(part * 100);
  Panel panel=new PercentagePanel("String_Node_Str",percent);
  item.add(panel);
  SortableEntityProvider<Milestone> provider=new GroupedMilestoneProvider(group,filter);
  item.add(new MilestoneListPanel("String_Node_Str",provider,Milestones.this,hideProject));
}

Fixed version (ground truth):
@Override protected void populateItem(Item<MilestoneGroup> item){
  MilestoneGroup group=item.getModelObject();
  PageParameters params=new PageParameters();
  params.add("String_Node_Str",group.getProject().getId());
  params.add("String_Node_Str",group.getName());
  BookmarkablePageLink nameLink=new BookmarkablePageLink("String_Node_Str",getPageClass("String_Node_Str"),params);
  nameLink.add(new Label("String_Node_Str",group.getName()));
  item.add(nameLink);
  double part=group.getCompleteness();
  int percent=(int)(part * 100);
  Panel panel=new PercentagePanel("String_Node_Str",percent);
  item.add(panel);
  SortableEntityProvider<Milestone> provider=new GroupedMilestoneProvider(group,filter);
  item.add(new MilestoneListPanel("String_Node_Str",provider,Milestones.this,hideProject,group));
}
Program: 189185
Project: 189185
Buggy source:
@Override public Integer getObject(){
  int cols=6;
  if (hideProject) {
    cols--;
  }
  return cols;
}

Fixed version (ground truth):
@Override public Date getObject(){
  return quickMilestone.getDueDate();
}
Program: 189189
Project: 189189
Buggy source:
public void layout(){
  super.layout();
  add(CSSPackageResource.getHeaderContribution(getClass(),"String_Node_Str"));
  if (getProject().equals(StoredProject.getDefault())) {
    requirePermission(new ProjectListPermission());
  }
  filter=new IssueFilterPanel("String_Node_Str",getSession().getUser());
  add(filter);
  SortableEntityProvider<Issue> provider;
  if (getProject().equals(StoredProject.getDefault())) {
    provider=IssuesApplication.getIssueProvider(filter);
  }
 else {
    provider=IssuesApplication.getIssueProviderForProject(getProject(),filter);
  }
  add(new IssueListPanel("String_Node_Str",provider,this,!getProject().equals(StoredProject.getDefault()),false));
}

Fixed version (ground truth):
public void layout(){
  super.layout();
  add(CSSPackageResource.getHeaderContribution(getClass(),"String_Node_Str"));
  if (getProject().equals(StoredProject.getDefault())) {
    requirePermission(new ProjectListPermission());
  }
  filter=new IssueFilterPanel("String_Node_Str",getSession().getUser());
  add(filter);
  SortableEntityProvider<Issue> provider;
  if (getProject().equals(StoredProject.getDefault())) {
    provider=IssuesApplication.getIssueProvider(filter);
  }
 else {
    provider=IssuesApplication.getIssueProviderForProject(getProject(),filter);
  }
  add(new IssueListPanel("String_Node_Str",provider,this,!getProject().equals(StoredProject.getDefault()),false,null));
}
Program: 189190
Project: 189190
Buggy source:
public void layout(Form<Milestone> form){
  form.setModel(new CompoundPropertyModel<Milestone>(milestone));
  form.add(new Label("String_Node_Str",milestone.getProject().getAlias()));
  if (creating) {
    form.add(new TextField<String>("String_Node_Str").add(new IdPatternValidator()).setRequired(true));
    form.add(new WebMarkupContainer("String_Node_Str").setVisible(false));
  }
 else {
    form.add(new Label("String_Node_Str",milestone.getName()));
    form.add(new WebMarkupContainer("String_Node_Str").setVisible(false));
  }
  form.add(new DateTimeWithTimeZoneField("String_Node_Str"));
  form.add(new DateTimeWithTimeZoneField("String_Node_Str"));
  form.add(new TextArea("String_Node_Str"));
}

Fixed version (ground truth):
public void layout(final Form<Milestone> form){
  form.setModel(new CompoundPropertyModel<Milestone>(milestone));
  form.add(new Label("String_Node_Str",milestone.getProject().getAlias()));
  if (creating) {
    form.add(new TextField<String>("String_Node_Str").add(new IdPatternValidator()).setRequired(true));
    form.add(new WebMarkupContainer("String_Node_Str").setVisible(false));
  }
 else {
    form.add(new Label("String_Node_Str",milestone.getName()));
    form.add(new WebMarkupContainer("String_Node_Str").setVisible(false));
  }
  form.add(new DateTimeWithTimeZoneField("String_Node_Str"));
  form.add(new DateTimeWithTimeZoneField("String_Node_Str",new PropertyModel<Date>(new PropertyModel<Milestone>(this,"String_Node_Str"),"String_Node_Str"){
    @Override public void setObject(    Date object){
      if (!creating) {
        milestone=(Milestone)((HibernateStorage)Manager.getStorageInstance()).getHibernateSession().merge(milestone);
        form.getModel().setObject(milestone);
      }
      super.setObject(object);
    }
  }
));
  form.add(new TextArea("String_Node_Str"));
}
Program: 189192
Project: 189192
Buggy source:
protected String getBuildConfigurationListForTarget(File file,String target){
  BufferedReader in=null;
  try {
    in=new BufferedReader(new InputStreamReader(new FileInputStream(file)));
    String line;
    while ((line=in.readLine()) != null && !line.contains(target)) {
    }
    while ((line=in.readLine()) != null && !line.contains("String_Node_Str")) {
    }
    return getProjectFileValue(line);
  }
 catch (  IOException e) {
    Manager.getLogger(getClass().getName()).error("String_Node_Str",e);
  }
 finally {
    if (in != null) {
      IOUtil.close(in);
    }
  }
  return null;
}

Fixed version (ground truth):
protected String getBuildConfigurationListForTarget(File file,String target,Map<String,String> variables){
  BufferedReader in=null;
  try {
    in=new BufferedReader(new InputStreamReader(new FileInputStream(file)));
    String line;
    while ((line=in.readLine()) != null && !line.contains(target)) {
    }
    while ((line=in.readLine()) != null && !line.contains("String_Node_Str")) {
    }
    return getProjectFileValue(line,variables);
  }
 catch (  IOException e) {
    Manager.getLogger(getClass().getName()).error("String_Node_Str",e);
  }
 finally {
    if (in != null) {
      IOUtil.close(in);
    }
  }
  return null;
}
Program: 189194
Project: 189194
Buggy source:
protected String replaceVariables(String in){
  return in.replace("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
protected String replaceVariables(String in,Map<String,String> variables){
  String ret=in.replace("String_Node_Str","String_Node_Str");
  for (  String key : variables.keySet()) {
    ret=ret.replaceAll("String_Node_Str" + key + "String_Node_Str",variables.get(key));
    ret=ret.replaceAll("String_Node_Str" + key + "String_Node_Str",getRFC1034(variables.get(key)));
  }
  return ret;
}
Program: 189195
Project: 189195
Buggy source:
private String getProjectFileValue(String line){
  String ret;
  int start=line.indexOf("String_Node_Str") + 1;
  int end=line.indexOf("String_Node_Str",start);
  if (end == -1) {
    ret=line.substring(start);
  }
 else {
    ret=line.substring(start,end);
  }
  ret=ret.trim();
  if (ret.length() > 2) {
    if (ret.charAt(0) == '"' && ret.charAt(ret.length() - 1) == '"') {
      ret=ret.substring(1,ret.length() - 1);
    }
  }
  return stripComments(replaceVariables(ret));
}

Fixed version (ground truth):
private String getProjectFileValue(String line,Map<String,String> variables){
  String ret;
  int start=line.indexOf("String_Node_Str") + 1;
  int end=line.indexOf("String_Node_Str",start);
  if (end == -1) {
    ret=line.substring(start);
  }
 else {
    ret=line.substring(start,end);
  }
  ret=ret.trim();
  if (ret.length() > 2) {
    if (ret.charAt(0) == '"' && ret.charAt(ret.length() - 1) == '"') {
      ret=ret.substring(1,ret.length() - 1);
    }
  }
  return stripComments(replaceVariables(ret,variables));
}
Program: 189196
Project: 189196
Buggy source:
public String getLink(){
  int start=getBody().indexOf("String_Node_Str") + 6;
  int end=getBody().indexOf("String_Node_Str",start);
  return getBody().substring(start,end);
}

Fixed version (ground truth):
public String getLink(){
  int start=getBody().indexOf("String_Node_Str") + 6;
  int end=getBody().indexOf("String_Node_Str",start);
  if (start == -1 || end < start) {
    return null;
  }
  return getBody().substring(start,end);
}
Program: 189197
Project: 189197
Buggy source:
public BuildStatus(Build latest){
  if (latest == null) {
    return;
  }
  this.projectId=latest.getProject().getId();
  this.status=latest.getStatus();
  this.icon=getIconForBuild(latest);
  this.latestBuild=latest;
  if (latest.getStatus() != Build.BUILD_SUCCEEDED) {
    this.latestSuccessfulBuild=CIApplication.getLatestPassedBuildForProject(getProject());
  }
  getDownloadDetailsForProject(latest.getProject());
}

Fixed version (ground truth):
public BuildStatus(Build latest){
  if (latest == null) {
    return;
  }
  this.projectId=latest.getProject().getId();
  this.status=latest.getStatus();
  this.icon=getIconForBuild(latest);
  this.latestBuild=latest;
  if (latest.getStatus() != Build.BUILD_SUCCEEDED) {
    this.latestSuccessfulBuild=CIApplication.getLatestPassedBuildForProject(latest.getProject());
  }
  getDownloadDetailsForProject(latest.getProject());
}
Program: 189198
Project: 189198
Buggy source:
@Override public Project getProject(){
  if (getSession().getProject() != null) {
    return getSession().getProject();
  }
  return super.getProject();
}

Fixed version (ground truth):
@Override public Project getProject(){
  try {
    if (getSession().getProject() != null) {
      return getSession().getProject();
    }
  }
 catch (  java.lang.IllegalStateException e) {
  }
  return super.getProject();
}
Program: 189199
Project: 189199
Buggy source:
public static String markUp(String in,Project project){
  if (in == null) {
    return null;
  }
  StringBuilder ret=new StringBuilder(in.length());
  StringTokenizer tokenizer=new StringTokenizer(in,"String_Node_Str",true);
  Map<String,LinkProvider> providers=Manager.getInstance().getLinkProviders();
  while (tokenizer.hasMoreTokens()) {
    String next=tokenizer.nextToken();
    if (next.indexOf(':') != -1) {
      if (next.endsWith("String_Node_Str")) {
        next=next.substring(0,next.length() - 1);
      }
      String link=getLink(next,project,providers);
      boolean broken=isLinkBroken(next,project,providers);
      if (link == null) {
        ret.append(encode(next));
      }
 else {
        ret.append("String_Node_Str");
        ret.append(link);
        ret.append("String_Node_Str");
        if (broken) {
          ret.append("String_Node_Str");
          ret.append(BROKEN_LINK_HINT);
          ret.append("String_Node_Str");
        }
        ret.append("String_Node_Str");
        ret.append(encode(next));
        ret.append("String_Node_Str");
      }
      if (broken) {
        ret.append("String_Node_Str");
        ret.append(BROKEN_LINK_HINT);
        ret.append("String_Node_Str");
      }
    }
 else {
      ret.append(encode(next));
    }
  }
  return ret.toString();
}

Fixed version (ground truth):
public static String markUp(String in,Project project){
  if (in == null) {
    return null;
  }
  StringBuilder ret=new StringBuilder(in.length());
  StringTokenizer tokenizer=new StringTokenizer(in,"String_Node_Str",true);
  Map<String,LinkProvider> providers=Manager.getInstance().getLinkProviders();
  while (tokenizer.hasMoreTokens()) {
    String next=tokenizer.nextToken();
    if (isValidLink(next)) {
      if (next.endsWith("String_Node_Str")) {
        next=next.substring(0,next.length() - 1);
      }
      String link=getLink(next,project,providers);
      boolean broken=isLinkBroken(next,project,providers);
      if (link == null) {
        ret.append(encode(next));
      }
 else {
        ret.append("String_Node_Str");
        ret.append(link);
        ret.append("String_Node_Str");
        if (broken) {
          ret.append("String_Node_Str");
          ret.append(BROKEN_LINK_HINT);
          ret.append("String_Node_Str");
        }
        ret.append("String_Node_Str");
        ret.append(encode(next));
        ret.append("String_Node_Str");
      }
      if (broken) {
        ret.append("String_Node_Str");
        ret.append(BROKEN_LINK_HINT);
        ret.append("String_Node_Str");
      }
    }
 else {
      ret.append(encode(next));
    }
  }
  return ret.toString();
}
Program: 189200
Project: 189200
Buggy source:
public void setConfigurationItem(String name,String value){
  Session session=getHibernateSession();
  Transaction tx=session.beginTransaction();
  StoredConfigurationItem item=(StoredConfigurationItem)session.createQuery("String_Node_Str" + name + "String_Node_Str").uniqueResult();
  boolean requiresReload=false;
  if (item == null) {
    item=new StoredConfigurationItem(name,value);
    requiresReload=true;
  }
 else {
    item.setValue(value);
  }
  session.saveOrUpdate(item);
  tx.commit();
  if (requiresReload) {
    reloadGlobalConfiguration();
  }
}

Fixed version (ground truth):
public void setConfigurationItem(String name,String value){
  Session session=getHibernateSession();
  Transaction tx=session.beginTransaction();
  StoredConfigurationItem item=(StoredConfigurationItem)session.createQuery("String_Node_Str" + name + "String_Node_Str").uniqueResult();
  boolean requiresReload=false;
  if (item == null) {
    item=new StoredConfigurationItem(name,value);
    requiresReload=true;
  }
 else {
    item.setValue(value);
  }
  session.saveOrUpdate(item);
  tx.commit();
}