Validate the instance id.

@param id
the id String
@throws ServiceException
764881
public static void validateServiceInstanceID(String id) throws ServiceException {
        if (!validateRequiredField(id, idRegEx)) {
            throw new ServiceException(
                    ErrorCode.SERVICE_INSTANCE_ID_FORMAT_ERROR);
        }
    }
1319224
public static function validateServiceId($serviceId)
    {
        if (preg_match('/[^A-Za-z\._0-9]/', $serviceId, $matches)) {
            throw new \InvalidArgumentException(sprintf(
                'Service ID "%s" contains invalid character "%s".',
                $serviceId,
                $matches[0]
            ));
        }

        return $serviceId;
    }
396468
public static void setId(Object object, Object id) {
		try {
			Field idField = getIdField(object.getClass());
			if (idField != null) {
				idField.set(object, id);
			}
		} catch (IllegalAccessException | IllegalArgumentException e) {
			throw new LoggingRuntimeException(e, logger, "setting Id failed");
		}
	}
602720
public void setId(java.util.Collection<StringFilter> id) {
        if (id == null) {
            this.id = null;
            return;
        }

        this.id = new java.util.ArrayList<StringFilter>(id);
    }
1318810
public void deleteService(String id, boolean force) {
        try {
            if (id == null || id.isEmpty()) {
                id = selectRunningService();
            }
            final String idFinal = id;
            int input = 'Y';
            if (!force) {
                OutputStreamFormater.printValue(String.format(
                    "Do you really want to delete the connector: %s (Y/n): ", id));
                input = keyboard.read();
            }
            if ('n' != (char) input && 'N' != (char) input) {
                SecurityContext.executeWithSystemPermissions(new Callable<Object>() {
                    @Override
                    public Object call() throws Exception {
                        serviceManager.delete(idFinal);
                        return null;
                    }
                });
                OutputStreamFormater.printValue(String.format("Service: %s successfully deleted", id));
            }
        } catch (ExecutionException e) {
            e.printStackTrace();
            System.err.println("Could not delete service");
        } catch (IOException e) {
            e.printStackTrace();
            System.err.println("Unexpected Error");
        }
    }
719695
@Override
    public void validate() throws OpsGenieClientValidationException {
        super.validate();
        if (username == null && id == null)
            throw OpsGenieClientValidationException.missingMultipleMandatoryProperty(OpsGenieClientConstants.API.USERNAME, OpsGenieClientConstants.API.ID);
    }
954698
public static void validateSpaceId(String spaceID)
        throws InvalidIdException {
        if (spaceID == null ||
            spaceID.trim().length() < 3 ||
            spaceID.trim().length() > 42) {
            String err = "Space ID must be between 3 and 42 characters long";
            throw new InvalidIdException(err);
        }

        if (!spaceID.matches("[a-z0-9.-]*")) {
            String err = "Only lowercase letters, numbers, periods, " +
                         "and dashes may be used in a Space ID";
            throw new InvalidIdException(err);
        }

        if (spaceID.startsWith(".") || spaceID.startsWith("-")) {
            String err = "A Space ID must begin with a lowercase letter.";
            throw new InvalidIdException(err);
        }

        if (spaceID.matches("[0-9]+[a-z0-9.-]*")) {
            String err = "A Space ID must begin with a lowercase letter.";
            throw new InvalidIdException(err);
        }

        // This rule is required to conform with the spec for a URI host name,
        // see RFC 2396.
        if (spaceID.matches("[a-z0-9.-]*[.][0-9]+[a-z0-9-]*")) {
            String err = "The last period in a Space ID may not be " +
                         "immediately followed by a number.";
            throw new InvalidIdException(err);
        }

        if (spaceID.endsWith("-")) {
            String err = "A Space ID must end with a lowercase letter, " +
                         "number, or period";
            throw new InvalidIdException(err);
        }

        if (spaceID.contains("..") ||
            spaceID.contains("-.") ||
            spaceID.contains(".-")) {
            String err = "A Space ID must not contain '..' '-.' or '.-'";
            throw new InvalidIdException(err);
        }

        if (spaceID.matches("[0-9]+.[0-9]+.[0-9]+.[0-9]+")) {
            String err = "A Space ID must not be formatted as an IP address";
            throw new InvalidIdException(err);
        }
    }
914021
public static DataSourceBackendId getInstance(String id) {
        DataSourceBackendId result = cache.get(id);
        if (result == null) {
            id = id.intern();
            result = new DataSourceBackendId(id);
            cache.put(id, result);
        }
        return result;
    }
816936
@SuppressWarnings("unchecked")
    public static void validate_ids(StormTopology topology, String topologyId) throws InvalidTopologyException {
        String topologyName = topologyIdToName(topologyId);
        if (!charValidate(topologyName)) {
            throw new InvalidTopologyException(topologyName + " is not a valid topology name. " + nameErrorInfo);
        }

        List<String> list = new ArrayList<>();
        for (StormTopology._Fields field : Thrift.STORM_TOPOLOGY_FIELDS) {
            Object value = topology.getFieldValue(field);
            if (value != null) {
                Map<String, Object> obj_map = (Map<String, Object>) value;
                Set<String> commids = obj_map.keySet();

                for (String id : commids) {
                    if (system_id(id) || !charComponentValidate(id)) {
                        throw new InvalidTopologyException(id + " is not a valid component id. " + compErrorInfo);
                    }
                }

                for (Object obj : obj_map.values()) {
                    validate_component(obj);
                }

                list.addAll(commids);
            }
        }

        List<String> offending = JStormUtils.getRepeat(list);
        if (!offending.isEmpty()) {
            throw new InvalidTopologyException("Duplicate component ids: " + offending);
        }
    }
519806
public void setInstanceId (final String instanceId)
  {
    if (instanceId == null || instanceId.trim ().length () == 0)
    {
      throw new IllegalArgumentException ("Scheduler instanceId cannot be empty.");
    }

    m_sInstanceId = instanceId;
  }
133410
public static void validateAddress(String address) throws ServiceException {
        if (address == null || address.isEmpty()) {
            throw new ServiceException(
                    ErrorCode.SERVICE_INSTANCE_ADDRESS_FORMAT_ERROR);
        }
    }
210961
public static void validateContentId(String contentID)
        throws InvalidIdException {
        if (contentID == null) {
            String err = "Content ID must be at least 1 character long";
            throw new InvalidIdException(err);
        }

        if (contentID.contains("?")) {
            String err = "Content ID may not include the '?' character";
            throw new InvalidIdException(err);
        }

        if (contentID.contains("\\")) {
            String err = "Content ID may not include the '\\' character";
            throw new InvalidIdException(err);
        }

        int utfLength;
        int urlLength;
        try {
            utfLength = contentID.getBytes("UTF-8").length;
            String urlEncoded = URLEncoder.encode(contentID, "UTF-8");
            urlLength = urlEncoded.getBytes("UTF-8").length;
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }

        if (utfLength > 1024 || urlLength > 1024) {
            String err =
                "Content ID must <= 1024 bytes after URL and UTF-8 encoding";
            throw new InvalidIdException(err);
        }
    }
428622
public static void validateServiceName(String name) throws ServiceException {
        if (!validateRequiredField(name, nameRegEx)) {
            throw new ServiceException(
                    ErrorCode.SERVICE_INSTANCE_NAME_FORMAT_ERROR);
        }
    }
909926
public function validateIdentifier($id)
    {
        $printed = print_r($id, true);
        if (count($this->keys) > 1 && !is_array($id)) {
            throw new \RuntimeException("Entity $this->name has a composed key, finding by id requires an array, given: $printed");
        }
        if (count($this->keys) !== count($id)) {
            $keys = print_r($this->keys, true);
            throw new \RuntimeException("Entity $this->name requires the following keys: $keys, given: $printed");
        }
    }
804370
def validate_instance_id(self, instid):
        '''  '''
        # 1-63 alphanumeric characters, first must be a letter.
        if re.match('[\w-]+$', instid) is not None:
            if len(instid) <= 63 and len(instid) >= 1:
                if instid[0].isalpha():
                    return True
        return "*** Error: Instance ids must be 1-63 alphanumeric characters, \
            first is a letter."
1032239
private function validateJsonRpcMethodDefinition(string $serviceId, Definition $definition) : void
    {
        if (!in_array(JsonRpcMethodInterface::class, class_implements($definition->getClass()))) {
            throw new LogicException(sprintf(
                'Service "%s" is taggued as JSON-RPC method but does not implement %s',
                $serviceId,
                JsonRpcMethodInterface::class
            ));
        }
    }
1082446
@Override
    public void validate() throws OpsGenieClientValidationException {
        super.validate();
        if (name == null && id == null)
            throw OpsGenieClientValidationException.missingMultipleMandatoryProperty(OpsGenieClientConstants.API.NAME, OpsGenieClientConstants.API.ID);
    }