Init method validates configuration defined using
188338
protected void init() {
        if (storage.size() != vocabCache.numWords())
            throw new RuntimeException("Number of words in Vocab isn't matching number of stored Vectors. vocab: ["
                            + vocabCache.numWords() + "]; storage: [" + storage.size() + "]");

        // initializing device cache
        for (int i = 0; i < Nd4j.getAffinityManager().getNumberOfDevices(); i++) {
            cacheWrtDevice.add(new ConcurrentHashMap<Integer, INDArray>());
        }
    }
1042726
function init(){

    // set NODE_ENV to --env value
    if (argv.env) {
        set('NODE_ENV', argv.env);
    }

    // load evironment files
    ['./.env', './config/.env', './env', './config/env'].map(file => {

        try {

            load(file);

        } catch(err) {

            if (env('DEBUG')) {
                console.error(`Env: ${err.message}`);
            }

        }

    });

    // set default vars
    set('NODE_ENV', 'development');

    ['DEVELOPMENT', 'PRODUCTION'].map(str => {
        set(str, get('NODE_ENV') === str.toLowerCase());
    });

}
980238
static void validateConfigurations(Configuration conf) throws ValidationException {
        if (null == conf.getHandlers()) {
            Log.error(
                    "Handler should not be null, One or more handler implementation shuld be configured in the configuration",
                    ErrorGuide.getGuide(ErrorGuide.EMPTY_HANDLERS));
            throw new ValidationException("Configuration error", ValidationException.VALIDATION_LEVEL_INVALID);
        }
        if (null == conf.getLayout()) {
            Log.error("Layout should not be null, A layout implementation shuld be configured in the configuration",
                    ErrorGuide.getGuide(ErrorGuide.EMPTY_LAYOUT));
            throw new ValidationException("Configuration error", ValidationException.VALIDATION_LEVEL_INVALID);
        }

    }
1363826
private function _initialize()
    {
        $params = $this->getParameters();
        if ($params) {
            foreach ($params as $param) {
                if ($param->getType() == "config") {
                    $this->configParameters[] = $param;
                } else {
                    if ($param->getName() == "encoding") {
                        $this->setEncoding($param->getValue());
                    }
                }
            }
        }
    }
354018
public function init()
    {
        // if set use CKEditor configurations from settings module else use default configuration.
        $json = \Yii::$app->settings->get('ckeditor.config', 'widgets');
        $ckeditorConfiguration = isset($json->scalar) ? $json->scalar : "{}";
        $script = "window.CKCONFIG = {$ckeditorConfiguration};";
        \Yii::$app->view->registerJs($script, \yii\web\View::POS_HEAD);


        if ($this->name === null && !$this->hasModel() && $this->selector === null) {
            throw new InvalidConfigException("Either 'name', or 'model' and 'attribute' properties must be specified.");
        }

        if (null === $this->schema) {
            throw new InvalidConfigException("You must specify 'schema' property.");
        }

        if ($this->hasModel() && !isset($this->options['id'])) {
            $this->options['id'] = Html::getInputId($this->model, $this->attribute);
        }

        if ($this->hasModel()) {
            $this->name  = empty($this->options['name']) ? Html::getInputName($this->model, $this->attribute) : $this->options['name'];
            $this->value = Html::getAttributeValue($this->model, $this->attribute);
        }

        if (!isset($this->containerOptions['id'])) {
            $this->containerOptions['id'] = ($this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId()) . '-container';
        }

        if ($this->inputId === null) {
            $this->inputId = $this->options['id'];
        } else {
            $this->_renderInput = false;
        }

        parent::init();
        JsonEditorAsset::register($this->getView());
        JsonEditorPluginsAsset::register($this->getView());
    }
594134
public synchronized static void initConfig(Map<ConfigProperty, String> initialValues) {
        SeLionLogger.getLogger().entering(initialValues);

        // only do this if the global config is not already initialized.
        if (xmlConfig == null) {
            xmlConfig = new XMLConfiguration();
            // don't auto throw, let each config value decide
            xmlConfig.setThrowExceptionOnMissing(false);
            // because we can config on the fly, don't auto-save
            xmlConfig.setAutoSave(false);

            // Set defaults
            loadInitialValues();
        }

        /*
         * otherwise, update the global config
         */

        // Load in our supplied values (if defined)
        loadValuesFromUser(initialValues);

        // Load in environment & system variables (if defined)
        loadValuesFromEnvironment();

        // Init Selenium configuration
        boolean runLocally = xmlConfig.getBoolean(ConfigProperty.SELENIUM_RUN_LOCALLY.getName());
        if (runLocally) {
            xmlConfig.setProperty(ConfigProperty.SELENIUM_HOST.getName(), "localhost");
        }

        SeLionLogger.getLogger().exiting();
    }
1088825
function checkConfig(config) {
  let requiredProps = ['algorithm', 'format'];
  const errMsg = `Configuration isn't an object with the required properties: ${requiredProps.join(', ')}`;

  if ((!config) || (typeof config !== 'object')) {
    throw new Error(errMsg);
  }

  requiredProps.forEach(p => {
    if (!config[p]) {
      throw new Error(errMsg);
    }
  });
}
724195
public static void main(String[] args) {
    LOG.info("Validating configuration.");
    try {
      new InstancedConfiguration(ConfigurationUtils.defaults()).validate();
      LOG.info("Configuration is valid.");
    } catch (IllegalStateException e) {
      LOG.error("Configuration is invalid: {}", e.getMessage());
      System.exit(-1);
    }
    System.exit(0);
  }
244549
static function Configlist_init()
    {
        self::$current = 0;
        self::$currentend = &self::$current;
        self::$basis = 0;
        self::$basisend = &self::$basis;
        self::$x4a = array();
    }
745662
@SuppressWarnings("ProhibitedExceptionDeclared")
    @PostConstruct
    public void init() throws Exception {
        final String configFileLocation = getConfigFileLocation();
        T fileConfig = getEmptyConfig();

        boolean fileExists = false;

        log.info("Using {} as config file location", configFileLocation);

        try (Reader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFileLocation), "UTF-8"))) {
            fileConfig = mapper.readValue(reader, getConfigClass());

            if (fileConfig instanceof PasswordsConfig<?>) {
                fileConfig = ((PasswordsConfig<T>) fileConfig).withDecryptedPasswords(textEncryptor);
            }

            fileExists = true;
        } catch (final FileNotFoundException e) {
            log.warn("Config file not found, using empty configuration object");
        } catch (final IOException e) {
            log.error("Error reading config file at {}", configFileLocation);
            log.error("Recording stack trace", e);
            // throw this so we don't continue to start the webapp
            throw new IllegalStateException("Could not initialize configuration", e);
        }

        if (StringUtils.isNotBlank(defaultConfigFile)) {
            try (InputStream defaultConfigInputStream = getClass().getResourceAsStream(defaultConfigFile)) {
                if (defaultConfigInputStream != null) {
                    final T defaultConfig = mapper.readValue(defaultConfigInputStream, getConfigClass());

                    fileConfig = fileConfig.merge(defaultConfig);

                    if (!fileExists) {
                        fileConfig = generateDefaultLogin(fileConfig);

                        try {
                            writeOutConfigFile(fileConfig, configFileLocation);
                        } catch (final IOException e) {
                            throw new IllegalStateException("Could not initialize configuration", e);
                        }
                    }
                }
            } catch (final IOException e) {
                log.error("Error reading default config file", e);
                // throw this so we don't continue to start the webapp
                throw new IllegalStateException("Could not initialize configuration", e);
            }
        }

        try {
            fileConfig.basicValidate("Root");
        } catch (final ConfigException e) {
            log.error("Config validation failed in " + e);
            throw new IllegalStateException("Could not initialize configuration", e);
        }

        config.set(fileConfig);
        postInitialise(getConfig());
    }
1133847
function init(opt_config) {
  var config = objects.clone(defaultConfig);
  if (opt_config) {
    objects.merge(config, opt_config);
  }
  initVariations(config);
}
797801
def init_config(cls):
        
        try:
            # first load current conf and only overwrite needed params
            # we don't want to reset everything
            config_file = os.path.expanduser(cls.home_config)
            config = cls.load(config_file, 'global')
            cls._del('global', 'api.env')

            hidden_apikey = '%s...' % cls.get('api.key', '')[:6]
            apikey = click.prompt('Api key (xmlrpc)',
                                  default=hidden_apikey)
            if apikey == hidden_apikey:
                # if default value then use actual value not hidden one
                apikey = cls.get('api.key')
            env_choice = click.Choice(list(cls.apienvs.keys()))
            apienv = click.prompt('Environnment [production]/ote',
                                  default=cls.default_apienv,
                                  type=env_choice,
                                  show_default=False)
            sshkey = click.prompt('SSH keyfile',
                                  default='~/.ssh/id_rsa.pub')
            hidden_apikeyrest = '%s...' % cls.get('apirest.key', '')[:6]
            apikeyrest = click.prompt('Api key (REST)',
                                      default=hidden_apikeyrest)
            if apikeyrest == hidden_apikeyrest:
                # if default value then use actual value not hidden one
                apikeyrest = cls.get('apirest.key')

            config.update({
                'api': {'key': apikey,
                        'host': cls.apienvs[apienv]},
            })
            if apikeyrest:
                config.update({
                    'apirest': {'key': apikeyrest},
                })

            if sshkey is not None:
                sshkey_file = os.path.expanduser(sshkey)
                if os.path.exists(sshkey_file):
                    config['sshkey'] = [sshkey_file]

            directory = os.path.expanduser(os.path.dirname(config_file))
            if not os.path.exists(directory):
                mkpath(directory, 0o700)

            # save to disk
            cls.save(config_file, config)
            # load in memory
            cls.load(config_file, 'global')
        except (KeyboardInterrupt, click.exceptions.Abort):
            cls.echo('Aborted.')
            sys.exit(1)
1119519
def init_config(self, app):
        """"""
        app.config.setdefault(
            'LOGGING_FS_LEVEL',
            'DEBUG' if app.debug else 'WARNING'
        )
        for k in dir(config):
            if k.startswith('LOGGING_FS'):
                app.config.setdefault(k, getattr(config, k))

        # Support injecting instance path and/or sys.prefix
        if app.config['LOGGING_FS_LOGFILE'] is not None:
            app.config['LOGGING_FS_LOGFILE'] = \
                app.config['LOGGING_FS_LOGFILE'].format(
                    instance_path=app.instance_path,
                    sys_prefix=sys.prefix,
                )
798528
function getInitialConfigWithData(method, [arg1, arg2, arg3]) {
  if (typeof arg1 === 'string') {
    const config = { ...arg3 };
    config.url = arg1;
    config.method = method || config.method || 'POST';
    return config;
  } else {
    return arg2 || arg1;
  }
}
314092
private void checkInitializationMethod(ClassDescriptorDef classDef, String checkLevel) throws ConstraintException
    {
        if (!CHECKLEVEL_STRICT.equals(checkLevel))
        {
            return;
        }
        
        String initMethodName = classDef.getProperty(PropertyHelper.OJB_PROPERTY_INITIALIZATION_METHOD);

        if (initMethodName == null)
        {
            return;
        }

        Class  initClass;
        Method initMethod;

        try
        {
            initClass = InheritanceHelper.getClass(classDef.getName());
        }
        catch (ClassNotFoundException ex)
        {
            throw new ConstraintException("The class "+classDef.getName()+" was not found on the classpath");
        }
        try
        {
            initMethod = initClass.getDeclaredMethod(initMethodName, new Class[0]);
        }
        catch (NoSuchMethodException ex)
        {
            initMethod = null;
        }
        catch (Exception ex)
        {
            throw new ConstraintException("Exception while checking the class "+classDef.getName()+": "+ex.getMessage());
        }
        if (initMethod == null)
        {    
            try
            {
                initMethod = initClass.getMethod(initMethodName, new Class[0]);
            }
            catch (NoSuchMethodException ex)
            {
                throw new ConstraintException("No suitable initialization-method "+initMethodName+" found in class "+classDef.getName());
            }
            catch (Exception ex)
            {
                throw new ConstraintException("Exception while checking the class "+classDef.getName()+": "+ex.getMessage());
            }
        }

        // checking modifiers
        int mods = initMethod.getModifiers();

        if (Modifier.isStatic(mods) || Modifier.isAbstract(mods))
        {
            throw new ConstraintException("The initialization-method "+initMethodName+" in class "+classDef.getName()+" must be a concrete instance method");
        }
    }
590264
def validate_check_configs(cls, config):
        
        if "checks" not in config:
            raise ValueError("No checks defined.")
        if "interval" not in config["checks"]:
            raise ValueError("No check interval defined.")

        for check_name, check_config in six.iteritems(config["checks"]):
            if check_name == "interval":
                continue

            Check.from_config(check_name, check_config)
1153587
private static void validateSetting(ConfigurationSetting setting) {
        Objects.requireNonNull(setting);

        if (setting.key() == null) {
            throw new IllegalArgumentException("Parameter 'key' is required and cannot be null.");
        }
    }