Generates a session identifier. The value corresponds to the name of a
sub-directory (session) in the root test log directory.

@return a session id string ("s0001" by default, unless the session
sub-directory already exists).
554728
public static String generateSessionId(File logDir) {
        int i = 1;
        String session = "s0001";
        while (new File(logDir, session).exists() && i < 10000) {
            i++;
            session = "s" + Integer.toString(10000 + i).substring(1);
        }
        return session;
    }
447266
public static String getSessionID(HttpServletRequest req) {
        String sessionID = null;
        final HttpServletRequest f_req = req;

        try {
            sessionID = AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
                @Override
                public String run() throws Exception {
                    HttpSession session = f_req.getSession();
                    if (session != null) {
                        return session.getId();
                    } else {
                        return null;
                    }
                }
            });
        } catch (PrivilegedActionException e) {
            if ((e.getException()) instanceof com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException) {
                if (!req.isRequestedSessionIdFromCookie()) {
                    sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
                        @Override
                        public String run() {
                            return f_req.getSession().getId();
                        }
                    });
                } else {
                    sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
                        @Override
                        public String run() {
                            return f_req.getRequestedSessionId();
                        }
                    });
                }

            }
        } catch (com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException e) {
            try {
                if (!req.isRequestedSessionIdFromCookie()) {
                    sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
                        @Override
                        public String run() {
                            return f_req.getSession().getId();
                        }
                    });
                } else {
                    sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
                        @Override
                        public String run() {
                            return f_req.getRequestedSessionId();
                        }
                    });
                }

            } catch (java.lang.NullPointerException ee) {
                sessionID = "UnauthorizedSessionRequest";
            } catch (com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException ue) {
                sessionID = "UnauthorizedSessionRequest";
            }

        }
        return sessionID;
    }
170444
public function name()
    {
        if (null === $this->sessionName) {
            $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
            $this->sessionName = '';
            for ($i = 0; $i < 32; $i++) {
                $this->sessionName .= $characters[rand(0, strlen($characters) - 1)];
            }
        }

        return $this->sessionName;
    }
911753
public static String getSessionId(final HttpServletRequest pRequest) {
        HttpSession session = pRequest.getSession();

        return (session != null) ? session.getId() : null;
    }
1247054
public String getID() {
        byte[] genBytes = new byte[_byteArraySize];
        synchronized (_random) {
            _random.nextBytes(genBytes);
        }
        String id = convertSessionIdBytesToSessionId(genBytes, _sessionIDLength);
        if (tc.isDebugEnabled()) {
            Tr.debug(tc, "sessionID=" + id);
        }
        return id;
    }
1243139
protected static String generateSessionId() {
        return String.valueOf(randomGenerator.nextInt(Integer.MAX_VALUE) + randomGenerator.nextInt(Integer.MAX_VALUE));
    }
1341917
@Override
    public String getSessionId() {
        ServletRESTRequestImpl ret = castRequest();
        if (ret != null)
            return ret.getSessionId();
        return null;
    }
418285
public function getFormId()
    {
        if ($this->_sFormId === null) {
            $this->_sFormId = \OxidEsales\Eshop\Core\Registry::getUtilsObject()->generateUId();
            \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('sessionuformid', $this->_sFormId);
        }

        return $this->_sFormId;
    }
1110806
protected function generate_session_id() {
		$length = 40;

		require_once ABSPATH . 'wp-includes/class-phpass.php';
		$bytes = ( new \PasswordHash( 8, false ) )->get_random_bytes( $length * 2 );

		return substr( str_replace( [ '/', '+', '=' ], '', base64_encode( $bytes ) ), 0, $length );
	}
603482
public String newSessionId(long seedTerm) {
        synchronized (random) {
            long r0;
            if (weakRandom) {
                r0 = hashCode() ^ Runtime.getRuntime().freeMemory() ^ random.nextInt() ^ (seedTerm << 32);
            } else {
                r0 = random.nextLong();
            }
            if (r0 < 0) {
                r0 = -r0;
            }

            long r1;
            if (weakRandom) {
                r1 = hashCode() ^ Runtime.getRuntime().freeMemory() ^ random.nextInt() ^ (seedTerm << 32);
            } else {
                r1 = random.nextLong();
            }
            if (r1 < 0) {
                r1 = -r1;
            }

            StringBuilder id = new StringBuilder();
            if (!StringUtils.isEmpty(groupName)) {
                id.append(groupName);
            }
            id.append(Long.toString(r0,36));
            id.append(Long.toString(r1,36));
            id.append(counter.getAndIncrement());
            return id.toString();
        }
    }
968662
private String rdIdentifier()
	{
		StringBuilder id = new StringBuilder();
		id.append(ch);

		while (restOfName(rdCh()))
		{
			id.append(ch);
		}

		return id.toString();
	}
1346209
public static function getSessionID()
    {
        $id = Arr::get($_COOKIE, HttpCache::$sessionName, '');
        Base::getLog()->debug(__METHOD__ . ' get session id', [
            'id' => $id,
        ]);
        return $id;
    }
43759
public String getIdName() {

        if (m_idName == null) {
            m_idName = getStartName();
            // remove special characters causing problems in ID attributes
            m_idName = CmsStringUtil.substitute(m_idName, ".", "-");
            m_idName = CmsStringUtil.substitute(m_idName, ":", "-");
            m_idName = CmsStringUtil.substitute(m_idName, "_", "-");

        }
        return m_idName;
    }
976425
public String generateSessionId()
    {

        byte random[] = new byte[16];

        // Render the result as a String of hexadecimal digits
        StringBuilder buffer = new StringBuilder();

        int resultLenBytes = 0;

        while (resultLenBytes < sessionIdLength)
        {
            getRandomBytes(random);
            for (int j = 0;
                    j < random.length && resultLenBytes < sessionIdLength;
                    j++)
            {
                byte b1 = (byte) ((random[j] & 0xf0) >> 4);
                byte b2 = (byte) (random[j] & 0x0f);
                if (b1 < 10)
                {
                    buffer.append((char) ('0' + b1));
                }
                else
                {
                    buffer.append((char) ('A' + (b1 - 10)));
                }
                if (b2 < 10)
                {
                    buffer.append((char) ('0' + b2));
                }
                else
                {
                    buffer.append((char) ('A' + (b2 - 10)));
                }
                resultLenBytes++;
            }
        }

        if (jvmRoute != null && jvmRoute.length() > 0)
        {
            buffer.append('.').append(jvmRoute);
        }

        return buffer.toString();
    }
1021173
public int getUserID()
    {
        int iUserID = -1;
        String strUserID = DBConstants.BLANK;
        if (this.getRecord().getRecordOwner() != null)
            if (this.getRecord().getRecordOwner().getTask() != null)
                if (this.getRecord().getRecordOwner().getTask().getApplication() != null)
            strUserID = ((BaseApplication)this.getRecord().getRecordOwner().getTask().getApplication()).getUserID();
        try   {
            iUserID = Integer.parseInt(strUserID);
            if (iUserID == 0)
                iUserID = -1;
        } catch (NumberFormatException e) {
            iUserID = -1;
        }
        return iUserID;
    }
215233
def _extract_session_id(ssl_session: nassl._nassl.SSL_SESSION) -> str:
        
        session_string = ((ssl_session.as_text()).split('Session-ID:'))[1]
        session_id = (session_string.split('Session-ID-ctx:'))[0].strip()
        return session_id
1151578
public String getId() {
        Jenkins h = Jenkins.getInstance();

        // in servlet 2.5, we can get the context path
        String contextPath="";
        try {
            Method m = ServletContext.class.getMethod("getContextPath");
            contextPath=" contextPath=\""+m.invoke(h.servletContext)+"\"";
        } catch (Exception e) {
            // maybe running with Servlet 2.4
        }

        return h.hashCode()+contextPath+" at "+ManagementFactory.getRuntimeMXBean().getName();
    }