Program: 31312
Project: 31312
Buggy source:
/** 
 * Test of getCurrentUser method, of class org.owasp.esapi.Authenticator.
 * @throws Exception
 */
public void testGetCurrentUser() throws Exception {
  System.out.println("String_Node_Str");
  Authenticator instance=ESAPI.authenticator();
  String username1=ESAPI.randomizer().getRandomString(8,DefaultEncoder.CHAR_ALPHANUMERICS);
  String username2=ESAPI.randomizer().getRandomString(8,DefaultEncoder.CHAR_ALPHANUMERICS);
  User user1=instance.createUser(username1,"String_Node_Str","String_Node_Str");
  User user2=instance.createUser(username2,"String_Node_Str","String_Node_Str");
  user1.enable();
  MockHttpServletRequest request=new MockHttpServletRequest();
  MockHttpServletResponse response=new MockHttpServletResponse();
  ESAPI.httpUtilities().setCurrentHTTP(request,response);
  user1.loginWithPassword("String_Node_Str");
  User currentUser=instance.getCurrentUser();
  assertEquals(currentUser,user1);
  instance.setCurrentUser(user2);
  assertFalse(currentUser.getAccountName().equals(user2.getAccountName()));
  Runnable echo=new Runnable(){
    private int count=1;
    private boolean result=false;
    public void run(){
      Authenticator auth=ESAPI.authenticator();
      User a=null;
      try {
        String password=auth.generateStrongPassword();
        String accountName="String_Node_Str" + count++;
        a=auth.getUser(accountName);
        if (a != null) {
          auth.removeUser(accountName);
        }
        a=auth.createUser(accountName,password,password);
        auth.setCurrentUser(a);
      }
 catch (      AuthenticationException e) {
        e.printStackTrace();
      }
      User b=auth.getCurrentUser();
      result&=a.equals(b);
    }
  }
;
  ThreadGroup tg=new ThreadGroup("String_Node_Str");
  for (int i=0; i < 10; i++) {
    new Thread(tg,echo).start();
  }
  while (tg.activeCount() > 0) {
    Thread.sleep(100);
  }
}

Fixed version (ground truth):
/** 
 * Test of getCurrentUser method, of class org.owasp.esapi.Authenticator.
 * @throws Exception
 */
public void testGetCurrentUser() throws Exception {
  System.out.println("String_Node_Str");
  Authenticator instance=ESAPI.authenticator();
  String username1=ESAPI.randomizer().getRandomString(8,EncoderConstants.CHAR_ALPHANUMERICS);
  String username2=ESAPI.randomizer().getRandomString(8,EncoderConstants.CHAR_ALPHANUMERICS);
  User user1=instance.createUser(username1,"String_Node_Str","String_Node_Str");
  User user2=instance.createUser(username2,"String_Node_Str","String_Node_Str");
  user1.enable();
  MockHttpServletRequest request=new MockHttpServletRequest();
  MockHttpServletResponse response=new MockHttpServletResponse();
  ESAPI.httpUtilities().setCurrentHTTP(request,response);
  user1.loginWithPassword("String_Node_Str");
  User currentUser=instance.getCurrentUser();
  assertEquals(currentUser,user1);
  instance.setCurrentUser(user2);
  assertFalse(currentUser.getAccountName().equals(user2.getAccountName()));
  Runnable echo=new Runnable(){
    private int count=1;
    private boolean result=false;
    public void run(){
      Authenticator auth=ESAPI.authenticator();
      User a=null;
      try {
        String password=auth.generateStrongPassword();
        String accountName="String_Node_Str" + count++;
        a=auth.getUser(accountName);
        if (a != null) {
          auth.removeUser(accountName);
        }
        a=auth.createUser(accountName,password,password);
        auth.setCurrentUser(a);
      }
 catch (      AuthenticationException e) {
        e.printStackTrace();
      }
      User b=auth.getCurrentUser();
      result&=a.equals(b);
    }
  }
;
  ThreadGroup tg=new ThreadGroup("String_Node_Str");
  for (int i=0; i < 10; i++) {
    new Thread(tg,echo).start();
  }
  while (tg.activeCount() > 0) {
    Thread.sleep(100);
  }
}