Program: 166776
Project: 166776
Buggy source:
/** 
 * Derived task comes from the inference rules.
 * @param task the derived task
 */
public void derivedTask(final Task task,final boolean revised,final boolean single,Sentence occurence,Sentence occurence2){
  if (task.budget.aboveThreshold()) {
    if (task.sentence != null && task.sentence.truth != null) {
      float conf=task.sentence.truth.getConfidence();
      if (conf == 0) {
        if (recorder.isActive()) {
          recorder.onTaskRemove(task,"String_Node_Str");
        }
        return;
      }
    }
    final Stamp stamp=task.sentence.stamp;
    if (occurence != null && occurence.getOccurenceTime() != Stamp.ETERNAL) {
      stamp.setOccurrenceTime(occurence.getOccurenceTime());
    }
    if (occurence2 != null && occurence2.getOccurenceTime() != Stamp.ETERNAL) {
      stamp.setOccurrenceTime(occurence2.getOccurenceTime());
    }
    final LinkedHashSet<Term> chain=stamp.getChain();
    final Term currentTaskContent=getCurrentTask().getContent();
    if (getCurrentBelief() != null && getCurrentBelief().isJudgment()) {
      final Term currentBeliefContent=getCurrentBelief().content;
      if (chain.contains(currentBeliefContent)) {
        chain.remove(currentBeliefContent);
      }
      stamp.addToChain(currentBeliefContent);
    }
    if (currentBelief == null && single && currentTask != null && currentTask.sentence.isJudgment()) {
      if (chain.contains(currentTaskContent)) {
        chain.remove(currentTaskContent);
      }
      stamp.addToChain(currentTaskContent);
    }
    if (currentTask != null && !single && currentTask.sentence.isJudgment()) {
      if (chain.contains(currentTaskContent)) {
        chain.remove(currentTaskContent);
      }
      stamp.addToChain(currentTaskContent);
    }
    if (!revised) {
      int i=0;
      for (      Term chain1 : chain) {
        if (task.sentence.isJudgment() && task.getContent().equals(chain1)) {
          if (task.getParentTask() == null || (!(task.getParentTask().getContent().equals(Negation.make(task.getContent(),this))) && !(task.getContent().equals(Negation.make(task.getParentTask().getContent(),this))))) {
            if (recorder.isActive()) {
              recorder.onTaskRemove(task,"String_Node_Str" + i + "String_Node_Str");
            }
            return;
          }
        }
        i++;
      }
    }
 else {
      final int stampLength=stamp.baseLength;
      for (int i=0; i < stampLength; i++) {
        final long baseI=stamp.evidentialBase[i];
        for (int j=0; j < stampLength; j++) {
          if ((i != j) && (baseI == stamp.evidentialBase[j])) {
            if (recorder.isActive()) {
              recorder.onTaskRemove(task,"String_Node_Str");
            }
            return;
          }
        }
      }
    }
    output(task);
    addNewTask(task,"String_Node_Str");
  }
 else {
    if (recorder.isActive()) {
      recorder.onTaskRemove(task,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Derived task comes from the inference rules.
 * @param task the derived task
 */
public void derivedTask(final Task task,final boolean revised,final boolean single,Sentence occurence,Sentence occurence2){
  if (task.budget.aboveThreshold()) {
    if (task.sentence != null && task.sentence.truth != null) {
      float conf=task.sentence.truth.getConfidence();
      if (conf == 0) {
        if (recorder.isActive()) {
          recorder.onTaskRemove(task,"String_Node_Str");
        }
        return;
      }
    }
    final Stamp stamp=task.sentence.stamp;
    if (occurence != null && occurence.getOccurenceTime() != Stamp.ETERNAL) {
      stamp.setOccurrenceTime(occurence.getOccurenceTime());
    }
    if (occurence2 != null && occurence2.getOccurenceTime() != Stamp.ETERNAL) {
      stamp.setOccurrenceTime(occurence2.getOccurenceTime());
    }
    final LinkedHashSet<Term> chain=stamp.getChain();
    final Term currentTaskContent=getCurrentTask().getContent();
    if (getCurrentBelief() != null && getCurrentBelief().isJudgment()) {
      final Term currentBeliefContent=getCurrentBelief().content;
      if (chain.contains(currentBeliefContent)) {
        chain.remove(currentBeliefContent);
      }
      stamp.addToChain(currentBeliefContent);
    }
    if (currentBelief == null && single && currentTask != null && currentTask.sentence.isJudgment()) {
      if (chain.contains(currentTaskContent)) {
        chain.remove(currentTaskContent);
      }
      stamp.addToChain(currentTaskContent);
    }
    if (currentTask != null && !single && currentTask.sentence.isJudgment()) {
      if (chain.contains(currentTaskContent)) {
        chain.remove(currentTaskContent);
      }
      stamp.addToChain(currentTaskContent);
    }
    if (!revised) {
      int i=0;
      for (      Term chain1 : chain) {
        if (task.sentence.isJudgment() && task.getContent().equals(chain1)) {
          if (task.getParentTask() == null || (!(task.getParentTask().getContent().equals(Negation.make(task.getContent(),this))) && !(task.getContent().equals(Negation.make(task.getParentTask().getContent(),this))))) {
            if (recorder.isActive()) {
              recorder.onTaskRemove(task,"String_Node_Str" + i + "String_Node_Str");
            }
            return;
          }
        }
        i++;
      }
    }
 else {
      final int stampLength=stamp.baseLength;
      for (int i=0; i < stampLength; i++) {
        final long baseI=stamp.evidentialBase[i];
        for (int j=0; j < stampLength; j++) {
          if ((i != j) && (baseI == stamp.evidentialBase[j]) && !(task.sentence.content instanceof Operation)) {
            if (recorder.isActive()) {
              recorder.onTaskRemove(task,"String_Node_Str");
            }
            return;
          }
        }
      }
    }
    output(task);
    addNewTask(task,"String_Node_Str");
  }
 else {
    if (recorder.isActive()) {
      recorder.onTaskRemove(task,"String_Node_Str");
    }
  }
}