Ensure that the internal state of a header if valid, by copying a known
good header to an invalid header. This method is called during the initialization
and validation of a pair of recovery log files.
168911
public void resetHeader(LogFileHandle validFile)
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "resetHeader");
        _logFileHeader.resetHeader(validFile.logFileHeader());
        if (tc.isEntryEnabled())
            Tr.exit(tc, "resetHeader");
    }
695419
def validate(self):
        
        if not self.file.exists():
            raise ValueError("File \"%s\" doesn't exists")

        if not self.search:
            raise ValueError("Search cannot be empty")

        if not self.replace:
            raise ValueError("Replace cannot be empty")

        if self.match not in ('file', 'line'):
            raise ValueError("Match must be one of: file, line")

        try:
            codecs.lookup(self.encoding)
        except LookupError:
            raise ValueError("Unknown encoding: \"%s\"" % self.encoding)
650054
def validate(self, obj):
        
        if not isinstance(obj, self.internal_type):
            raise ValidationError(obj, self.internal_type)
        return True
224961
def __validate(self, target, value, oldvalue, initiator):
        
        if value == oldvalue:
            return value

        if self.allow_null and value is None:
            return value

        if self.check_value(value):
            return value
        else:
            if self.throw_exception:
                if self.message:
                    self.message = self.message.format(
                            field=self.field, new_value=value, old_value=oldvalue, key=initiator.key)
                    raise ValidateError(self.message)
                else:
                    raise ValidateError('Value %s from column %s is not valid' % (value, initiator.key))

            return oldvalue
927098
def flush
      begin
        valid_existing_file?(@file)
        raise ReadOnlyThresholdsFile if @readonly
        hash = current_hash
        file = File.open(@file, 'w+')
        raise ThresholdAtomicLockFailure, 'The @file state/hash changed before we could flush the file' unless stored_hash == hash
        file.write self.sort.to_s
        file.close

      rescue NonExistantThresholdFile
        raise ReadOnlyThresholdsFile if @readonly
        file = File.open(@file, 'w')
        file.write self.sort.to_s
        file.close
      end

      stored_hash=current_hash
      return true
    end
568796
def required_header(header):
    
    if header in IGNORE_HEADERS:
        return False

    if header.startswith('HTTP_') or header == 'CONTENT_TYPE':
        return True

    return False
1202760
def save_state(internal_request, state):
        
        state_data = {"hash_type": internal_request.user_id_hash_type}
        state[UserIdHasher.STATE_KEY] = state_data
878578
private boolean checkHeader(RandomAccessInputStream raf) throws IOException
	{
		raf.seek(HEAD_LOCATION);

		byte[] buf = new byte[HEAD_SIZE];
		if (raf.read(buf) != HEAD_SIZE)
		{
			throw new IOException("Error encountered finding id3v2 header");
		}

		String result = new String(buf, ENC_TYPE);
		if (result.substring(0, TAG_START.length()).equals(TAG_START))
		{
			if ((((int)buf[3]&0xFF) < 0xff) && (((int)buf[4]&0xFF) < 0xff))
			{
				if ((((int)buf[6]&0xFF) < 0x80) && (((int)buf[7]&0xFF) < 0x80) && (((int)buf[8]&0xFF) < 0x80) && (((int)buf[9]&0xFF) < 0x80))
				{
					return true;
				}
			}
		}

		return false;
	}
76732
private void reset() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "reset()", "Clearing the path and removing conditional headers");
        }

        //clear the path
        _path = null;
        _pathURI = null;
        _queryString = null;
        _pathQueryString = null;

        //remove conditional headers
        removeHeader(HDR_IF_MATCH);
        removeHeader(HDR_IF_MODIFIED_SINCE);
        removeHeader(HDR_IF_NONE_MATCH);
        removeHeader(HDR_IF_RANGE);
        removeHeader(HDR_IF_UNMODIFIED_SINCE);
    }
163084
def assign_confirmed_if_valid!
      return unless pending?

      self.state = EffectiveOrders::CONFIRMED
      return true if valid?

      self.errors.clear
      self.state = EffectiveOrders::PENDING
      false
    end
396444
private void prepareInitialState(boolean isNewObject)
    {
        // determine appropriate modification state
        ModificationState initialState;
        if(isNewObject)
        {
            // if object is not already persistent it must be marked as new
            // it must be marked as dirty because it must be stored even if it will not modified during tx
            initialState = StateNewDirty.getInstance();
        }
        else if(isDeleted(oid))
        {
            // if object is already persistent it will be marked as old.
            // it is marked as dirty as it has been deleted during tx and now it is inserted again,
            // possibly with new field values.
            initialState = StateOldDirty.getInstance();
        }
        else
        {
            // if object is already persistent it will be marked as old.
            // it is marked as clean as it has not been modified during tx already
            initialState = StateOldClean.getInstance();
        }
        // remember it:
        modificationState = initialState;
    }
246800
def _set_internal_value(self, new_internal_value):
        

        if new_internal_value != self._internal_value:

            self._internal_value = new_internal_value

            # Call callbacks if any

            for callback in self._callbacks:

                callback(self)
282932
def reset_internal_states(self, record=None):
        
        self._record = None
        self._count = 0
        self._record = record
589077
def should_copy_file(remote_storage, path, prefixed_path, source_storage):
    
    if has_matching_etag(
            remote_storage, source_storage, path, prefixed_path):
        logger.info("%s: Skipping based on matching file hashes" % path)
        return False

    # Invalidate cached versions of lookup before copy
    destroy_etag(path)
    logger.info("%s: Hashes did not match" % path)
    return True
581500
def _validate_output_data(
        self, original_res, serialized_res, formatted_res, request):
        

        validator = self.representation

        # when not to validate...
        if not validator:
            return

        try:
            if isinstance(serialized_res, (list, tuple)):
                map(validator.validate, serialized_res)
            else:
                validator.validate(serialized_res)
        except ValidationError, exc:
            self._output_validation_failed(exc, serialized_res, request)
564692
protected void initCheck() throws IOException {
    // Check storage version
    if (_version != STORAGE_VERSION) {
      throw new IOException("Invalid version in " + _file.getName() + ": "
              + _version + ", " + STORAGE_VERSION + " expected");
    }
    
    // Check array file header
    if(!checkHeader()) {
      throw new IOException("Invalid header in " + _file.getName() + ": " + getHeader());
    }
  }
80175
void initReplicaHome( H2ONode h2o, Key key ) {
    assert key.home();
    assert _key == null; // This is THE initializing key write for serialized Values
    assert h2o != H2O.SELF;     // Do not track self as a replica
    _key = key;
    // Set the replica bit for the one node we know about, and leave the
    // rest clear.
    _replicas.add(h2o._unique_idx);
    _rwlock.set(0);             // No GETs are in-flight at this time.
    //System.out.println(key+", init "+_rwlock.get());
  }