Program: 10111
Project: 10111
Buggy source:
@Override public void run(){
  while (true) {
    long now=DateTime.now().getMillis();
    Page threadList;
    try {
      threadList=sourceBoard.getAllThreads(lastMod);
    }
 catch (    HttpGetException e) {
      if (e.getHttpStatus() == 304)       debug(TALK,("String_Node_Str"));
 else       debug(WARN,"String_Node_Str" + e.getMessage());
      continue;
    }
catch (    ContentGetException e) {
      debug(WARN,"String_Node_Str" + e.getMessage());
      continue;
    }
    lastMod=threadList.getLastMod();
    if (threadList == null) {
      debug(WARN,("String_Node_Str"));
      continue;
    }
    Map<Integer,Topic> threadMap=new HashMap<Integer,Topic>();
    for (    Topic topic : threadList.getThreads()) {
      threadMap.put(topic.getNum(),topic);
    }
    for (    Topic oldTopic : topics.values()) {
      oldTopic.lock.writeLock().lock();
      Topic newTopic=threadMap.remove(oldTopic.getNum());
      if (newTopic != null) {
        if (oldTopic.getLastModTimestamp() < newTopic.getLastModTimestamp()) {
          debug(TALK,"String_Node_Str" + oldTopic.getNum());
          if (!newTopics.contains(newTopic.getNum()))           newTopics.add(newTopic.getNum());
        }
        oldTopic.setLastModTimestamp(newTopic.getLastModTimestamp());
        oldTopic.setLastPage(newTopic.getLastPage());
      }
 else {
        if (!newTopics.contains(oldTopic.getNum()))         newTopics.add(oldTopic.getNum());
      }
      oldTopic.lock.writeLock().unlock();
    }
    for (    Topic topic : threadMap.values()) {
      topic.lock.writeLock().lock();
      topics.put(topic.getNum(),topic);
      if (!newTopics.contains(topic.getNum()))       newTopics.add(topic.getNum());
      topic.lock.writeLock().unlock();
    }
    debug(TALK,"String_Node_Str");
    long left=this.wait - (DateTime.now().getMillis() - now);
    if (left > 0) {
      try {
        Thread.sleep(left);
      }
 catch (      InterruptedException e) {
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    long startTime=DateTime.now().getMillis();
    Page threadList;
    try {
      threadList=sourceBoard.getAllThreads(lastMod);
    }
 catch (    HttpGetException e) {
      if (e.getHttpStatus() == 304)       debug(TALK,("String_Node_Str"));
 else       debug(WARN,"String_Node_Str" + e.getMessage());
      sleepRemaining(startTime);
      continue;
    }
catch (    ContentGetException e) {
      debug(WARN,"String_Node_Str" + e.getMessage());
      sleepRemaining(startTime);
      continue;
    }
    lastMod=threadList.getLastMod();
    if (threadList == null) {
      debug(WARN,("String_Node_Str"));
      sleepRemaining(startTime);
      continue;
    }
    Map<Integer,Topic> threadMap=new HashMap<Integer,Topic>();
    for (    Topic topic : threadList.getThreads()) {
      threadMap.put(topic.getNum(),topic);
    }
    for (    Topic oldTopic : topics.values()) {
      oldTopic.lock.writeLock().lock();
      Topic newTopic=threadMap.remove(oldTopic.getNum());
      if (newTopic != null) {
        if (oldTopic.getLastModTimestamp() < newTopic.getLastModTimestamp()) {
          debug(TALK,"String_Node_Str" + oldTopic.getNum());
          if (!newTopics.contains(newTopic.getNum()))           newTopics.add(newTopic.getNum());
        }
        oldTopic.setLastModTimestamp(newTopic.getLastModTimestamp());
        oldTopic.setLastPage(newTopic.getLastPage());
      }
 else {
        if (!newTopics.contains(oldTopic.getNum()))         newTopics.add(oldTopic.getNum());
      }
      oldTopic.lock.writeLock().unlock();
    }
    for (    Topic topic : threadMap.values()) {
      topic.lock.writeLock().lock();
      topics.put(topic.getNum(),topic);
      if (!newTopics.contains(topic.getNum()))       newTopics.add(topic.getNum());
      topic.lock.writeLock().unlock();
    }
    debug(TALK,"String_Node_Str");
    sleepRemaining(startTime);
  }
}