Validates the user input when creating a new access control entry.<p>

@param name the name of the new user/group
@param arrayPosition the position in the types array

@return true if everything is ok, otherwise false
176441
protected boolean checkNewEntry(String name, int arrayPosition) {

        m_errorMessages.clear();
        boolean inArray = false;
        if (getTypes(false)[arrayPosition] != null) {
            inArray = true;
        }
        if (!inArray) {
            m_errorMessages.add(key(Messages.ERR_PERMISSION_SELECT_TYPE_0));
        }
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(name)) {
            m_errorMessages.add(key(Messages.ERR_MISSING_GROUP_OR_USER_NAME_0));
        }
        if (m_errorMessages.size() > 0) {
            return false;
        }
        return true;
    }
991990
public static BoxUser.Info createAppUser(BoxAPIConnection api, String name) {
        return createAppUser(api, name, new CreateUserParams());
    }
976268
protected boolean isValidCommandName(String name) {
        if (Strings.isNullOrBlank(name) || ignoreCommands.contains(name)) {
            return false;
        }
        for (String prefix : ignoreCommandPrefixes) {
            if (name.startsWith(prefix)) {
                return false;
            }
        }
        return true;
    }
174526
public function hasAttribute($name, $position = 'field')
    {
        if (!isset($this->attributes[$position])) {
            return false;
        }

        return array_key_exists($name, $this->attributes[$position]);
    }
218768
static void validateHeaderName(CharSequence name) {
        if (name == null) {
            throw new NullPointerException("name");
        }
        if (name.length() == 0) {
            throw new IllegalArgumentException(
                    "name cannot be length zero");
        }
        // Since name may only contain ascii characters, for valid names
        // name.length() returns the number of bytes when UTF-8 encoded.
        if (name.length() > SPDY_MAX_NV_LENGTH) {
            throw new IllegalArgumentException(
                    "name exceeds allowable length: " + name);
        }
        for (int i = 0; i < name.length(); i ++) {
            char c = name.charAt(i);
            if (c == 0) {
                throw new IllegalArgumentException(
                        "name contains null character: " + name);
            }
            if (c >= 'A' && c <= 'Z') {
                throw new IllegalArgumentException("name must be all lower case.");
            }
            if (c > 127) {
                throw new IllegalArgumentException(
                        "name contains non-ascii character: " + name);
            }
        }
    }
623604
@Override
    public boolean isConst(String name)
    {
        Slot slot = slotMap.query(name, 0);
        if (slot == null) {
            return false;
        }
        return (slot.getAttributes() & (PERMANENT|READONLY)) ==
                                       (PERMANENT|READONLY);

    }
10444
private void validateName(String name) throws DDFException {
    Boolean isNameExisted;
    try {
      this.getManager().getDDFByName(name);
      isNameExisted = true;
    } catch (DDFException e) {
      isNameExisted = false;
    }
    if(isNameExisted) {
      throw new DDFException(String.format("DDF with name %s already exists", name));
    }

    Pattern p = Pattern.compile("^[a-zA-Z0-9_-]*$");
    Matcher m = p.matcher(name);
    if(!m.find()) {
      throw new DDFException(String.format("Invalid name %s, only allow alphanumeric (uppercase and lowercase a-z, " +
          "numbers 0-9) and dash (\"-\") and underscore (\"_\")", name));
    }
  }
1267758
public function isValid($name, $password, $realm)
    {
        $request_method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
        $u1 = md5(sprintf('%s:%s:%s', $this->username, $realm, $password));
        $u2 = md5(sprintf('%s:%s', $request_method, $this->uri));
        $response = md5(sprintf('%s:%s:%s:%s:%s:%s', $u1, $this->nonce, $this->nc, $this->cnonce, $this->qop, $u2));

        return ($response == $this->response) && ($name == $this->username);
    }
744338
protected void position(int newPosition)
  {
    if (tc.isEntryEnabled()) Tr.entry(tc, "position", new Object[]{this,new Integer(newPosition)});

    newPosition -= _absolutePosition;
    _buffer.position(newPosition);

    if (tc.isEntryEnabled()) Tr.exit(tc, "position");
  }
277583
@Override
    public boolean isValidGroup(String groupSecurityName) throws RegistryException {
        if (groupSecurityName == null) {
            throw new IllegalArgumentException("groupSecurityName is null");
        }
        if (groupSecurityName.isEmpty()) {
            throw new IllegalArgumentException("groupSecurityName is an empty String");
        }
        return false;
    }
1059080
@Restricted(NoExternalUse.class)
    public @Nonnull FormValidation doCheckNewName(@QueryParameter String newName) {
        // TODO: Create an Item.RENAME permission to use here, see JENKINS-18649.
        if (!hasPermission(Item.CONFIGURE)) {
            if (parent instanceof AccessControlled) {
                ((AccessControlled)parent).checkPermission(Item.CREATE);
            }
            checkPermission(Item.DELETE);
        }

        newName = newName == null ? null : newName.trim();
        try {
            Jenkins.checkGoodName(newName);
            assert newName != null; // Would have thrown Failure
            if (newName.equals(name)) {
                return FormValidation.warning(Messages.AbstractItem_NewNameUnchanged());
            }
            Jenkins.get().getProjectNamingStrategy().checkName(newName);
            checkIfNameIsUsed(newName);
            checkRename(newName);
        } catch (Failure e) {
            return FormValidation.error(e.getMessage());
        }
        return FormValidation.ok();
    }
118131
public boolean isCredentialsValid(String username, String password) {
        try {
            String token = getTokenAuthenticationManager().login(StringUtil.toEmptyIfNull(username), StringUtil.toEmptyIfNull(password));
            getTokenAuthenticationManager().logout(token);

            return true;
        } catch (Exception ex) {
            return false;
        }
    }
285808
private static boolean validTemplateTypeName(String name) {
    return !name.isEmpty()
        && CharMatcher.javaLetterOrDigit().or(CharMatcher.is('_')).matchesAllOf(name);
  }
785596
public function validateXDTElements( &$types, $id, $name, $element)
	{
		if ( isset( $element['substitutionGroup'] ) )
		{
			// Dimensional items MUST abstract
			if ( $types->resolveToSubstitutionGroup( $element['substitutionGroup'], array( XBRL_Constants::$xbrldtHypercubeItem ) ) )
			{
				// If $element[substitutionGroup] is not xbrldt:hypercubeItem make sure any missing attributes are available
				$element = $this->getCompleteDescendantElement( $element, $types );

				if ( ! isset( $element['abstract'] ) || ! $element['abstract'] )
				{
					$this->log()->dimension_validation(
						"2.2.1",
						"An element that is in the substitution group of the xbrldt:hypercubeItem element is not abstract.",
						array(
							'name' => $name,
							'schema' => $this->getSchemaLocation(),
							'error' => 'xbrldte:HypercubeElementIsNotAbstractError',
						)
					);
				}
			}
			else if ( $types->resolveToSubstitutionGroup( $element['substitutionGroup'], array( XBRL_Constants::$xbrldtDimensionItem ) ) )
			{
				// If $element[substitutionGroup] is not xbrldt:dimensionItem make sure any missing attributes are available
				$element = $this->getCompleteDescendantElement( $element, $types );

				if ( ! isset( $element['abstract'] ) || ! $element['abstract'] )
				{
					$this->log()->dimension_validation(
						"2.5.1",
						"An element that is in the substitution group of the xbrldt:dimensionalItem element is not abstract.",
						array(
							'name' => $name,
							'schema' => $this->getSchemaLocation(),
							'error' => '',
						)
					);
				}
			}
		}

		// Check the typedDomainRef attribute if one exists
		if ( isset( $element['typedDomainRef'] ) )
		{
			if ( ! $types->resolveToSubstitutionGroup( $element['substitutionGroup'], array( XBRL_Constants::$xbrldtDimensionItem ) ) )
			{
				$this->log()->dimension_validation(
					"2.5.1",
					"An element with a typedDomainRef attribute MUST be in the substitution group xbrldt:dimensionalItem",
					array(
						'name' => $name,
						'schema' => $this->getSchemaLocation(),
						'error' => 'xbrldte:TypedDomainRefError',
					)
				);
			}

			$parts = explode( "#", $element['typedDomainRef'] );
			if ( count( $parts ) != 2 )
			{
				$this->log()->dimension_validation(
					"2.5.2.1.1",
					"The typedDomainRef value is not a valid URI.",
					array(
						'typedDomainRef' => "'{$element['typedDomainRef']}'",
						'schema' => $this->getSchemaLocation(),
						'error' => 'xbrldte:TypedDimensionURIError',
					)
				);
			}
			else
			{
				$taxonomy = $this;

				// If there is a domain in the reference it must be part of the DTS
				if ( ! empty( $parts[0] ) )
				{
					$taxonomy = $this->getTaxonomyForXSD( $parts[0] );

					if ( ! $taxonomy )
					{
						$this->log()->dimension_validation(
							"2.5.2.1.1",
							"The typedDomainRef references a domain that is not part of the DTS",
							array(
								'typedDomainRef' => "'{$element['typedDomainRef']}'",
								'schema' => $this->getSchemaLocation(),
								'error' => 'xbrldte:OutOfDTSSchemaError',
							)
						);
					}
				}

				if ( empty( $parts[1] ) )
				{
					$this->log()->dimension_validation(
						"2.5.2.1.1",
						"The typedDomainRef value does not include a fragment",
						array(
							'typedDomainRef' => "'{$element['typedDomainRef']}'",
							'schema' => $this->getSchemaLocation(),
							'error' => 'xbrldte:TypedDimensionURIError',
						)
					);
				}
				else if ( $taxonomy )
				{
					// Check to see that the fragment is valid
					$typedDomainElement = $taxonomy->getElementById( $parts[1] );

					if ( ! $typedDomainElement )
					{
						// Check to see if this is missing or to a type
						$type = $types->getTypeById( $parts[1], $this->getPrefix() );

						if ( $type )
						{
							$this->log()->dimension_validation(
								"2.5.2.1.1",
								"The typedDomainRef references a type defintition",
								array(
									'typedDomainRef' => "'{$element['typedDomainRef']}'",
									'schema' => $this->getSchemaLocation(),
									'error' => 'xbrldte:TypedDimensionError',
								)
							);
						}
						else
						{
							$this->log()->dimension_validation(
								"2.5.2.1.1",
								"The typedDomainRef references a domain that is not part of the DTS",
								array(
									'typedDomainRef' => "'{$element['typedDomainRef']}'",
									'schema' => $this->getSchemaLocation(),
									'error' => 'xbrldte:OutOfDTSSchemaError',
								)
							);
						}

					} else if ( isset( $typedDomainElement['abstract'] ) && $typedDomainElement['abstract'] )
					{
						$this->log()->dimension_validation(
							"2.5.2.1.1",
							"The typedDomainRef reference is to an abstract element",
							array(
								'typedDomainRef' => "'{$element['typedDomainRef']}'",
								'schema' => $this->getSchemaLocation(),
								'error' => 'xbrldte:TypedDimensionError',
							)
						);
					}
				}

			}
		}

	}
1277179
public function setElement($name, $element, $position = null)
    {
        $name = trim($name);
        if ($name === '') {
            throw new InvalidArgumentException('Empty child name');
        } elseif (is_array($element)) {
            $config = $element;
            $config['parent'] = $this;
            $config['name'] = $name;
            $element = $this->createElement($config);
        } elseif (true === ($element instanceof \marvin255\serviform\interfaces\Field)) {
            $element->setName($name);
            $element->setParent($this);
        } else {
            throw new InvalidArgumentException('Wrong child type for field: ' . $name);
        }
        if ($position === null) {
            $this->elements[$name] = $element;
        } else {
            $elements = [];
            $itemPosition = $position < 0 ? count($this->elements) + $position : $position;
            $i = 0;
            foreach ($this->elements as $iKey => $iElement) {
                if ($i === $itemPosition) {
                    $elements[$name] = $element;
                }
                $elements[$iKey] = $iElement;
                ++$i;
            }
            $this->elements = $elements;
        }

        return $this;
    }
566346
public static boolean isJavaBasicType(@Nullable String name) {
        if (StringUtils.isEmpty(name)) {
            return false;
        }
        return isJavaLangType(name) || BASIC_TYPE_MAP.containsKey(name);
    }
1288809
public static BaseUserInfo doAuthentication(String name,String password){
		BaseUserInfo userInfo = getInstance().decisionProvider.validateUser(name, password);
		
		UserSession session = getCurrentSession(false);
		session.update(userInfo, getInstance().decisionProvider.sessionExpireIn());
		
		if(getInstance().decisionProvider.multiPointEnable()){
			UserSession otherSession = getInstance().sessionManager.getLoginSessionByUserId(userInfo.getId());
			if(otherSession != null && !otherSession.getSessionId().equals(session.getSessionId())){
				getInstance().sessionManager.removeLoginSession(otherSession.getSessionId());
			}
		}
		getInstance().sessionManager.storgeLoginSession(session);
		getInstance().resourceManager.getUserPermissionCodes(userInfo.getId());
		
		return userInfo;
	}