public void validateSession(InternalSession internalSession,SessionID sid) throws SessionException {
  if (!sid.equals(internalSession.getID()) && internalSession.getRestrictionForToken(sid) == null) {
    throw new IllegalArgumentException("Session id mismatch");
  }
  if (internalSession.getState() != SessionState.VALID) {
    if (internalSession.isTimedOut()) {
      throw new SessionTimedOutException(MessageFormat.format(ERROR_FORMAT,SessionBundle.getString(SESSION_TIMED_OUT),sid));
    }
 else {
      throw new SessionException(MessageFormat.format(ERROR_FORMAT,SessionBundle.getString(INVALID_SESSION_STATE),sid));
    }
  }
}

public void validateSession ( InternalSession internalSession , SessionID sid ) throws SessionException { if ( ! sid . equals ( internalSession . getID ( ) ) && internalSession . getRestrictionForToken ( sid ) == null ) { throw new IllegalArgumentException ( "Session id mismatch" ) ; } if ( internalSession . getState ( ) != SessionState . VALID ) { if ( internalSession . isTimedOut ( ) ) { throw new SessionTimedOutException ( MessageFormat . format ( ERROR_FORMAT , SessionBundle . getString ( SESSION_TIMED_OUT ) , sid ) ) ; } else { throw new SessionException ( MessageFormat . format ( ERROR_FORMAT , SessionBundle . getString ( INVALID_SESSION_STATE ) , sid ) ) ; } } }
validates the state of an internal session against a session id . performs two checks , firstly that the session matches the sessionid and secondly that the internalsession is not timed out .
