Program: 143595
Project: 143595
Buggy source:
private DebugJ2DBClient createJSUnitClient(final IUserManager userManager){
  if (!ApplicationServerSingleton.waitForInstanceStarted()) {
    return null;
  }
  final DebugJ2DBClient[] client=new DebugJ2DBClient[1];
  try {
    Runnable run=new Runnable(){
      public void run(){
        try {
synchronized (ApplicationServerSingleton.get()) {
            if (client[0] == null) {
              try {
                if (Utils.isAppleMacOS()) {
                  Thread.sleep(3000);
                }
                modelInitialised.await(30,TimeUnit.SECONDS);
              }
 catch (              InterruptedException e) {
                Debug.log(e);
              }
              client[0]=new DebugJ2DBClient(false,DebugClientHandler.this){
                private final List<Runnable> events=new ArrayList<Runnable>();
                @Override public void updateUI(                int time){
                  runEvents();
                  super.updateUI(time);
                }
                @Override protected boolean registerClient(                IUserClient uc) throws Exception {
                  boolean register=super.registerClient(uc);
                  ApplicationServerSingleton.get().setServerProcess(getClientID());
                  return register;
                }
                @Override protected IUserManager createUserManager(){
                  try {
                    userManager.createGroup(ApplicationServerSingleton.get().getClientId(),IRepository.ADMIN_GROUP);
                  }
 catch (                  Exception e) {
                    Debug.error(e);
                  }
                  return userManager;
                }
                /** 
 */
                private void runEvents(){
                  if (events.size() == 0)                   return;
                  Runnable[] runnables=events.toArray(new Runnable[events.size()]);
                  events.clear();
                  for (                  Runnable runnable : runnables) {
                    runnable.run();
                  }
                  runEvents();
                }
                @Override public void invokeAndWait(                Runnable r){
                  super.invokeAndWait(r);
                }
                @Override public void invokeLater(                Runnable r,                boolean immediate){
                  invokeLater(r);
                }
                @Override public void invokeLater(                Runnable r){
                  events.add(r);
                  final IServiceProvider client=this;
                  super.invokeLater(new Runnable(){
                    public void run(){
                      IServiceProvider prevServiceProvider=J2DBGlobals.setSingletonServiceProvider(client);
                      try {
                        runEvents();
                      }
  finally {
                        J2DBGlobals.setSingletonServiceProvider(prevServiceProvider);
                      }
                    }
                  }
);
                }
              }
;
              client[0].setCurrent(currentSolution);
            }
          }
        }
 catch (        Exception e) {
          Debug.error("String_Node_Str",e);
        }
      }
    }
;
    if (SwingUtilities.isEventDispatchThread()) {
      run.run();
    }
 else {
      SwingUtilities.invokeAndWait(run);
    }
  }
 catch (  Exception ex) {
    Debug.error(ex);
  }
  return client[0];
}

Fixed version (ground truth):
private DebugJ2DBClient createJSUnitClient(final IUserManager userManager){
  if (!ApplicationServerSingleton.waitForInstanceStarted()) {
    return null;
  }
  final DebugJ2DBClient[] client=new DebugJ2DBClient[1];
  try {
    Runnable run=new Runnable(){
      public void run(){
        try {
synchronized (ApplicationServerSingleton.get()) {
            if (client[0] == null) {
              try {
                if (Utils.isAppleMacOS()) {
                  Thread.sleep(3000);
                }
                modelInitialised.await(30,TimeUnit.SECONDS);
              }
 catch (              InterruptedException e) {
                Debug.log(e);
              }
              client[0]=new DebugJ2DBClient(false,DebugClientHandler.this){
                private final List<Runnable> events=new ArrayList<Runnable>();
                @Override public void updateUI(                int time){
                  runEvents();
                  super.updateUI(time);
                }
                @Override protected boolean registerClient(                IUserClient uc) throws Exception {
                  boolean register=super.registerClient(uc);
                  ApplicationServerSingleton.get().setServerProcess(getClientID());
                  return register;
                }
                @Override protected IUserManager createUserManager(){
                  try {
                    userManager.createGroup(ApplicationServerSingleton.get().getClientId(),IRepository.ADMIN_GROUP);
                  }
 catch (                  Exception e) {
                    Debug.error(e);
                  }
                  return userManager;
                }
                /** 
 */
                private void runEvents(){
                  if (events.size() == 0)                   return;
                  Runnable[] runnables=events.toArray(new Runnable[events.size()]);
                  events.clear();
                  for (                  Runnable runnable : runnables) {
                    runnable.run();
                  }
                  runEvents();
                }
                @Override public void invokeAndWait(                Runnable r){
                  super.invokeAndWait(r);
                }
                @Override public void invokeLater(                Runnable r,                boolean immediate){
                  invokeLater(r);
                }
                @Override public void invokeLater(                Runnable r){
                  events.add(r);
                  final IServiceProvider client=this;
                  super.invokeLater(new Runnable(){
                    public void run(){
                      IServiceProvider prevServiceProvider=J2DBGlobals.setSingletonServiceProvider(client);
                      try {
                        runEvents();
                      }
  finally {
                        J2DBGlobals.setSingletonServiceProvider(prevServiceProvider);
                      }
                    }
                  }
);
                }
                @Override public void reportError(                Component parentComponent,                String message,                Object detail){
                  errorToDebugger(message,detail);
                  logError(message,detail);
                }
                @Override public void reportInfo(                Component parentComponent,                String message,                String title){
                  infoToDebugger(message);
                  Debug.trace(message);
                }
              }
;
              client[0].setCurrent(currentSolution);
            }
          }
        }
 catch (        Exception e) {
          Debug.error("String_Node_Str",e);
        }
      }
    }
;
    if (SwingUtilities.isEventDispatchThread()) {
      run.run();
    }
 else {
      SwingUtilities.invokeAndWait(run);
    }
  }
 catch (  Exception ex) {
    Debug.error(ex);
  }
  return client[0];
}