Program: 69460
Project: 69460
Buggy source:
/** 
 * prior to calling this method, all instance vars must be set.
 */
public void signOn(UserSession usess){
  boolean isDebug=log.isDebug();
synchronized (usess) {
    if (isDebug)     log.debug("String_Node_Str");
    if (usess.isAuthenticated()) {
      throw new AssertException("String_Node_Str");
    }
    IdentityEnvironment identityEnvironment=usess.getIdentityEnvironment();
    Identity identity=identityEnvironment.getIdentity();
    if (identity == null) {
      throw new AssertException("String_Node_Str");
    }
    SessionInfo sessionInfo=usess.getSessionInfo();
    if (sessionInfo == null) {
      throw new AssertException("String_Node_Str" + identity);
    }
    usess.setAuthenticated(true);
    if (sessionInfo.isWebDAV()) {
      usess.reloadPreferences();
      authUserSessions.add(usess);
      log.audit("String_Node_Str" + sessionInfo.toString());
    }
 else {
      UserSession invalidatedSession=null;
      if (isDebug) {
        log.debug("String_Node_Str" + identity.getName() + "String_Node_Str"+ authUsersNamesOtherNodes.contains(identity.getKey()));
      }
      if ((userNameToIdentity.contains(identity.getKey()) || userSessionCache.containsKey(identity.getKey())) && !sessionInfo.isWebDAV() && !sessionInfo.isREST()&& !usess.getRoles().isGuestOnly()) {
        log.info("String_Node_Str");
        invalidatedSession=getUserSessionForGui(identity.getKey());
        authUserSessions.remove(invalidatedSession);
      }
      authUserSessions.add(usess);
      if (isDebug)       log.debug("String_Node_Str" + identity.getName().toLowerCase());
      userNameToIdentity.add(identity.getKey());
      userSessionCache.put(identity.getKey(),new Integer(Settings.getNodeId()));
      usess.reloadPreferences();
      log.audit("String_Node_Str" + sessionInfo.toString());
      CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(new SignOnOffEvent(identity,true),ORES_USERSESSION);
      if (invalidatedSession != null || authUsersNamesOtherNodes.contains(identity.getKey())) {
        usess.putEntry(STORE_KEY_KILLED_EXISTING_SESSION,Boolean.TRUE);
        if (isDebug)         log.debug("String_Node_Str" + identity.getName());
        authUsersNamesOtherNodes.remove(identity.getKey());
        if (invalidatedSession != null) {
          signOffAndClear(invalidatedSession);
        }
      }
      if (isDebug)       log.debug("String_Node_Str");
    }
    if (sessionInfo.isREST()) {
      sessionCountRest.incrementAndGet();
    }
 else     if (sessionInfo.isWebDAV()) {
      sessionCountDav.incrementAndGet();
    }
 else {
      sessionCountWeb.incrementAndGet();
    }
  }
}

Fixed version (ground truth):
/** 
 * prior to calling this method, all instance vars must be set.
 */
public void signOn(UserSession usess){
  boolean isDebug=log.isDebug();
synchronized (usess) {
    if (isDebug)     log.debug("String_Node_Str");
    if (usess.isAuthenticated()) {
      throw new AssertException("String_Node_Str");
    }
    IdentityEnvironment identityEnvironment=usess.getIdentityEnvironment();
    Identity identity=identityEnvironment.getIdentity();
    if (identity == null) {
      throw new AssertException("String_Node_Str");
    }
    SessionInfo sessionInfo=usess.getSessionInfo();
    if (sessionInfo == null) {
      throw new AssertException("String_Node_Str" + identity);
    }
    usess.setAuthenticated(true);
    if (sessionInfo.isWebDAV()) {
      usess.reloadPreferences();
      authUserSessions.add(usess);
      log.audit("String_Node_Str" + sessionInfo.toString());
    }
 else {
      UserSession invalidatedSession=null;
      if (isDebug) {
        log.debug("String_Node_Str" + identity.getName() + "String_Node_Str"+ authUsersNamesOtherNodes.contains(identity.getKey()));
      }
      if ((userNameToIdentity.contains(identity.getKey()) || userSessionCache.containsKey(identity.getKey())) && !sessionInfo.isWebDAV() && !sessionInfo.isREST()&& !usess.getRoles().isGuestOnly()) {
        log.info("String_Node_Str");
        invalidatedSession=getUserSessionForGui(identity.getKey());
        if (invalidatedSession != null) {
          authUserSessions.remove(invalidatedSession);
        }
      }
      authUserSessions.add(usess);
      if (isDebug)       log.debug("String_Node_Str" + identity.getName().toLowerCase());
      userNameToIdentity.add(identity.getKey());
      userSessionCache.put(identity.getKey(),new Integer(Settings.getNodeId()));
      usess.reloadPreferences();
      log.audit("String_Node_Str" + sessionInfo.toString());
      CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(new SignOnOffEvent(identity,true),ORES_USERSESSION);
      if (invalidatedSession != null || authUsersNamesOtherNodes.contains(identity.getKey())) {
        usess.putEntry(STORE_KEY_KILLED_EXISTING_SESSION,Boolean.TRUE);
        if (isDebug)         log.debug("String_Node_Str" + identity.getName());
        authUsersNamesOtherNodes.remove(identity.getKey());
        if (invalidatedSession != null) {
          signOffAndClear(invalidatedSession);
        }
      }
      if (isDebug)       log.debug("String_Node_Str");
    }
    if (sessionInfo.isREST()) {
      sessionCountRest.incrementAndGet();
    }
 else     if (sessionInfo.isWebDAV()) {
      sessionCountDav.incrementAndGet();
    }
 else {
      sessionCountWeb.incrementAndGet();
    }
  }
}