Validate the JP2 Header box.
194480
def _validate_jp2h(self, boxes):
        """"""
        self._check_jp2h_child_boxes(boxes, 'top-level')

        jp2h_lst = [box for box in boxes if box.box_id == 'jp2h']
        jp2h = jp2h_lst[0]

        # 1st jp2 header box cannot be empty.
        if len(jp2h.box) == 0:
            msg = "The JP2 header superbox cannot be empty."
            raise IOError(msg)

        # 1st jp2 header box must be ihdr
        if jp2h.box[0].box_id != 'ihdr':
            msg = ("The first box in the jp2 header box must be the image "
                   "header box.")
            raise IOError(msg)

        # colr must be present in jp2 header box.
        colr_lst = [j for (j, box) in enumerate(jp2h.box)
                    if box.box_id == 'colr']
        if len(colr_lst) == 0:
            msg = "The jp2 header box must contain a color definition box."
            raise IOError(msg)
        colr = jp2h.box[colr_lst[0]]

        self._validate_channel_definition(jp2h, colr)
934654
def validate():
    ''''''
    with current_app.test_request_context():
        schema = json.loads(json.dumps(api.__schema__))
    try:
        schemas.validate(schema)
        success('API specifications are valid')
    except schemas.SchemaValidationError as e:
        exit_with_error('API specifications are not valid', e)
89577
def _validate(self, inst: "InstanceNode", scope: ValidationScope,
                  ctype: ContentType) -> None:
        """"""
        if isinstance(inst, ArrayEntry):
            super()._validate(inst, scope, ctype)
        else:
            if scope.value & ValidationScope.semantics.value:
                self._check_list_props(inst)
                self._check_cardinality(inst)
            for e in inst:
                super()._validate(e, scope, ctype)
829741
def _validate(self):
        
        # A JP2 file must contain certain boxes.  The 2nd box must be a file
        # type box.
        if not isinstance(self.box[1], FileTypeBox):
            msg = "{filename} does not contain a valid File Type box."
            msg = msg.format(filename=self.filename)
            raise IOError(msg)

        # A jp2-branded file cannot contain an "any ICC profile
        ftyp = self.box[1]
        if ftyp.brand == 'jp2 ':
            jp2h = [box for box in self.box if box.box_id == 'jp2h'][0]
            colrs = [box for box in jp2h.box if box.box_id == 'colr']
            for colr in colrs:
                if colr.method not in (core.ENUMERATED_COLORSPACE,
                                       core.RESTRICTED_ICC_PROFILE):
                    msg = ("Color Specification box method must specify "
                           "either an enumerated colorspace or a restricted "
                           "ICC profile if the file type box brand is 'jp2 '.")
                    warnings.warn(msg, UserWarning)
437106
@Override
    public T validate(T wert) {
        if (!isValid(wert)) {
            throw new InvalidLengthException(Objects.toString(wert), min, max);
        }
        return wert;
    }
902034
def validate_headers!(response)
      return unless headers
      headers.each do |name, value|
        if name.is_a? Symbol
          raise Exceptions::Validation.new(
            "Symbols are not supported in headers"
          )
        end

        unless response.headers.has_key?(name)
          raise Exceptions::Validation.new(
            "Header #{name.inspect} was required but is missing"
          )
        end

        case value
        when String
          if response.headers[name] != value
            raise Exceptions::Validation.new(
              "Header #{name.inspect}, with value #{value.inspect} does not match #{response.headers[name]}."
            )
          end
        when Regexp
          if response.headers[name] !~ value
            raise Exceptions::Validation.new(
              "Header #{name.inspect}, with value #{value.inspect} does not match #{response.headers[name].inspect}."
            )
          end
        end
      end
    end
682327
def validate(self):
        
        if self.required and len(self.selected()) == 0:
            raise ReliureError("No component selected for block '%s'" % self.name)
1034642
public void validate() {
    Validator validator = this.schema.newValidator();
    InputStream in = null;
    try {
      if(this.xmlFile != null) {
        in = this.xmlFile.openStream();
      } else {
        // TODO: check if we need to specify the encoding
        in = new ByteArrayInputStream(this.serializedRule.getBytes()) ;
      }
      validator.validate(new StreamSource(in));
    } catch (SAXException e) {
      throw new RulesException("Rules file does not conform to the schema", e);
    } catch (IOException e) {
      if(this.xmlFile != null) {
        throw new RulesException("Could not read file " + this.xmlFile, e);
      } else {
        throw new RulesException("Could not read serialized rule " + this.serializedRule, e);
      }
        
    } finally {
      Closeables.closeQuietly(in);
    }
  }
869475
def _validate_signature_compatibility(self, boxes):
        """"""
        # Check for a bad sequence of boxes.
        # 1st two boxes must be 'jP  ' and 'ftyp'
        if boxes[0].box_id != 'jP  ' or boxes[1].box_id != 'ftyp':
            msg = ("The first box must be the signature box and the second "
                   "must be the file type box.")
            raise IOError(msg)

        # The compatibility list must contain at a minimum 'jp2 '.
        if 'jp2 ' not in boxes[1].compatibility_list:
            msg = "The ftyp box must contain 'jp2 ' in the compatibility list."
            raise IOError(msg)
256707
void validate() throws ApplicationUnavailableException,
			AuthenticationException {
		V1ConnectionValidator validator = new V1ConnectionValidator(
				applicationPath, username, password, proxySettings);

		for (String key : customHttpHeaders.keySet()) {
			validator.getCustomHttpHeaders().put(key,
					customHttpHeaders.get(key));
		}

		try {
			validator.checkConnection();
		} catch (ConnectionException e) {
			throw new ApplicationUnavailableException(
					"Unable to connect to VersionOne.", e);
		}

		try {
			validator.checkAuthentication();
		} catch (ConnectionException e) {
			throw new AuthenticationException("Invalid username or password.",
					e);
		}
	}
137762
def validate(self, r):
        '''
        
        '''
        if self.show_invalid:
            r.valid = True
        elif r.valid:
            if not r.description:
                r.valid = False

            if r.size and (r.size + r.offset) > r.file.size:
                r.valid = False

            if r.jump and (r.jump + r.offset) > r.file.size:
                r.valid = False

            if hasattr(r, "location") and (r.location != r.offset):
                r.valid = False

        if r.valid:
            # Don't keep displaying signatures that repeat a bunch of times
            # (e.g., JFFS2 nodes)
            if r.id == self.one_of_many:
                r.display = False
            elif r.many:
                self.one_of_many = r.id
            else:
                self.one_of_many = None
806333
void validate(TableKelp table)
  {
    if (! table.isValidate()) {
      return;
    }
    
    Row row = table.row();
    
    for (BlockLeaf block : _blocks) {
      block.validateBlock(row);
    }
  }
652319
def _validate(self, key, cls=None):
        """"""
        if key not in self.manifest:
            raise ValueError("Manifest %s requires '%s'."
                             % (self.manifest_path, key))
        if cls:
            if not isinstance(self.manifest[key], cls):
                raise TypeError("Manifest value '%s' should be %s, not %s"
                                % (key, cls, type(self.manifest[key])))
450616
protected void validateHeader(final String[] sourceHeader, final String[] definedHeader) {
        
        // check column size.
        if(sourceHeader.length != definedHeader.length) {
            final CsvContext context = new CsvContext(1, 1, 1);
            throw new SuperCsvNoMatchColumnSizeException(sourceHeader.length, definedHeader.length, context);
            
        }
        
        // check header value
        for(int i=0; i < sourceHeader.length; i++) {
            if(!sourceHeader[i].equals(definedHeader[i])) {
                final CsvContext context = new CsvContext(1, 1, i+1);
                throw new SuperCsvNoMatchHeaderException(sourceHeader, definedHeader, context);
            }
        }
        
    }
299444
def validate(self, protocol_version):
        """"""
        const = get_const(protocol_version)
        valid_node_ids = vol.All(vol.Coerce(int), vol.Range(
            min=0, max=BROADCAST_ID, msg='Not valid node_id: {}'.format(
                self.node_id)))
        valid_child_ids = vol.All(vol.Coerce(int), vol.Range(
            min=0, max=SYSTEM_CHILD_ID, msg='Not valid child_id: {}'.format(
                self.child_id)))
        if self.type in (const.MessageType.internal, const.MessageType.stream):
            valid_child_ids = vol.All(vol.Coerce(int), vol.In(
                [SYSTEM_CHILD_ID],
                msg='When message type is {}, child_id must be {}'.format(
                    self.type, SYSTEM_CHILD_ID)))
        if (self.type == const.MessageType.internal and
                self.sub_type in [
                    const.Internal.I_ID_REQUEST,
                    const.Internal.I_ID_RESPONSE]):
            valid_child_ids = vol.Coerce(int)
        valid_types = vol.All(vol.Coerce(int), vol.In(
            [member.value for member in const.VALID_MESSAGE_TYPES],
            msg='Not valid message type: {}'.format(self.type)))
        if self.child_id == SYSTEM_CHILD_ID:
            valid_types = vol.All(vol.Coerce(int), vol.In(
                [const.MessageType.presentation.value,
                 const.MessageType.internal.value,
                 const.MessageType.stream.value],
                msg=(
                    'When child_id is {}, {} is not a valid '
                    'message type'.format(SYSTEM_CHILD_ID, self.type))))
        valid_ack = vol.In([0, 1], msg='Not valid ack flag: {}'.format(
            self.ack))
        valid_sub_types = vol.In(
            [member.value for member
             in const.VALID_MESSAGE_TYPES.get(self.type, [])],
            msg='Not valid message sub-type: {}'.format(self.sub_type))
        valid_payload = const.VALID_PAYLOADS.get(
            self.type, {}).get(self.sub_type, '')
        schema = vol.Schema({
            'node_id': valid_node_ids, 'child_id': valid_child_ids,
            'type': valid_types, 'ack': valid_ack, 'sub_type': valid_sub_types,
            'payload': valid_payload})
        to_validate = {attr: getattr(self, attr) for attr in schema.schema}
        return schema(to_validate)
594909
void validateBlock(Row row)
  {
    if (! row.getDatabase().isValidate()) {
      return;
    }
    
    int rowHead = _rowHead;
    int blobTail = _blobTail;
        
    if (rowHead < blobTail) {
      throw new IllegalStateException(this 
                                      + " rowHead:" + rowHead
                                      + " blobTail:" + blobTail); 
    }
    
    int rowOffset = _rowHead;
    
    byte []buffer = _buffer;

    while (rowOffset < BLOCK_SIZE) {
      int code = buffer[rowOffset] & CODE_MASK;
      
      switch (code) {
      case INSERT:
        row.validate(buffer, rowOffset, rowHead, blobTail);
        break;
        
      case INSERT_DEAD:
      case REMOVE:
        break;
        
      default:
        throw new IllegalStateException(this + " " + rowOffset + " " + code + " unknown code");
      }
      
      int len = getLength(code, row);
      
      if (len < 0 || len + rowOffset > BLOCK_SIZE) {
        throw new IllegalStateException(this + " " + rowOffset + " code:" + code + " len:" + len + " invalid len");
      }
      
      rowOffset += len;
    }  
  }
151741
def validate(self):
		''''''
		for header in self._requiredHeaders:
			if not self.headers.get(header, False):
				raise errors.ParseError('Missing Registration Header: ' + header)
		for notice in self.notifications:
			for header in self._requiredNotificationHeaders:
				if not notice.get(header, False):
					raise errors.ParseError('Missing Notification Header: ' + header)