@Override
    protected void finalizeRecord(RecordConfig record) {
        super.finalizeRecord(record);
        
        boolean minSet = record.getMinLength() != null;
        if (stream.isStrict()) {
            if (record.getMinLength() == null) {
                record.setMinLength(record.getMinSize());
            }
            if (record.getMaxLength() == null) {
                record.setMaxLength(record.getMaxSize());
            }
        }
        else {
            if (record.getMinLength() == null) {
                record.setMinLength(0);
            }
            if (record.getMaxLength() == null) {
                record.setMaxLength(Integer.MAX_VALUE);
            }
        }
        // validate maximum record length is not less than the minimum record length
        if (record.getMaxLength() < record.getMinLength()) {
            if (minSet) {
                throw new BeanIOConfigurationException(
                    "Maximum record length cannot be less than minimum record length");                    
            }
            else {
                throw new BeanIOConfigurationException(
                    "Maximum record length must be at least " + record.getMinLength());
            }
        }
        
        // if there is an unbounded component in the middle of the record, we need to
        // set the end position on it
        if (unboundedComponent != null && unboundedComponentFollower != null) {
            setEndPosition(unboundedComponent, unboundedComponentFollower.getPosition());
        }
    }