Check to see if a session corresponding to the id exists.

This method will first check with the object store. If it
doesn't exist in the object store (might be passivated etc),
it will check with the data store.

@throws Exception the Exception
485918
@Override
    public boolean exists(String id) throws Exception {
        // try the object store first
        Session s = doGet(id);
        if (s != null) {
            try (Lock ignored = s.lock()) {
                // wait for the lock and check the validity of the session
                return s.isValid();
            }
        }
        // not there, so find out if session data exists for it
        return (sessionDataStore != null && sessionDataStore.exists(id));
    }
392497
private function checkProperties()
    {
        if (!isset($this->listId)) {
            throw new \Exception('[listId] is not set', 1);
        }

        if (!isset($this->installationUrl)) {
            throw new \Exception('[installationUrl] is not set', 1);
        }

        if (!isset($this->apiKey)) {
            throw new \Exception('[apiKey] is not set', 1);
        }
    }
51051
protected Session createSession() throws Exception {
        Config config = configBean.getConfig();
        DataSource dataSource = InitialContext.doLookup(config.getDataSourceJNDI());
        return new Session(dataSource, config.getDialect());
    }
821326
private void existsCheck(Dn dn) throws NoSuchNodeException, MissingParentException {
        try {
            if (!connection.exists(dn.getParent())) {
                throw new MissingParentException(lastMatch(dn));
            } else if (!connection.exists(dn)) {
                throw new NoSuchNodeException(dn);
            }
        } catch (LdapException e) {
            throw new LdapDaoException(e);
        }
    }
77249
void checkNotClosed() throws SISessionUnavailableException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "checkNotClosed");

    synchronized (this)
    {
      if (_closed)
      {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
          SibTr.exit(tc, "checkNotClosed", "Object closed");

        throw new SISessionUnavailableException(
          nls.getFormattedMessage("OBJECT_CLOSED_ERROR_CWSIP0081", 
                                  new Object[] { _dest.getName(),
                                                 _dest.getMessageProcessor().getMessagingEngineName() }, 
                                  null));
      }
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "checkNotClosed");
  }
945940
@Override
    public Session newSession(String id) {
        long created = System.currentTimeMillis();
        Session session = sessionCache.newSession(id, created, (defaultMaxIdleSecs > 0 ? defaultMaxIdleSecs * 1000L : -1));
        try {
            sessionCache.put(id, session);
            sessionsCreatedStats.increment();

            for (SessionListener listener : sessionListeners) {
                listener.sessionCreated(session);
            }

            return session;
        } catch (Exception e) {
            log.warn("Failed to create a new session", e);
            return null;
        }
    }
1275282
protected boolean existsTable(){
        try {
            int count = sqlManager.getSingleResult(Integer.class,
                    new StringSqlResource(String.format("SELECT COUNT(*) FROM %s", tableName)));

            if(count == 0){
                // TODO Should insert an initial record?
                return false;
            }
            return true;

        } catch(SQLRuntimeException ex){
            return false;
        }
    }
524566
@Override
	public void check() throws JMSException
	{
		if (jdniInitialContextFactoryName == null)
			throw new InvalidDescriptorException("Missing peer property : 'jdniInitialContextFactoryName'");
		if (jndiConnectionFactoryName == null)
			throw new InvalidDescriptorException("Missing peer property : 'jndiConnectionFactoryName'");
		if (providerURL == null)
			throw new InvalidDescriptorException("Missing peer property : 'providerURL'");
	}
1032360
Result executeDeleteStatement(Session session) {

        int                       count   = 0;
        RowSetNavigatorLinkedList oldRows = new RowSetNavigatorLinkedList();
        RangeIterator it = RangeVariable.getIterator(session,
            targetRangeVariables);

        while (it.next()) {
            Row currentRow = it.getCurrentRow();

            oldRows.add(currentRow);
        }

        count = delete(session, baseTable, oldRows);

        if (restartIdentity && targetTable.identitySequence != null) {
            targetTable.identitySequence.reset();
        }

        return Result.getUpdateCountResult(count);
    }
471522
private function laterSessionStart()
    {
        if (!is_null($this->fingerprint) && !$this->fingerprint->hasValidFingerprint()) {
            throw new \Exception("Session fingerprint doesn't match"); // @codeCoverageIgnore
        }
        if (!is_null($this->expiration) && $this->expiration->isObsolete()) {
            return true;
        }
        return false;
    }
632230
@Override
  public final boolean checkIsThereAnyUser() throws Exception {
    if (this.isThereAnyUser) {
      return true;
    }
    String query = "select USERTOMCAT.ITSUSER as ITSUSER, ITSROLE"
      + " from USERTOMCAT join USERROLETOMCAT"
        + " on USERROLETOMCAT.ITSUSER = USERTOMCAT.ITSUSER;";
    boolean result = false;
    IRecordSet<RS> recordSet = null;
    try {
      this.srvDatabase.setIsAutocommit(false);
      this.srvDatabase.
        setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED);
      this.srvDatabase.beginTransaction();
      recordSet = getSrvDatabase().retrieveRecords(query);
      if (recordSet.moveToFirst()) {
        this.isThereAnyUser = true;
        result = true;
      }
      this.srvDatabase.commitTransaction();
    } catch (Exception ex) {
      this.srvDatabase.rollBackTransaction();
      throw ex;
    } finally {
      this.srvDatabase.releaseResources();
      if (recordSet != null) {
        recordSet.close();
      }
    }
    return result;
  }
614126
public function catch($id, $saveCurrent = true)
    {
        if ($saveCurrent) {
            session_write_close();
        } else {
            session_abort();
        }

        if (session_id($id) === '') {
            throw new Exception("can`t find session with id $id");
        }
        if ( ! session_start()) {
            throw new Exception('can`t start session');
        }
    }
762565
protected void connect() throws Exception {
        String username = this.properties.getUsername();
        String password = this.properties.getPassword();

        if (this.properties.isEncryptedPassword() || this.properties.isEncryptedUsername()) {
            String privateKey = getPrivateKey();
            if (this.properties.isEncryptedUsername()) {
                final String decryptedUsername = AESHelper.decrypt(this.properties.getProperty(ENCRYPTED_USERNAME), privateKey);
                if (StringUtils.isEmpty(decryptedUsername)) {
                    throw new DatabaseEngineException("The encrypted username could not be decrypted.");
                }
                username = decryptedUsername;

            }

            if (this.properties.isEncryptedPassword()) {
                final String decryptedPassword = AESHelper.decrypt(this.properties.getProperty(ENCRYPTED_PASSWORD), privateKey);
                if (StringUtils.isEmpty(decryptedPassword)) {
                    throw new DatabaseEngineException("The encrypted password could not be decrypted.");
                }
                password = decryptedPassword;
            }
        }

        final String jdbc = getFinalJdbcConnection(this.properties.getJdbc());

        this.conn = DriverManager.getConnection(
                jdbc,
                username,
                password);

        if (this.properties.isSchemaSet()) {
            setSchema(this.properties.getSchema());
        }

        this.currentSchema = Optional.ofNullable(getSchema())
            .orElseThrow(() -> new DatabaseEngineException("Could not get current schema"));

        setTransactionIsolation();

        logger.debug("Connection successful.");
    }
696863
function localExists() {
  var testKey = 'test';
  if (typeof window !== 'undefined' && typeof window.sessionStorage !== 'undefined') {
    try {
      window.sessionStorage.setItem(testKey, '1');
      window.sessionStorage.removeItem(testKey);
      return true;
    } catch (error) {
      _logger2.default.error({
        description: 'Error saving to session storage', error: error,
        obj: 'storage', func: 'localExists'
      });
      return false;
    }
  }
  return false;
}
659015
protected function checkParam()
    {
        if (empty($this->getDatabase()) && $this->getMemory() === false) {
            $sErrorMessage = 'Connexion to SQLite must have a database defined or be in memory';
            throw new \Exception($sErrorMessage);
            return false;
        } else {
            return true;
        }
    }
256287
public function has($id)
    {
        try {
             $em = $this->entityManager->getDoctrineEntityManager();
             $data = $em->getRepository($this->getEntityClass())->findOneBy(array(
                 'id' => $id,
             ));
             
             if ($data !== null) {
                 return true;
             }
             
             return false;
        } catch (\Exception $e) {
            throw new Exception('Cannot check if there is an entity for the given id "' . $id . '".', 0, $e);
        }
    }
1260730
@Override
    public void execute() throws ActivityException {
        Long instanceId = null;  // pre-existing instanceId
        String instanceIdSpec = getInstanceIdVariable();
        if (instanceIdSpec != null) {
            Object value = getValue(instanceIdSpec);
            if (value instanceof Long)
                instanceId = (Long) value;
            else if (value != null)
                instanceId = Long.parseLong(value.toString());
        }
        try {
            if (instanceId == null) {
                TaskInstance taskInstance = createTaskInstance();
                instanceId = taskInstance.getTaskInstanceId();
                if (instanceIdSpec != null)
                    setValue(instanceIdSpec, instanceId);
            }
            else {
                // update secondary owner
                updateOwningTransition(instanceId);
            }

            if (needSuspend()) {
                getEngine().createEventWaitInstance(getActivityInstanceId(), "TaskAction-" + getActivityInstanceId(), null, true, true);
                EventWaitInstance received = registerWaitEvents(false,true);
                if (received != null)
                  resume(getExternalEventInstanceDetails(received.getMessageDocumentId()), received.getCompletionCode());
            }
        }
        catch (Exception ex) {
            logger.severeException(ex.getMessage(), ex);
            throw new ActivityException(-1, ex.getMessage(), ex);
        }
    }