Validates Zookeeper-related configuration and prints warnings for possible sources of error.

@throws IllegalStateException if invalid Zookeeper configuration is encountered
357584
private void checkZkConfiguration() {
    Preconditions.checkState(
        isSet(PropertyKey.ZOOKEEPER_ADDRESS) == getBoolean(PropertyKey.ZOOKEEPER_ENABLED),
        PreconditionMessage.INCONSISTENT_ZK_CONFIGURATION.toString(),
        PropertyKey.Name.ZOOKEEPER_ADDRESS, PropertyKey.Name.ZOOKEEPER_ENABLED);
  }
864155
function ZoologistConfig() {
  this.initialised = false;
  this.client = null;
  this.serviceInstance = null;
  this.serviceDiscovery = null;
  this.serviceDependencies = null;
}
1347669
protected void initZnode() {
    try {
      ZooKeeperUtil.createAndFailSilent(this, baseZnode);
      ZooKeeperUtil.createAndFailSilent(this, backupServersZnode);
    } catch (Exception e) {
      LOG.fatal("Error to create znode " + baseZnode + " and " + backupServersZnode
          + ", exit immediately", e);
      System.exit(0);
    }
  }
654024
public function beforeCompile(): void
	{
		$config = $this->validateConfig($this->defaults);
		$builder = $this->getContainerBuilder();

		$templateFactory = $builder->getByType(ILatteFactory::class);
		if ($templateFactory === null) {
			throw new InvalidStateException(sprintf('Service which implements %s not found.', ILatteFactory::class));
		}

		$builder->getDefinition($templateFactory)
			->addSetup('addFilter', [$config['helper'], [new Statement(ParsedownFilter::class), 'apply']]);
	}
893627
private void validate() {

        if (host.isEmpty()) {
            throw new IllegalArgumentException("host cannot be null");
        }
        if (catalog == null) {
            throw new IllegalArgumentException("database cannot be null");
        }
        if (table == null) {
            throw new IllegalArgumentException("collection cannot be null");
        }

        concantHostPort();
    }
634847
private void initRegisteredBindings() {
        
        Enumeration<URL> bindingsConfiguration;
        try {
            bindingsConfiguration = ClassLoaderUtils.getClassLoader().getResources("META-INF/bindings.xml");
        } catch (IOException e) {
            throw new IllegalStateException("Error registering bindings: " + e.getMessage(), e);
        }

        registerConfigurations(bindingsConfiguration);
    }
130846
@Override
    public Configuration<?> configure() throws IOException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "configure");
        }

        Configuration<?> configuration = null;
        Class<? extends ValidationProvider<?>> clazz = this.getDefaultProviderClass();
        if (clazz == null) {
            // get configuration object from default provider.
            configuration = Validation.byDefaultProvider().configure();

        } else {
            @SuppressWarnings("unchecked")
            ProviderSpecificBootstrap<?> providerBootstrap = Validation.byProvider((Class) clazz);
            configuration = providerBootstrap.configure();
        }

        setMessageInterpolator(configuration);
        setTraversableResolver(configuration);
        setConstraintValidatorFactory(configuration);
        setConstraintMappings(configuration);
        setProperties(configuration);

        // Indicate to the provider configuration that xml should be ignored. We do this
        // because we need to find the correct xml's for each module, as the provider doesn't
        // guarantee this in an EE environment.
        configuration.ignoreXmlConfiguration();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "configure", configuration);
        }

        return configuration;
    }
32737
protected function verifyConfiguration()
    {
        if (isset($this->options->filtered['configuration']) && !file_exists($this->options->filtered['configuration']->getPath())) {
            $this->printer->println(sprintf('Could not read "%s".', $this->options->filtered['configuration']));
            exit(1);
        }
    }
826867
@Override
	public void validate() throws HostNameException {
		if(parsedHost != null) {
			return;
		}
		if(validationException != null) {
			throw validationException;
		}
		synchronized(this) {
			if(parsedHost != null) {
				return;
			}
			if(validationException != null) {
				throw validationException;
			}
			try {
				parsedHost = getValidator().validateHost(this);
			} catch(HostNameException e) {
				validationException = e;
				throw e;
			}
		}
	}
430741
public static String getZooKeeperEnsemble(Configuration flinkConf)
			throws IllegalConfigurationException {

		String zkQuorum = flinkConf.getValue(HighAvailabilityOptions.HA_ZOOKEEPER_QUORUM);

		if (zkQuorum == null || StringUtils.isBlank(zkQuorum)) {
			throw new IllegalConfigurationException("No ZooKeeper quorum specified in config.");
		}

		// Remove all whitespace
		zkQuorum = zkQuorum.replaceAll("\\s+", "");

		return zkQuorum;
	}
831743
boolean validateSettings() throws IllegalArgumentException {
        // Validate values which do not require user input first to avoid unnecesary
        // work on the user part.

        // dates
        if (startDate != null && stopDate != null) {
            if (startDate.after(stopDate)) {
                // stop date is before the start date.
                throw new IllegalArgumentException(getLocalizedString("CWTRA0026E"));
            }
        }

        // Validate levels if specified.
        if (maxLevel != null && minLevel != null) {
            // We have both a max and min level. Check that the min level is
            // equal to or less than the max level
            if (minLevel.intValue() > maxLevel.intValue()) {
                // Min is greater than Max level. Report error
                throw new IllegalArgumentException(getLocalizedString("CWTRA0027E"));
            }
        }

        // Required options
        if (binaryRepositoryDir == null) {
            File[] servers = listRepositoryChoices();
            File repositoryDirFile = null;
            if (servers.length > 1) {
                System.out.println(getLocalizedString("LVM_SelectServerPrompt"));
                int i = 0;
                for (File s : servers) {
                    i++;
                    System.out.println(i + ") " + getLogDirName(s));
                }
                String serverNum = null;
                int serverNumInt = 0;
                BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
                while (repositoryDirFile == null) {
                    System.out.print("[1-" + i + "]: ");
                    try {
                        serverNum = input.readLine();
                        serverNumInt = Integer.parseInt(serverNum);
                        if ((serverNumInt >= 1) && (serverNumInt <= i)) {
                            repositoryDirFile = servers[serverNumInt - 1];
                        }
                    } catch (NumberFormatException e) {
                        // Line does not contain a number.
                    } catch (IOException e) {
                        // Assume user just want to exit.
                        return true;
                    }
                } // end while loop
            } else if (servers.length == 1) {
                repositoryDirFile = servers[0];
            }

            if (repositoryDirFile != null) {
                // appears we have a repositoryDir
                try {
                    setBinaryRepositoryDir(repositoryDirFile.getCanonicalPath());
                    System.out.println(getLocalizedParmString("CWTRA0030I", new Object[] { binaryRepositoryDir }));
                } catch (IOException e) {
                    // TODO We don't want to print stack traces so what should we be doing here?
                    //e.printStackTrace();
                }
            }

            if (binaryRepositoryDir == null) {
                throw new IllegalArgumentException(getLocalizedString("CWTRA0024E"));
            }
        }

        return false;

    }
1219141
public void readConfiguration(InputStream inputStream) throws TracerFactory.Exception {
    if (this.traceConfigSchema == null)
      System.err.println("CAUTION: Unable to validate the given configuration against a schema.");

    DocumentBuilderFactory builderFactory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
    builderFactory.setNamespaceAware(true);
    builderFactory.setXIncludeAware(false);

    try {
      DocumentBuilder parser = builderFactory.newDocumentBuilder();
      Document tracerConfigDoc = parser.parse(inputStream);

      if (this.traceConfigSchema != null) {
        DOMSource domSource = new DOMSource(tracerConfigDoc);
        Validator traceConfigValidator = this.traceConfigSchema.newValidator();
        TracerFactory.ErrorHandler errorHandler = new TracerFactory.ErrorHandler();
        traceConfigValidator.setErrorHandler(errorHandler);
        traceConfigValidator.validate(domSource);
      }
      
      this.poolWriteLock.lock();
      try {
        NodeList tracerNodes = (NodeList) this.xpath.evaluate("/dns:TraceConfig/dns:Pool/dns:TraceLogger", tracerConfigDoc.getDocumentElement(), XPathConstants.NODESET);
        System.out.println();
        System.out.println("Configured Pool Tracers = " + tracerNodes.getLength());
        for (int i = 0; i < tracerNodes.getLength(); i++) {
          System.out.println();
          System.out.println("(+) " + (i + 1) + ". TraceLogger");
          Element tracerElement = (Element) tracerNodes.item(i);
          if (!tracerElement.hasAttribute("name"))
            throw new TracerFactory.Exception("Missing 'name' attribut.");
          String name = tracerElement.getAttribute("name");
          String className = tracerElement.getAttribute("class");
          System.out.println("name = " + name);
          System.out.println("className = " + className);
          Class<?> tracerClass = Class.forName(className);
          if (!AbstractTracer.class.isAssignableFrom(tracerClass))
            throw new TracerFactory.Exception("Illegal tracer class!");
          AbstractTracer tracer = createTracer((Class<? extends AbstractTracer>) tracerClass, name);
          tracer.readConfiguration(this.xpath, tracerElement);

  //        synchronized (this.mapGuardObj) {
  //          this.tracerPool.put(name, tracer);
  //        }
          this.tracerPool.put(name, tracer);
        }

        NodeList threadNodes = (NodeList) this.xpath.evaluate("/dns:TraceConfig/dns:Map/dns:Threads/dns:Thread", tracerConfigDoc.getDocumentElement(), XPathConstants.NODESET);
        System.out.println();
        System.out.println("Configured Tracermappings = " + threadNodes.getLength());
        for (int i = 0; i < threadNodes.getLength(); i++) {
          System.out.println();
          System.out.println("(+) " + (i + 1) + ". Mapping");
          Element threadElement = (Element) threadNodes.item(i);
          String threadName = threadElement.getAttribute("name");
          String referencedTracerName = (String) this.xpath.evaluate("./dns:TraceLogger/@ref", threadElement, XPathConstants.STRING);
          System.out.println(threadName + " => " + referencedTracerName);
          this.threadName2Element.put(threadName, threadElement);
        }

        Node defaultTracerNode = (Node) this.xpath.evaluate("/dns:TraceConfig/dns:DefaultTracer", tracerConfigDoc.getDocumentElement(), XPathConstants.NODE);
        if (defaultTracerNode != null) {
          String className = ((Element) defaultTracerNode).getAttribute("class");
          Class<?> tracerClass = Class.forName(className);
          if (!NullTracer.class.isAssignableFrom(tracerClass))
            throw new TracerFactory.Exception("Requiring a NullTracer as default tracer!");
          this.defaultTracer = createTracer((Class<? extends NullTracer>) tracerClass);
        }
        else {
          this.defaultTracer = TracerFactory.NULLTRACER;
        }
      }
      finally {
        this.poolWriteLock.unlock();
      }
      
      this.queueWriteLock.lock();
      try {
        Node queueNode = (Node) this.xpath.evaluate("/dns:TraceConfig/dns:Queue", tracerConfigDoc.getDocumentElement(), XPathConstants.NODE);
        if (queueNode != null) {
          this.queueConfig = new Queue(queueNode);
        }
        else {
          this.queueConfig = new Queue();
        }
      }
      finally {
        this.queueWriteLock.unlock();
      }
    }
    catch (IOException | ParserConfigurationException | SAXException | XPathExpressionException | ClassNotFoundException | AbstractTracer.Exception ex) {
      throw new TracerFactory.Exception(ex);
    }
  }
819450
public void afterConfiguration(ErrorHandlingConfig errorHandlingConfig) {
		if (!errorProducerEnabled)
			return;

		this.errorHandlingConfig = errorHandlingConfig;

		//first create default-catchers
		ErrorCatcherConfig[] defaultCatcherConfigs = errorHandlingConfig.getDefaultCatchers();
		if (defaultCatcherConfigs != null && defaultCatcherConfigs.length > 0) {
			defaultCatchers = new CopyOnWriteArrayList<>();
			for (ErrorCatcherConfig c : defaultCatcherConfigs) {
				defaultCatchers.add(ErrorCatcherFactory.createErrorCatcher(c));
			}
		}

		//now create regular catchers
		ErrorCatcherConfig[] catcherConfigs = errorHandlingConfig.getCatchers();
		if (catcherConfigs != null && catcherConfigs.length > 0) {
			catchers = new ConcurrentHashMap<>();
			for (ErrorCatcherConfig c : catcherConfigs) {
				ErrorCatcher catcher = ErrorCatcherFactory.createErrorCatcher(c);
				List<ErrorCatcher> catcherList = catchers.get(c.getExceptionClazz());
				if (catcherList == null) {
					catcherList = new LinkedList<>();
					catchers.put(c.getExceptionClazz(), catcherList);
				}
				catcherList.add(catcher);
			}
		}
	}
1175328
protected void validateConfiguration(String... params)
            throws MojoFailureException {
        if (StringUtils.isNotBlank(argLine)
                && MAVEN_DISALLOWED_PATTERN.matcher(argLine).find()) {
            throw new MojoFailureException(
                    "The argLine doesn't match allowed pattern.");
        }
        if (params != null && params.length > 0) {
            for (String p : params) {
                if (StringUtils.isNotBlank(p)
                        && MAVEN_DISALLOWED_PATTERN.matcher(p).find()) {
                    throw new MojoFailureException("The '" + p
                            + "' value doesn't match allowed pattern.");
                }
            }
        }
    }
1290855
function validateConfig(){

    if(!this.config.type){
        throw new Error(resources.errors.missingType);
    }
    if(this.config.type.toLowerCase() !== 'console'){
        throw new Error(resources.errors.incorrectAdapterType);
    }
    if(!this.config.application){
        throw new Error(resources.errors.missingApplication);
    }
    if(!this.config.machine){
        throw new Error(resources.errors.missingMachine);
    }
}
237058
private void validate() {
        if(driverClass == null) {
            throw new IllegalArgumentException("Driver class must be specified");
        }
        if(catalog == null || catalog.isEmpty()) {
            throw new IllegalArgumentException("Schema name must be specified");
        }
        if(table == null || table.isEmpty()) {
            throw new IllegalArgumentException("Table name must be specified");
        }
        if(connectionUrl == null || connectionUrl.isEmpty()) {
            if((host != null && !host.isEmpty()) && (port > 0)) {
                connectionUrl(getJdbcUrl());
            } else {
                throw new IllegalArgumentException("You must specify at least one of connectionUrl or host and port properties");
            }
        }
        if(partitionKey == null && numPartitions > 1) {
            throw new IllegalArgumentException("You must define a valid partition key for using more than one partition.");
        }
    }
77981
protected void handleInvalidExcludes(List<String> invalidExcludes) {
		StringBuilder message = new StringBuilder();
		for (String exclude : invalidExcludes) {
			message.append("\t- ").append(exclude).append(String.format("%n"));
		}
		throw new IllegalStateException(String
				.format("The following classes could not be excluded because they are"
						+ " not auto-configuration classes:%n%s", message));
	}