nus-yam/ex-repair huggingface dataset:
Program: 24258
Project: 24258
Buggy source:
@Override public void deliverResult(final QueryResult result){
  mTracker.registerObserver(result,mObserver);
  if (isReset()) {
    mTracker.reset();
  }
 else {
    if (isStarted() && result.isValid()) {
      super.deliverResult(result);
    }
    if (result.isValid() && !result.hasError()) {
      mTracker.trackValidResult(result);
    }
 else {
      mTracker.trackInvalidResult(result,mObserver);
    }
  }
}

Fixed version (ground truth):
@Override public void deliverResult(final QueryResult result){
  mTracker.registerObserver(result,mObserver);
  if (isReset()) {
    mTracker.reset();
  }
 else {
    if (isStarted() && result.isValid()) {
      super.deliverResult(result);
    }
    if (!result.hasError()) {
      trackResult(result);
    }
  }
}
Program: 24259
Project: 24259
Buggy source:
public boolean isValid(){
  return mIsValid;
}

Fixed version (ground truth):
public boolean isValid(){
  return mIsValid && !hasError();
}
Program: 24260
Project: 24260
Buggy source:
private void executeTasks(final Set<Task<?>> tasks){
  for (  final Task<?> task : tasks) {
    executeTaskNow(task);
  }
}

Fixed version (ground truth):
private void executeTasks(final Set<Task<?>> tasks){
  for (  final Task<?> task : tasks) {
    task.execute();
  }
}
Program: 24261
Project: 24261
Buggy source:
private void addTaskToPending(final Task<?> task){
synchronized (mTaskLock) {
    mPendingTasks.add(task);
  }
}

Fixed version (ground truth):
private void addTaskToPending(final Task<?> task){
synchronized (mTaskLock) {
    task.setTaskObserver(this);
    task.setRequestExecutor(mExecutor);
    task.setPriority(mPriority);
    task.setContext(mContext);
    mPendingTasks.add(task);
  }
}
Program: 24262
Project: 24262
Buggy source:
private void notifyComplete(){
  if (mObserver != null) {
    mObserver.onTaskComplete(this);
  }
  notifyDependentsOfCompletion();
}

Fixed version (ground truth):
private void notifyComplete(){
  mFinished=true;
  if (mObserver != null) {
    mObserver.onTaskComplete(this);
  }
  notifyDependentsOfCompletion();
}
Program: 24263
Project: 24263
Buggy source:
private void startNetworkingRequest(){
  if (mExecutor != null) {
    final NetworkingPrioritizable<T> prioritzable=new NetworkingPrioritizable<T>(this);
    final NetworkingRequest<T> request=new NetworkingRequest<T>(prioritzable,mPriority.ordinal(),this);
    mExecutor.executeNetworkingRequest(request);
  }
 else {
    notifyFailure(new ServiceError(Messages.NO_EXECUTOR));
  }
}

Fixed version (ground truth):
private void startNetworkingRequest(){
  if (mExecutor != null) {
    final NetworkingPrioritizable<T> prioritizable=new NetworkingPrioritizable<T>(this);
    final NetworkingRequest<T> request=new NetworkingRequest<T>(prioritizable,mPriority.ordinal(),this);
    mExecutor.executeNetworkingRequest(request);
  }
 else {
    notifyFailure(new ServiceError(Messages.NO_EXECUTOR));
  }
}
Program: 24264
Project: 24264
Buggy source:
protected void onPrerequisiteComplete(final Task<?> task){
synchronized (mTaskLock) {
    mPrerequisites.remove(task);
    checkPrerequisites();
  }
}

Fixed version (ground truth):
protected void onPrerequisiteComplete(final Task<?> task){
synchronized (mTaskLock) {
    mPrerequisites.remove(task);
    checkExecution();
  }
}
Program: 24265
Project: 24265
Buggy source:
private void checkExecution(){
  if (!mErrors.isEmpty()) {
    final ServiceError error=mErrors.get(0);
    notifyFailure(error);
  }
 else {
    notifyStarted();
    startNetworkingRequest();
  }
}

Fixed version (ground truth):
private void checkExecution(){
  if (!mFinished && allPrerequisitesComplete()) {
    if (!mErrors.isEmpty()) {
      final ServiceError error=mErrors.get(0);
      notifyFailure(error);
    }
 else {
      notifyStarted();
      startNetworkingRequest();
    }
  }
}
Program: 24266
Project: 24266
Buggy source:
@Override public final Identifier<?> getIdentifier(){
  return mIdentifier;
}

Fixed version (ground truth):
@Override public final Identifier<?> getIdentifier(){
  if (mIdentifier == null) {
    mIdentifier=onCreateIdentifier();
  }
  return mIdentifier;
}
Program: 24267
Project: 24267
Buggy source:
public void execute(){
  mIdentifier=onCreateIdentifier();
  checkPrerequisites();
}

Fixed version (ground truth):
public void execute(){
  checkExecution();
}
Program: 24268
Project: 24268
Buggy source:
private void notifyFailure(final ServiceError error){
  if (mObserver != null) {
    mObserver.onTaskFailure(this,error);
  }
  notifyDependentsOfFailure(error);
}

Fixed version (ground truth):
private void notifyFailure(final ServiceError error){
  mFinished=true;
  if (mObserver != null) {
    mObserver.onTaskFailure(this,error);
  }
  notifyDependentsOfFailure(error);
}
Program: 24269
Project: 24269
Buggy source:
protected void onPrerequisiteFailure(final Task<?> task,final ServiceError error){
synchronized (mTaskLock) {
    mPrerequisites.remove(task);
    mErrors.add(error);
    checkPrerequisites();
  }
}

Fixed version (ground truth):
protected void onPrerequisiteFailure(final Task<?> task,final ServiceError error){
synchronized (mTaskLock) {
    mPrerequisites.remove(task);
    mErrors.add(error);
    checkExecution();
  }
}
Program: 24270
Project: 24270
Buggy source:
@Override public void onFailure(final Context context,final ServiceError error){
  final int errorCode=error.getCode();
  final String errorMessage=error.getMessage();
  ContentBroadcaster.broadcast(context,getUri(),errorCode,errorMessage);
}

Fixed version (ground truth):
@Override public void onFailure(final Context context,final ServiceError error){
  final int errorCode=error.getCode();
  final String errorMessage=error.getMessage();
  ErrorBroadcaster.broadcast(context,getUri(),errorCode,errorMessage);
}
Program: 24271
Project: 24271
Buggy source:
@Override public void onSuccess(final Context context,final List<Task<?>> completed){
  final Uri uri=getUri();
  AppNetUriCache.add(uri);
  final ContentResolver resolver=context.getContentResolver();
  resolver.notifyChange(uri,null);
}

Fixed version (ground truth):
@Override public void onSuccess(final Context context,final List<Task<?>> completed){
  final ContentResolver resolver=context.getContentResolver();
  resolver.notifyChange(getUri(),null);
}
Program: 24272
Project: 24272
Buggy source:
@Override public void onFailure(final Context context,final ServiceError error){
  final int errorCode=error.getCode();
  final String errorMessage=error.getMessage();
  ContentBroadcaster.broadcast(context,getUri(),errorCode,errorMessage);
}

Fixed version (ground truth):
@Override public void onFailure(final Context context,final ServiceError error){
  final int errorCode=error.getCode();
  final String errorMessage=error.getMessage();
  ErrorBroadcaster.broadcast(context,getUri(),errorCode,errorMessage);
}
Program: 24273
Project: 24273
Buggy source:
@Override public void onFailure(final Context context,final ServiceError error){
  final int errorCode=error.getCode();
  final String errorMessage=error.getMessage();
  ContentBroadcaster.broadcast(context,getUri(),errorCode,errorMessage);
}

Fixed version (ground truth):
@Override public void onFailure(final Context context,final ServiceError error){
  final int errorCode=error.getCode();
  final String errorMessage=error.getMessage();
  ErrorBroadcaster.broadcast(context,getUri(),errorCode,errorMessage);
}
Program: 24274
Project: 24274
Buggy source:
@Override public void onFailure(final Context context,final ServiceError error){
  final int errorCode=error.getCode();
  final String errorMessage=error.getMessage();
  ContentBroadcaster.broadcast(context,getUri(),errorCode,errorMessage);
}

Fixed version (ground truth):
@Override public void onFailure(final Context context,final ServiceError error){
  final int errorCode=error.getCode();
  final String errorMessage=error.getMessage();
  ErrorBroadcaster.broadcast(context,getUri(),errorCode,errorMessage);
}
Program: 24275
Project: 24275
Buggy source:
@Override public void onFailure(final Context context,final ServiceError error){
  final int errorCode=error.getCode();
  final String errorMessage=error.getMessage();
  ContentBroadcaster.broadcast(context,getUri(),errorCode,errorMessage);
}

Fixed version (ground truth):
@Override public void onFailure(final Context context,final ServiceError error){
  final int errorCode=error.getCode();
  final String errorMessage=error.getMessage();
  ErrorBroadcaster.broadcast(context,getUri(),errorCode,errorMessage);
}
Program: 24276
Project: 24276
Buggy source:
@Override public void onFailure(final Context context,final ServiceError error){
  final int errorCode=error.getCode();
  final String errorMessage=error.getMessage();
  ContentBroadcaster.broadcast(context,getUri(),errorCode,errorMessage);
}

Fixed version (ground truth):
@Override public void onFailure(final Context context,final ServiceError error){
  final int errorCode=error.getCode();
  final String errorMessage=error.getMessage();
  ErrorBroadcaster.broadcast(context,getUri(),errorCode,errorMessage);
}
Program: 24277
Project: 24277
Buggy source:
private void handleAction(final Action action,final Operation operation){
  if (action == Action.START) {
    startOperation(operation);
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str");
  }
}

Fixed version (ground truth):
private void handleAction(final Action action,final Operation operation){
  if (action == Action.START) {
    handleStart(operation);
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str");
  }
}
Program: 24281
Project: 24281
Buggy source:
/** 
 * saves doc-level token alignments in the analysis.Word objects Requires surfSent's in the document's sentences.
 */
public void doTokenAlignments(String docText){
  U.pl("String_Node_Str");
  for (  Sentence s : sentences) {
    U.pf("String_Node_Str",s.ID(),StringUtils.join(s.tokens()));
    AlignedSub cleanText=AnalysisUtilities.moreCleanup(s.surfSent.rawText);
    int[] wordAlignsInSent=AnalysisUtilities.alignTokens(cleanText.text,s.words);
    for (int i=0; i < wordAlignsInSent.length; i++)     if (wordAlignsInSent[i] != -1)     wordAlignsInSent[i]=cleanText.alignments[wordAlignsInSent[i]];
    for (int i=0; i < s.words.size(); i++) {
      if (wordAlignsInSent[i] == -1) {
        s.words.get(i).charStart=-1;
      }
 else {
        s.words.get(i).charStart=s.surfSent.alignments[wordAlignsInSent[i]];
      }
    }
    if (s.words.get(0).charStart == -1) {
      s.words.get(0).charStart=s.surfSent.alignments[0];
    }
    for (int i=1; i < s.words.size(); i++) {
      if (s.words.get(i).charStart == -1) {
        Word prev=s.words.get(i - 1);
        s.words.get(i).charStart=prev.charStart + prev.token.length();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * saves doc-level token alignments in the analysis.Word objects Requires surfSent's in the document's sentences.
 */
public void doTokenAlignments(String docText){
  U.pl("String_Node_Str");
  for (  Sentence s : sentences) {
    U.pf("String_Node_Str",s.ID(),StringUtils.join(s.tokens()));
    AlignedSub cleanText=AnalysisUtilities.moreCleanup(s.surfSent.rawText);
    int[] wordAlignsInSent=AnalysisUtilities.alignTokens(cleanText.text,s.words);
    for (int i=0; i < wordAlignsInSent.length; i++)     if (wordAlignsInSent[i] != -1)     wordAlignsInSent[i]=cleanText.alignments[wordAlignsInSent[i]];
    for (int i=0; i < s.words.size(); i++) {
      if (wordAlignsInSent[i] == -1) {
        s.words.get(i).charStart=-1;
      }
 else {
        s.words.get(i).charStart=s.surfSent.alignments[wordAlignsInSent[i]];
      }
    }
    if (s.words != null && s.words.size() > 0 && s.words.get(0).charStart == -1) {
      s.words.get(0).charStart=s.surfSent.alignments[0];
    }
    for (int i=1; i < s.words.size(); i++) {
      if (s.words.get(i).charStart == -1) {
        Word prev=s.words.get(i - 1);
        s.words.get(i).charStart=prev.charStart + prev.token.length();
      }
    }
  }
}
Program: 24282
Project: 24282
Buggy source:
public Tree findNodeThatCoversSpan(Sentence sent,Tree startLeaf,Tree endLeaf){
  Tree res=null;
  int smallestSpan=999999;
  int nodeSpanLength;
  for (  Tree t : sent.rootNode().subTrees()) {
    if (!(t.dominates(startLeaf) && t.dominates(endLeaf))) {
      continue;
    }
    nodeSpanLength=t.getLeaves().size();
    if (smallestSpan > nodeSpanLength) {
      smallestSpan=nodeSpanLength;
      res=t;
    }
  }
  return res;
}

Fixed version (ground truth):
public Tree findNodeThatCoversSpan(Sentence sent,Tree startLeaf,Tree endLeaf){
}
Program: 24283
Project: 24283
Buggy source:
/** 
 * saves doc-level token alignments in the analysis.Word objects Requires surfSent's in the document's sentences.
 */
public void doTokenAlignments(String docText){
  U.pl("String_Node_Str");
  for (  Sentence s : sentences) {
    AlignedSub cleanText=AnalysisUtilities.cleanupMarkup(s.surfSent.rawText);
    int[] wordAlignsInSent=AnalysisUtilities.alignTokens(cleanText.text,s.words);
    for (int i=0; i < wordAlignsInSent.length; i++)     if (wordAlignsInSent[i] != -1)     wordAlignsInSent[i]=cleanText.alignments[wordAlignsInSent[i]];
    for (int i=0; i < s.words.size(); i++) {
      if (wordAlignsInSent[i] == -1) {
        s.words.get(i).charStart=-1;
      }
 else {
        s.words.get(i).charStart=s.surfSent.alignments[wordAlignsInSent[i]];
      }
    }
    if (s.words.get(0).charStart == -1) {
      s.words.get(0).charStart=s.surfSent.alignments[0];
    }
    for (int i=1; i < s.words.size(); i++) {
      if (s.words.get(i).charStart == -1) {
        Word prev=s.words.get(i - 1);
        s.words.get(i).charStart=prev.charStart + prev.token.length();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * saves doc-level token alignments in the analysis.Word objects Requires surfSent's in the document's sentences.
 */
public void doTokenAlignments(String docText){
  U.pl("String_Node_Str");
  for (  Sentence s : sentences) {
    AlignedSub cleanText=AnalysisUtilities.moreCleanup(s.surfSent.rawText);
    int[] wordAlignsInSent=AnalysisUtilities.alignTokens(cleanText.text,s.words);
    for (int i=0; i < wordAlignsInSent.length; i++)     if (wordAlignsInSent[i] != -1)     wordAlignsInSent[i]=cleanText.alignments[wordAlignsInSent[i]];
    for (int i=0; i < s.words.size(); i++) {
      if (wordAlignsInSent[i] == -1) {
        s.words.get(i).charStart=-1;
      }
 else {
        s.words.get(i).charStart=s.surfSent.alignments[wordAlignsInSent[i]];
      }
    }
    if (s.words.get(0).charStart == -1) {
      s.words.get(0).charStart=s.surfSent.alignments[0];
    }
    for (int i=1; i < s.words.size(); i++) {
      if (s.words.get(i).charStart == -1) {
        Word prev=s.words.get(i - 1);
        s.words.get(i).charStart=prev.charStart + prev.token.length();
      }
    }
  }
}
Program: 24284
Project: 24284
Buggy source:
public static List<SentenceBreaker.Sentence> cleanAndBreakSentences(String docText){
  docText=docText.replaceAll("String_Node_Str","String_Node_Str");
  AlignedSub cleaner=AnalysisUtilities.cleanupDocument(docText);
  List<SentenceBreaker.Sentence> sentences=SentenceBreaker.getSentences(cleaner.text);
  for (  SentenceBreaker.Sentence s : sentences) {
    U.pf("String_Node_Str",s.cleanText);
    U.pf("String_Node_Str",s.charStart,s.charEnd);
    s.setAlignmentProjection(cleaner.alignments);
    U.pf("String_Node_Str",s.charStart,s.charEnd);
  }
  return sentences;
}

Fixed version (ground truth):
public static List<SentenceBreaker.Sentence> cleanAndBreakSentences(String docText){
  docText=docText.replaceAll("String_Node_Str","String_Node_Str");
  AlignedSub cleaner=AnalysisUtilities.cleanupDocument(docText);
  List<SentenceBreaker.Sentence> sentences=SentenceBreaker.getSentences(cleaner);
  return sentences;
}
Program: 24285
Project: 24285
Buggy source:
/** 
 * some ACE docs have weird markup in them that serve as paragraph-ish markers 
 */
public static AlignedSub cleanupDocument(String document){
  AlignedSub ret=new AlignedSub(document).replaceAll("String_Node_Str","String_Node_Str");
  return ret;
}

Fixed version (ground truth):
/** 
 * some ACE docs have weird markup in them that serve as paragraph-ish markers 
 */
public static AlignedSub cleanupDocument(String document){
  AlignedSub ret=new AlignedSub(document);
  ret=ret.replaceAll("String_Node_Str","String_Node_Str");
  ret=ret.replaceAll(leadingWhitespace,"String_Node_Str");
  return ret;
}
Program: 24286
Project: 24286
Buggy source:
public static void main(String[] args) throws IOException {
  for (  String arg : args) {
    if (args.length > 1)     U.pf("String_Node_Str",arg);
    String text=U.readFile(arg);
    text=AnalysisUtilities.cleanupDocument(text).text;
    for (    Sentence s : getSentences(text)) {
      U.pf("String_Node_Str",StringUtils.join(s.tokens,"String_Node_Str"));
    }
  }
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  for (  String arg : args) {
    if (args.length > 1)     U.pf("String_Node_Str",arg);
    String text=U.readFile(arg);
    AlignedSub textAS=AnalysisUtilities.cleanupDocument(text);
    for (    Sentence s : getSentences(textAS)) {
      U.pf("String_Node_Str",s.charStart,s.charEnd,U.backslashEscape(s.rawText));
      U.pf("String_Node_Str",StringUtils.join(s.tokens,"String_Node_Str"));
      U.pf("String_Node_Str",s.cleanText);
    }
  }
}
Program: 24287
Project: 24287
Buggy source:
public String toString(){
switch (this) {
case First:
    return "String_Node_Str";
case Second:
  return "String_Node_Str";
case Third:
return "String_Node_Str";
default :
return "String_Node_Str";
}
}

Fixed version (ground truth):
public String toString(){
switch (this) {
case First:
    return "String_Node_Str";
case Second:
  return "String_Node_Str";
case Third:
return "String_Node_Str";
default :
return null;
}
}
Program: 24288
Project: 24288
Buggy source:
/** 
 * Note: This is slightly different than what is described in H&K EMNLP 09. I think the head rules they used were slightly different (or possibly their description is a little off). The Stanford Parser API says that for sentences like "painter Pablo Picasso", the head is "painter", and thus their are mentions for "painter Pablo Picasso" and "Pablo Picasso" but not just "painter". Therefore, we connect "painter Pablo Picasso" and "Pablo Picasso" by looking at the NP *PREVIOUS* to "Pablo Picasso" to see if it is a person, rather than subsequent to it, as H&K describe.
 * @param m
 * @param d
 * @return
 */
private static Mention findAntecedentInRoleAppositiveConstruction(Mention m,Document d){
  Tree root=m.getSentence().getRootNode();
  Tree node=m.getNode();
  Tree parent=node.parent(root);
  if (!parent.label().value().equals("String_Node_Str")) {
    return null;
  }
  int index=parent.indexOf(node);
  if (index - 1 < 0) {
    return null;
  }
  Tree nextSibling=parent.getChild(index - 1);
  HeadFinder headFinder=AnalysisUtilities.getInstance().getHeadFinder();
  if (nextSibling.label().value().equals("String_Node_Str") && parent.headTerminal(headFinder) == nextSibling.headTerminal(headFinder) && m.neType().matches("String_Node_Str")) {
    Tree maxProj=SyntacticPaths.getMaximalProjection(parent,root);
    for (    Mention m2 : d.getMentions()) {
      if (maxProj == m2.getNode()) {
        return m2;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Note: This is slightly different than what is described in H&K EMNLP 09. I think the head rules they used were slightly different (or possibly their description is a little off).
 * @param m
 * @param d
 * @return
 */
private static Mention findAntecedentInRoleAppositiveConstruction(Mention m,Document d){
  Tree root=m.getSentence().getRootNode();
  Tree node=m.getNode();
  Tree parent=node.parent(root);
  if (!parent.label().value().equals("String_Node_Str")) {
    return null;
  }
  int index=parent.indexOf(node);
  if (index + 1 >= parent.numChildren()) {
    return null;
  }
  TregexPattern pat=TregexPatternFactory.getPattern("String_Node_Str");
  TregexMatcher matcher=pat.matcher(parent);
  while (matcher.find()) {
    if (matcher.getNode("String_Node_Str") == node) {
      Tree head=matcher.getNode("String_Node_Str");
      Tree maxProj=SyntacticPaths.getMaximalProjection(head,root);
      for (      Mention cand : d.getMentions()) {
        if (cand.getNode() == maxProj) {
          if (cand.neType().matches("String_Node_Str")) {
            return cand;
          }
          break;
        }
      }
    }
  }
  return null;
}
Program: 24290
Project: 24290
Buggy source:
public void testRoleAppositives() throws IOException {
  Document d=Document.loadFiles("String_Node_Str");
  _Pipeline.go(d);
  assertTrue(d.getMentions().toString(),d.getMentions().size() == 8);
  Mention m1=d.getMentions().get(0);
  Mention m2=d.getMentions().get(1);
  Mention m5=d.getMentions().get(4);
  Mention m6=d.getMentions().get(5);
  Mention m7=d.getMentions().get(6);
  System.err.println(d.getMentions().toString());
  assertTrue(m1.getNode().yield().toString(),m1.getNode().yield().toString().equalsIgnoreCase("String_Node_Str"));
  assertTrue(m2.getNode().yield().toString(),m2.getNode().yield().toString().equalsIgnoreCase("String_Node_Str"));
  assertTrue(m5.getNode().yield().toString(),m5.getNode().yield().toString().equalsIgnoreCase("String_Node_Str"));
  assertTrue(m6.getNode().yield().toString(),m6.getNode().yield().toString().equalsIgnoreCase("String_Node_Str"));
  assertTrue(m7.getNode().yield().toString(),m7.getNode().yield().toString().equalsIgnoreCase("String_Node_Str"));
  assertTrue(m2.getNode().toString(),d.getEntGraph().getLinkedMentions(m2).contains(m1));
  assertTrue(m7.getNode().toString(),d.getEntGraph().getLinkedMentions(m7).contains(m5));
  assertTrue(m6.getNode().toString(),d.getEntGraph().getLinkedMentions(m6).contains(m5));
}

Fixed version (ground truth):
public void testRoleAppositives() throws IOException {
  Document d=Document.loadFiles("String_Node_Str");
  _Pipeline.go(d);
  assertTrue(d.getMentions().toString(),d.getMentions().size() == 8);
  Mention m1=d.getMentions().get(0);
  Mention m2=d.getMentions().get(1);
  Mention m5=d.getMentions().get(4);
  Mention m6=d.getMentions().get(5);
  Mention m7=d.getMentions().get(6);
  assertTrue(m1.getNode().yield().toString(),m1.getNode().yield().toString().equalsIgnoreCase("String_Node_Str"));
  assertTrue(m2.getNode().yield().toString(),m2.getNode().yield().toString().equalsIgnoreCase("String_Node_Str"));
  assertTrue(m5.getNode().yield().toString(),m5.getNode().yield().toString().equalsIgnoreCase("String_Node_Str"));
  assertTrue(m6.getNode().yield().toString(),m6.getNode().yield().toString().equalsIgnoreCase("String_Node_Str"));
  assertTrue(m7.getNode().yield().toString(),m7.getNode().yield().toString().equalsIgnoreCase("String_Node_Str"));
  assertTrue(m2.getNode().toString(),d.getEntGraph().getLinkedMentions(m2).contains(m1));
  assertTrue(m7.getNode().toString(),d.getEntGraph().getLinkedMentions(m7).contains(m5));
  assertTrue(m6.getNode().toString(),d.getEntGraph().getLinkedMentions(m6).contains(m5));
}
Program: 24291
Project: 24291
Buggy source:
public Tree getTree(){
  if (tree == null) {
    TreeFactory factory=new LabeledScoredTreeFactory();
    tree=factory.newTreeNode("String_Node_Str",new ArrayList<Tree>());
    for (int i=0; i < sentences.size(); i++) {
      tree.addChild(sentences.get(i).getRootNode());
    }
  }
  return tree;
}

Fixed version (ground truth):
/** 
 * make a right branching tree out of all the sentence trees e.g., (DOCROOT T1 (DOCROOT T2 (DOCROOT T3)))  This will make sure that ndoes in t3 are further from nodes in t1  than they are fromnodes in t2.
 * @return
 */
public Tree getTree(){
  if (tree == null) {
    TreeFactory factory=new LabeledScoredTreeFactory();
    tree=factory.newTreeNode("String_Node_Str",new ArrayList<Tree>());
    Tree tmpTree1=tree;
    Tree tmpTree2;
    for (int i=0; i < sentences.size(); i++) {
      tmpTree1.addChild(sentences.get(i).getRootNode());
      if (i < sentences.size() - 1) {
        tmpTree2=factory.newTreeNode("String_Node_Str",new ArrayList<Tree>());
        tmpTree1.addChild(tmpTree2);
        tmpTree1=tmpTree2;
      }
    }
  }
  return tree;
}
Program: 24292
Project: 24292
Buggy source:
public static void go(Document d){
  System.out.println("String_Node_Str");
  int id=0;
  String patS="String_Node_Str";
  TregexPattern pat=TregexPatternFactory.getPattern(patS);
  for (  Sentence s : d.sentences) {
    TregexMatcher matcher=pat.matcher(s.root);
    while (matcher.find()) {
      Tree match=matcher.getMatch();
      Mention mention=new Mention(++id,s,match);
      System.out.println("String_Node_Str" + mention);
      d.mentions.add(mention);
      d.node2mention.put(match,mention);
    }
  }
}

Fixed version (ground truth):
public static void go(Document d){
  System.out.println("String_Node_Str");
  int id=0;
  String patS="String_Node_Str";
  TregexPattern pat=TregexPatternFactory.getPattern(patS);
  for (  Sentence s : d.sentences) {
    TregexMatcher matcher=pat.matcher(s.root);
    while (matcher.find()) {
      Tree match=matcher.getMatch();
      Mention mention=new Mention(++id,s,match);
      System.out.println("String_Node_Str" + mention);
      d.mentions.add(mention);
      d.set_node2mention(s,match,mention);
    }
  }
}
Program: 24293
Project: 24293
Buggy source:
public static void go(Document d){
  System.out.println("String_Node_Str");
  TregexPattern pat=TregexPatternFactory.getPattern("String_Node_Str");
  for (  Sentence s : d.sentences) {
    TregexMatcher matcher=pat.matcher(s.root);
    while (matcher.find()) {
      Tree NP=matcher.getNode("String_Node_Str");
      Tree PRP=matcher.getNode("String_Node_Str");
      String pronoun=pronoun(PRP);
      Mention mention=d.node2mention.get(NP);
      System.out.println("String_Node_Str" + mention);
      System.out.println("String_Node_Str" + pronoun);
      resolve(mention,pronoun,d);
    }
  }
}

Fixed version (ground truth):
public static void go(Document d){
  System.out.println("String_Node_Str");
  TregexPattern pat=TregexPatternFactory.getPattern("String_Node_Str");
  for (  Sentence s : d.sentences) {
    TregexMatcher matcher=pat.matcher(s.root);
    while (matcher.find()) {
      Tree NP=matcher.getNode("String_Node_Str");
      Tree PRP=matcher.getNode("String_Node_Str");
      String pronoun=pronoun(PRP);
      Mention mention=d.node2mention(s,NP);
      System.out.println("String_Node_Str" + mention);
      System.out.println("String_Node_Str" + pronoun);
      resolve(mention,pronoun,d);
    }
  }
}
Program: 24294
Project: 24294
Buggy source:
public Document(){
  sentences=new ArrayList<Sentence>();
  mentions=new ArrayList<Mention>();
  node2mention=new HashMap<Tree,Mention>();
  refGraph=new RefGraph();
}

Fixed version (ground truth):
public Document(){
  sentences=new ArrayList<Sentence>();
  mentions=new ArrayList<Mention>();
  node2mention=new HashMap();
  refGraph=new RefGraph();
}
Program: 24295
Project: 24295
Buggy source:
public Sentence(int id){
  this.id=id;
  words=new ArrayList<Word>();
  node2word=new HashMap<Tree,Word>();
}

Fixed version (ground truth):
public Sentence(int id){
  this.id=id;
  words=new ArrayList<Word>();
  node2word=new HashMap();
}
Program: 24296
Project: 24296
Buggy source:
private void assemblePlayer(float x,float y){
  Entity player=EntityFactory.createPlayer(world,x,y);
  player.addToWorld();
  groupManager.add(player,"String_Node_Str");
  Entity mouseCursor=EntityFactory.createMouseCursor(world,x,y);
  mouseCursor.addToWorld();
  final Inbetween inbetween=new Inbetween(player,mouseCursor);
  inbetween.tween=0.4f;
  Entity midpoint=world.createEntity().addComponent(new Pos(0,0)).addComponent(inbetween);
  midpoint.addToWorld();
  world.createEntity().addComponent(new Pos(0,0)).addComponent(new Physics()).addComponent(new Homing(midpoint)).addComponent(new CameraFocus()).addToWorld();
  Entity rifle=EntityFactory.createGrenadeLauncher(world,x,y,player).addComponent(new Aim(mouseCursor));
  rifle.addToWorld();
  Inventory inventory=new Inventory();
  inventory.weapon=rifle;
  player.addComponent(inventory);
  tagManager.register("String_Node_Str",player);
}

Fixed version (ground truth):
private void assemblePlayer(float x,float y){
  Entity player=EntityFactory.createPlayer(world,x,y);
  player.addToWorld();
  groupManager.add(player,"String_Node_Str");
  Entity mouseCursor=EntityFactory.createMouseCursor(world,x,y);
  mouseCursor.addToWorld();
  final Inbetween inbetween=new Inbetween(player,mouseCursor);
  inbetween.tween=0.4f;
  Entity midpoint=world.createEntity().addComponent(new Pos(0,0)).addComponent(inbetween);
  midpoint.addToWorld();
  world.createEntity().addComponent(new Pos(0,0)).addComponent(new Physics()).addComponent(new Homing(midpoint)).addComponent(new CameraFocus()).addToWorld();
  Entity rifle=EntityFactory.createRifle(world,x,y,player).addComponent(new Aim(mouseCursor));
  rifle.addToWorld();
  Inventory inventory=new Inventory();
  inventory.weapon=rifle;
  player.addComponent(inventory);
  tagManager.register("String_Node_Str",player);
}
Program: 24297
Project: 24297
Buggy source:
public static Entity createShotgun(World world,float x,float y,Entity player){
  Weapon weapon=new Weapon();
  weapon.fireCooldown=0.25f;
  weapon.minBullets=8;
  weapon.maxBullets=10;
  weapon.spread=20;
  weapon.bulletSpeed*=0.9f;
  weapon.bulletAnimId="String_Node_Str";
  weapon.shellParticle="String_Node_Str";
  return newPositioned(world,x,y).addComponent(new Anim("String_Node_Str",Anim.Layer.PLAYER_ARM,WEAPON_ROT_ORIGIN_X,WEAPON_ROT_ORIGIN_Y)).addComponent(new Attached(player,PLAYER_WEAPON_MOUNT_X - WEAPON_ROT_ORIGIN_X,PLAYER_WEAPON_MOUNT_Y - WEAPON_ROT_ORIGIN_Y)).addComponent(weapon).addComponent(new Bounds(G.CELL_SIZE,G.CELL_SIZE));
}

Fixed version (ground truth):
public static Entity createShotgun(World world,float x,float y,Entity player){
  Weapon weapon=new Weapon();
  weapon.fireCooldown=0.25f;
  weapon.minBullets=8;
  weapon.maxBullets=10;
  weapon.bulletPayload.maxLifetime=0.5f;
  weapon.spread=20;
  weapon.bulletSpeed*=0.9f;
  weapon.bulletAnimId="String_Node_Str";
  weapon.shellParticle="String_Node_Str";
  return newPositioned(world,x,y).addComponent(new Anim("String_Node_Str",Anim.Layer.PLAYER_ARM,WEAPON_ROT_ORIGIN_X,WEAPON_ROT_ORIGIN_Y)).addComponent(new Attached(player,PLAYER_WEAPON_MOUNT_X - WEAPON_ROT_ORIGIN_X,PLAYER_WEAPON_MOUNT_Y - WEAPON_ROT_ORIGIN_Y)).addComponent(weapon).addComponent(new Bounds(G.CELL_SIZE,G.CELL_SIZE));
}
Program: 24298
Project: 24298
Buggy source:
public static Entity createRifle(World world,float x,float y,Entity player){
  Weapon weapon=new Weapon();
  weapon.shellParticle="String_Node_Str";
  weapon.recoil=2;
  return newPositioned(world,x,y).addComponent(new Anim("String_Node_Str",Anim.Layer.PLAYER_ARM,WEAPON_ROT_ORIGIN_X,WEAPON_ROT_ORIGIN_Y)).addComponent(new Attached(player,PLAYER_WEAPON_MOUNT_X - WEAPON_ROT_ORIGIN_X,PLAYER_WEAPON_MOUNT_Y - WEAPON_ROT_ORIGIN_Y)).addComponent(weapon).addComponent(new Bounds(G.CELL_SIZE,G.CELL_SIZE));
}

Fixed version (ground truth):
public static Entity createRifle(World world,float x,float y,Entity player){
  Weapon weapon=new Weapon();
  weapon.shellParticle="String_Node_Str";
  weapon.recoil=2;
  weapon.bulletPayload.maxLifetime=1.5f;
  return newPositioned(world,x,y).addComponent(new Anim("String_Node_Str",Anim.Layer.PLAYER_ARM,WEAPON_ROT_ORIGIN_X,WEAPON_ROT_ORIGIN_Y)).addComponent(new Attached(player,PLAYER_WEAPON_MOUNT_X - WEAPON_ROT_ORIGIN_X,PLAYER_WEAPON_MOUNT_Y - WEAPON_ROT_ORIGIN_Y)).addComponent(weapon).addComponent(new Bounds(G.CELL_SIZE,G.CELL_SIZE));
}
Program: 24299
Project: 24299
Buggy source:
public MainScreen(){
  G.screen=this;
  G.world=new World();
  G.world.setSystem(new AssetSystem());
  G.world.setSystem(new MapSystem());
  G.world.setSystem(new EntitySpawnSystem());
  G.world.setSystem(new CameraSystem());
  G.world.setSystem(new PlayerControlSystem());
  G.world.setSystem(new GravitySystem());
  G.world.setSystem(new MapCollisionSystem());
  G.world.setSystem(new AfterPhysicsSystem());
  G.world.setSystem(new CameraFocusSystem());
  G.world.setSystem(new MapRenderSystem());
  G.world.setSystem(new AnimRenderSystem());
  G.world.initialize();
}

Fixed version (ground truth):
public MainScreen(){
  G.screen=this;
  G.world=new World();
  G.world.setSystem(new TerminalSystem());
  G.world.setSystem(new AssetSystem());
  G.world.setSystem(new MapSystem());
  G.world.setSystem(new EntitySpawnSystem());
  G.world.setSystem(new CameraSystem());
  G.world.setSystem(new PlayerControlSystem());
  G.world.setSystem(new GravitySystem());
  G.world.setSystem(new MapCollisionSystem());
  G.world.setSystem(new AfterPhysicsSystem());
  G.world.setSystem(new CameraFocusSystem());
  G.world.setSystem(new MapRenderSystem());
  G.world.setSystem(new AnimRenderSystem());
  G.world.initialize();
}
Program: 24300
Project: 24300
Buggy source:
@Override protected void process(Entity e){
  final Physics physics=ym.get(e);
  final Pos pos=pm.get(e);
  pos.x+=physics.vx;
  pos.y+=physics.vy;
}

Fixed version (ground truth):
@Override protected void process(Entity e){
  final Physics physics=ym.get(e);
  final Pos pos=pm.get(e);
  pos.x+=physics.vx * world.getDelta();
  pos.y+=physics.vy * world.getDelta();
}
Program: 24301
Project: 24301
Buggy source:
@Override protected void process(Entity e){
  final Physics physics=pm.get(e);
  final Gravity gravity=gm.get(e);
  physics.vy+=gravity.y * world.delta;
  physics.vx+=gravity.x * world.delta;
}

Fixed version (ground truth):
@Override protected void process(Entity e){
  final Physics physics=pm.get(e);
  final Gravity gravity=gm.get(e);
  physics.vy+=gravity.y * 100 * world.delta;
  physics.vx+=gravity.x * GRAVITY_FACTOR * world.delta;
}
Program: 24302
Project: 24302
Buggy source:
@Override protected void process(Entity e){
  final Physics physics=ym.get(e);
  final Pos pos=pm.get(e);
  final Bounds bounds=bm.get(e);
  float px=pos.x + physics.vx * world.delta;
  float py=pos.y + physics.vy * world.delta;
  if ((physics.vx > 0 && solidMask.atScreen(px + bounds.x2,py + bounds.y1 + (bounds.y2 - bounds.y1) * 0.5f)) || (physics.vx < 0 && solidMask.atScreen(px + bounds.x1,py + bounds.y1 + (bounds.y2 - bounds.y1) * 0.5f))) {
    physics.vx=0;
    px=pos.x;
  }
  if ((physics.vy > 0 && solidMask.atScreen(px + bounds.x1 + (bounds.x2 - bounds.x1) * 0.5f,py + bounds.y2)) || (physics.vy < 0 && solidMask.atScreen(px + bounds.x1 + (bounds.x2 - bounds.x1) * 0.5f,py + bounds.y1))) {
    physics.vy=0;
    py=pos.x;
  }
}

Fixed version (ground truth):
@Override protected void process(Entity e){
  final Physics physics=ym.get(e);
  final Pos pos=pm.get(e);
  final Bounds bounds=bm.get(e);
  if (physics.vx == 0 && physics.vy == 0)   return;
  float px=pos.x + physics.vx * world.delta;
  float py=pos.y + physics.vy * world.delta;
  if ((physics.vx > 0 && collides(px + bounds.x2,py + bounds.y1 + (bounds.y2 - bounds.y1) * 0.5f)) || (physics.vx < 0 && collides(px + bounds.x1,py + bounds.y1 + (bounds.y2 - bounds.y1) * 0.5f))) {
    physics.vx=0;
    px=pos.x;
  }
  if ((physics.vy > 0 && collides(px + bounds.x1 + (bounds.x2 - bounds.x1) * 0.5f,py + bounds.y2)) || (physics.vy < 0 && collides(px + bounds.x1 + (bounds.x2 - bounds.x1) * 0.5f,py + bounds.y1))) {
    physics.vy=0;
  }
}
Program: 24303
Project: 24303
Buggy source:
@Override protected void process(Entity e){
  Physics physics=pm.get(e);
  float dx=0;
  float dy=0;
  if (Gdx.input.isKeyPressed(Input.Keys.A))   dx=-1;
  if (Gdx.input.isKeyPressed(Input.Keys.D))   dx=1;
  if (Gdx.input.isKeyPressed(Input.Keys.S))   dy=-1;
  if (Gdx.input.isKeyPressed(Input.Keys.W))   dy=1;
  if (dx != 0)   physics.vx=dx * 5;
  if (dy != 0)   physics.vy=dy * 5;
}

Fixed version (ground truth):
@Override protected void process(Entity e){
  Physics physics=pm.get(e);
  float dx=0;
  float dy=0;
  if (Gdx.input.isKeyPressed(Input.Keys.A))   dx=-1;
  if (Gdx.input.isKeyPressed(Input.Keys.D))   dx=1;
  if (Gdx.input.isKeyPressed(Input.Keys.S))   dy=-1;
  if (Gdx.input.isKeyPressed(Input.Keys.W))   dy=1;
  if (dx != 0)   physics.vx=dx * 100;
  if (dy != 0)   physics.vy=dy * 100;
}
Program: 24304
Project: 24304
Buggy source:
public AssetSystem(){
  font=new BitmapFont(Gdx.files.internal("String_Node_Str"),false);
  font.setColor(0,0,0,0.9f);
  tileset=new Texture("String_Node_Str");
  add("String_Node_Str",0,0,TILE_SIZE,TILE_SIZE,1);
  add("String_Node_Str",32,224,TILE_SIZE,TILE_SIZE,1);
  add("String_Node_Str",0,448,TILE_SIZE,TILE_SIZE,1);
}

Fixed version (ground truth):
public AssetSystem(){
  font=new BitmapFont(Gdx.files.internal("String_Node_Str"),false);
  font.setColor(0,0,0,0.9f);
  tileset=new Texture("String_Node_Str");
  add("String_Node_Str",0,0,TILE_SIZE,TILE_SIZE,1);
  add("String_Node_Str",32,224,TILE_SIZE,TILE_SIZE,1);
  add("String_Node_Str",0,448,TILE_SIZE,TILE_SIZE,1);
  add("String_Node_Str",44,51,3,3,1);
}
Program: 24305
Project: 24305
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  int viewType=getItemViewType(position);
  boolean hasImg=TYPE_IMAGE == viewType || TYPE_IMAGE_SANS_DESCRIPTION == viewType;
  ViewFeedItem view=null != convertView ? (ViewFeedItem)convertView : new ViewFeedItem(m_context,viewType);
  FeedItem item=m_feedItems.get(position);
  boolean isRead=READ_ITEM_TIMES.contains(item.m_time);
  view.m_item=item;
  view.hasImage=hasImg;
  view.setAlpha(isRead && !hasImg ? 0.5F : 1.0F);
  view.setBackgroundColor(isRead ? Color.TRANSPARENT : Color.WHITE);
  if (hasImg) {
    view.setBitmap(null);
    view.setTag(position);
    AsyncLoadImage.newInstance(view,item.m_imageName,position,isRead ? 0.5F : 1.0F);
  }
  if (parent.isShown() && m_isReadingItems) {
    READ_ITEM_TIMES.add(item.m_time);
  }
  return view;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  int viewType=getItemViewType(position);
  boolean hasImg=TYPE_IMAGE == viewType || TYPE_IMAGE_SANS_DESCRIPTION == viewType;
  ViewFeedItem view=null != convertView ? (ViewFeedItem)convertView : new ViewFeedItem(m_context,viewType);
  FeedItem item=m_feedItems.get(position);
  boolean isRead=READ_ITEM_TIMES.contains(item.m_time);
  view.m_item=item;
  view.m_hasImage=hasImg;
  view.setAlpha(isRead ? 0.5F : 1.0F);
  view.setBackgroundColor(isRead ? Color.TRANSPARENT : Color.WHITE);
  if (hasImg) {
    view.setBitmap(null);
    view.setTag(position);
    AsyncLoadImage.newInstance(view,item.m_imageName,position);
  }
  if (parent.isShown() && m_isReadingItems && ListFragmentTag.s_hasScrolled) {
    READ_ITEM_TIMES.add(item.m_time);
  }
  return view;
}
Program: 24306
Project: 24306
Buggy source:
private AsyncLoadImage(ViewFeedItem view,int viewTag,float opacity){
  m_context=view.getContext();
  m_view=new WeakReference<>(view);
  m_viewTag=viewTag;
  m_opacity=opacity;
}

Fixed version (ground truth):
private AsyncLoadImage(ViewFeedItem view,int viewTag){
  m_context=view.getContext();
  m_view=new WeakReference<>(view);
  m_viewTag=viewTag;
}
Program: 24307
Project: 24307
Buggy source:
static void newInstance(ViewFeedItem view,String imageName,int viewTag,float opacity){
  AsyncTask<String,Void,Bitmap> task=new AsyncLoadImage(view,viewTag,opacity);
  task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,imageName);
}

Fixed version (ground truth):
static void newInstance(ViewFeedItem view,String imageName,int viewTag){
  AsyncTask<String,Void,Bitmap> task=new AsyncLoadImage(view,viewTag);
  task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,imageName);
}
Program: 24308
Project: 24308
Buggy source:
@Override protected void onPostExecute(Bitmap result){
  if (isCancelled()) {
    return;
  }
  ViewFeedItem view=m_view.get();
  if (null != view && (Integer)view.getTag() == m_viewTag && null != result) {
    AlphaAnimation animation=new AlphaAnimation(0.0F,m_opacity);
    animation.setDuration(IMAGE_FADE_IN_DURATION);
    animation.setFillAfter(true);
    view.setBitmap(result);
    view.setAnimation(animation);
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(Bitmap result){
  if (isCancelled()) {
    return;
  }
  ViewFeedItem view=m_view.get();
  if (null != view && (Integer)view.getTag() == m_viewTag && null != result) {
    view.setBitmap(result);
  }
}
Program: 24309
Project: 24309
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  AdapterTags.READ_ITEM_TIMES.addAll(Read.longSet(this,READ_ITEMS));
  FragmentManager manager=getFragmentManager();
  FragmentTransaction transaction=manager.beginTransaction();
  m_FragmentNavigationDrawer=(FragmentNavigationDrawer)manager.findFragmentById(R.id.navigation_drawer);
  m_FragmentNavigationDrawer.setUp(R.id.navigation_drawer,(DrawerLayout)findViewById(R.id.drawer_layout));
  AsyncNavigationAdapter.update(this);
  for (int i=0; FRAGMENT_TAGS.length > i; i++) {
    Fragment fragment=getFragment(manager,FRAGMENT_TAGS[i]);
    if (!fragment.isAdded()) {
      transaction.add(R.id.content_frame,fragment,FRAGMENT_TAGS[i]);
    }
    if (0 != i && !fragment.isHidden()) {
      transaction.hide(fragment);
    }
  }
  transaction.commit();
  m_currentFragment=FRAGMENT_TAGS[0];
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  AdapterTags.READ_ITEM_TIMES.addAll(Read.longSet(this,READ_ITEMS));
  FragmentManager manager=getFragmentManager();
  FragmentTransaction transaction=manager.beginTransaction();
  m_FragmentNavigationDrawer=(FragmentNavigationDrawer)manager.findFragmentById(R.id.navigation_drawer);
  m_FragmentNavigationDrawer.setUp(R.id.navigation_drawer,(DrawerLayout)findViewById(R.id.drawer_layout));
  AsyncNewTagAdapters.update(this);
  for (int i=0; FRAGMENT_TAGS.length > i; i++) {
    Fragment fragment=getFragment(manager,FRAGMENT_TAGS[i]);
    if (!fragment.isAdded()) {
      transaction.add(R.id.content_frame,fragment,FRAGMENT_TAGS[i]);
    }
    if (0 != i && !fragment.isHidden()) {
      transaction.hide(fragment);
    }
  }
  transaction.commit();
  m_currentFragment=FRAGMENT_TAGS[0];
}
Program: 24310
Project: 24310
Buggy source:
@Override protected void onStop(){
  super.onStop();
  Write.longSet(this,READ_ITEMS,AdapterTags.READ_ITEM_TIMES);
  setServiceIntent(ALARM_SERVICE_START);
}

Fixed version (ground truth):
@Override protected void onStop(){
  super.onStop();
  Write.longSet(this,READ_ITEMS,AdapterTags.READ_ITEM_TIMES);
  setServiceIntent(ALARM_SERVICE_START);
  ListFragmentTag.s_hasScrolled=false;
}
Program: 24311
Project: 24311
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  Activity activity=getActivity();
  setListAdapter(new AdapterTags(activity));
  ListView listView=getListView();
  listView.setOnScrollListener(new OnScrollFeed(activity,listView.getPaddingTop()));
  listView.setDivider(new ColorDrawable(getResources().getColor(R.color.item_separator)));
  listView.setDividerHeight(1);
  registerForContextMenu(listView);
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  final Activity activity=getActivity();
  setListAdapter(new AdapterTags(activity));
  ListView listView=getListView();
  listView.setDivider(new ColorDrawable(getResources().getColor(R.color.item_separator)));
  listView.setDividerHeight(1);
  listView.setOnScrollListener(new AbsListView.OnScrollListener(){
    @Override public void onScrollStateChanged(    AbsListView view,    int scrollState){
      if (AbsListView.OnScrollListener.SCROLL_STATE_IDLE == scrollState) {
        AsyncNavigationAdapter.update(activity);
      }
      if (AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL == scrollState) {
        s_hasScrolled=true;
      }
    }
    @Override public void onScroll(    AbsListView v,    int fir,    int visible,    int total){
    }
  }
);
  registerForContextMenu(listView);
}
Program: 24312
Project: 24312
Buggy source:
@Override public void onDraw(Canvas canvas){
  if (hasImage && null == m_image) {
    return;
  }
  float verticalPosition=drawBase(canvas);
  verticalPosition=drawBitmap(canvas,verticalPosition);
  if (null != m_item.m_desLines && 0 != m_item.m_desLines.length && null != m_item.m_desLines[0]) {
    if (hasImage) {
      verticalPosition+=Utilities.getDp(4.0F);
    }
    drawDes(canvas,verticalPosition);
  }
}

Fixed version (ground truth):
@Override public void onDraw(Canvas canvas){
  if (m_hasImage && null == m_image) {
    return;
  }
  float verticalPosition=drawBase(canvas);
  verticalPosition=drawBitmap(canvas,verticalPosition);
  if (null != m_item.m_desLines && 0 != m_item.m_desLines.length && null != m_item.m_desLines[0]) {
    if (m_hasImage) {
      verticalPosition+=Utilities.getDp(4.0F);
    }
    drawDes(canvas,verticalPosition);
  }
}
Program: 24313
Project: 24313
Buggy source:
float drawBase(Canvas canvas){
  boolean rtl=Utilities.isTextRtl(m_item.m_title);
  float verticalPosition=m_paints[0].getTextSize() + Utilities.EIGHT_DP;
  int startPadding=rtl ? SCREEN - Utilities.EIGHT_DP : Utilities.EIGHT_DP;
  int endPadding=rtl ? Utilities.EIGHT_DP : SCREEN - Utilities.EIGHT_DP;
  Paint.Align start=rtl ? Paint.Align.RIGHT : Paint.Align.LEFT;
  Paint.Align end=rtl ? Paint.Align.LEFT : Paint.Align.RIGHT;
  m_paints[1].setTextAlign(end);
  canvas.drawText(getTime(m_item.m_time),endPadding,verticalPosition,m_paints[1]);
  String[] info={m_item.m_title,m_item.m_url};
  for (int i=0; 2 > i; i++) {
    m_paints[i].setTextAlign(start);
    canvas.drawText(info[i],startPadding,verticalPosition,m_paints[i]);
    verticalPosition+=m_paints[i].getTextSize();
  }
  return hasImage ? verticalPosition : verticalPosition + Utilities.getDp(4.0F);
}

Fixed version (ground truth):
float drawBase(Canvas canvas){
  boolean rtl=Utilities.isTextRtl(m_item.m_title);
  float verticalPosition=m_paints[0].getTextSize() + Utilities.EIGHT_DP;
  int startPadding=rtl ? SCREEN - Utilities.EIGHT_DP : Utilities.EIGHT_DP;
  int endPadding=rtl ? Utilities.EIGHT_DP : SCREEN - Utilities.EIGHT_DP;
  Paint.Align start=rtl ? Paint.Align.RIGHT : Paint.Align.LEFT;
  Paint.Align end=rtl ? Paint.Align.LEFT : Paint.Align.RIGHT;
  m_paints[1].setTextAlign(end);
  canvas.drawText(getTime(m_item.m_time),endPadding,verticalPosition,m_paints[1]);
  String[] info={m_item.m_title,m_item.m_url};
  for (int i=0; 2 > i; i++) {
    m_paints[i].setTextAlign(start);
    canvas.drawText(info[i],startPadding,verticalPosition,m_paints[i]);
    verticalPosition+=m_paints[i].getTextSize();
  }
  return m_hasImage ? verticalPosition : verticalPosition + Utilities.getDp(4.0F);
}