Program: 106410
Project: 106410
Buggy source:
public void dequeueFromOneQueue(){
  final int totalRuns=5000;
  final SyncQueueVO queue=mgr.queue("String_Node_Str",1L,"String_Node_Str",1,1);
  for (int i=1; i < totalRuns; i++)   mgr.queue("String_Node_Str",1L,"String_Node_Str",i + 1,1);
  count=0;
  expectingCurrent=1;
  Thread thread1=new Thread(new Runnable(){
    @Override public void run(){
      while (count < totalRuns) {
        SyncQueueItemVO item=mgr.dequeueFromOne(queue.getId(),1L);
        if (item != null) {
          s_logger.info("String_Node_Str" + item.toString());
          Assert.assertEquals(expectingCurrent,item.getContentId().longValue());
          expectingCurrent++;
          count++;
          mgr.purgeItem(item.getId());
        }
        try {
          Thread.sleep(getRandomMilliseconds(1,10));
        }
 catch (        InterruptedException e) {
        }
      }
    }
  }
);
  Thread thread2=new Thread(new Runnable(){
    @Override public void run(){
      while (count < totalRuns) {
        SyncQueueItemVO item=mgr.dequeueFromOne(queue.getId(),1L);
        if (item != null) {
          s_logger.info("String_Node_Str" + item.toString());
          Assert.assertEquals(expectingCurrent,item.getContentId().longValue());
          expectingCurrent++;
          count++;
          mgr.purgeItem(item.getId());
        }
        try {
          Thread.sleep(getRandomMilliseconds(1,10));
        }
 catch (        InterruptedException e) {
        }
      }
    }
  }
);
  thread1.start();
  thread2.start();
  try {
    thread1.join();
  }
 catch (  InterruptedException e) {
  }
  try {
    thread2.join();
  }
 catch (  InterruptedException e) {
  }
  Assert.assertEquals(totalRuns,count);
}

Fixed version (ground truth):
public void dequeueFromOneQueue(){
  final int totalRuns=5000;
  final SyncQueueVO queue=mgr.queue("String_Node_Str",1L,"String_Node_Str",1,1);
  for (int i=1; i < totalRuns; i++)   mgr.queue("String_Node_Str",1L,"String_Node_Str",i + 1,1);
  count=0;
  expectingCurrent=1;
  Thread thread1=new Thread(new Runnable(){
    @Override public void run(){
      while (count < totalRuns) {
        SyncQueueItemVO item=mgr.dequeueFromOne(queue.getId(),1L);
        if (item != null) {
          s_logger.info("String_Node_Str" + item.toString());
          Assert.assertEquals(expectingCurrent,item.getContentId().longValue());
          expectingCurrent++;
          count++;
          mgr.purgeItem(item.getId());
        }
        try {
          Thread.sleep(100);
        }
 catch (        InterruptedException e) {
        }
      }
    }
  }
);
  Thread thread2=new Thread(new Runnable(){
    @Override public void run(){
      while (count < totalRuns) {
        SyncQueueItemVO item=mgr.dequeueFromOne(queue.getId(),1L);
        if (item != null) {
          s_logger.info("String_Node_Str" + item.toString());
          Assert.assertEquals(expectingCurrent,item.getContentId().longValue());
          expectingCurrent++;
          count++;
          mgr.purgeItem(item.getId());
        }
        try {
          Thread.sleep(100);
        }
 catch (        InterruptedException e) {
        }
      }
    }
  }
);
  thread1.start();
  thread2.start();
  try {
    thread1.join();
  }
 catch (  InterruptedException e) {
  }
  try {
    thread2.join();
  }
 catch (  InterruptedException e) {
  }
  Assert.assertEquals(totalRuns,count);
}