Gets a new instance of the {@link HighlightErrorConverter} with the
specified options.

@param config The current configuration
@param options The pattern options
@return The new instance
2834
public static HighlightErrorConverter newInstance(Configuration config, String[] options) {
        if (options.length != 1) {
            LOGGER.error("Incorrect number of options on highlightError. Expected 1 received " + options.length);
            return null;
        }
        if (options[0] == null) {
            LOGGER.error("No pattern supplied on highlightError");
            return null;
        }

        PatternParser parser = PatternLayout.createPatternParser(config);
        List<PatternFormatter> formatters = parser.parse(options[0]);
        return new HighlightErrorConverter(formatters);
    }
582031
public static ConfigurationOptionBuilder<Collection<Pattern>> regexListOption() {
		return new ConfigurationOptionBuilder<Collection<Pattern>>(new SetValueConverter<Pattern>(RegexValueConverter.INSTANCE), Collection.class)
				.defaultValue(Collections.<Pattern>emptySet());
	}
1248805
public static Set<String> getErrorCodeWhitelist(Config config) {
    String list = config.getString(HttpConstants.ERROR_CODE_WHITELIST).toLowerCase();
    return new HashSet<>(getStringList(list));
  }
1244335
public static SettingsErrors get(Map<String, String[]> clArgs)
    {
        String[] params = clArgs.remove("-errors");
        if (params == null)
            return new SettingsErrors(new Options());

        GroupedOptions options = GroupedOptions.select(params, new Options());
        if (options == null)
        {
            printHelp();
            System.out.println("Invalid -errors options provided, see output for valid options");
            System.exit(1);
        }
        return new SettingsErrors((Options) options);
    }
53812
public static ConfigurationOptionBuilder<Collection<String>> stringsOption() {
		return new ConfigurationOptionBuilder<Collection<String>>(SetValueConverter.STRINGS_VALUE_CONVERTER, Collection.class)
				.defaultValue(Collections.<String>emptySet());
	}
1150191
public static Collection<GobblinInstancePluginFactory> instantiatePluginsFromSysConfig(Config config)
      throws ClassNotFoundException, InstantiationException, IllegalAccessException {
    String pluginsStr = config.getString(PLUGINS_KEY);
    List<GobblinInstancePluginFactory> plugins = Lists.newArrayList();
    for (String pluginName : Splitter.on(",").split(pluginsStr)) {
      plugins.add(instantiatePluginByAlias(pluginName));
    }
    return plugins;
  }
106530
public static <T> Retryer<T> newInstance(Config config) {
    config = config.withFallback(DEFAULTS);
    RetryType type = RetryType.valueOf(config.getString(RETRY_TYPE).toUpperCase());

    switch (type) {
      case EXPONENTIAL:
        return newExponentialRetryer(config);
      case FIXED:
        return newFixedRetryer(config);
      default:
        throw new IllegalArgumentException(type + " is not supported");
    }
  }
512073
function errorHighlighter(err, options) {
    options = options || {};
    var errColor = colorer(options.errorColor || 'red+bold');

    var hasOffset = !(err.offset === undefined || err.offset === null);
    var hasEnd = !(err.endOffset === undefined || err.endOffset === null);
    var within = false;

    if (!hasOffset) return null;
    if (hasEnd) {
        return decorateRangedError;
    } else {
        return decorateError;
    }

    function decorateRangedError(totalOffset, screenOffset, str) {
        if (totalOffset === err.offset) {
            within = totalOffset !== err.endOffset-1;
            return errColor(stripColor(str));
        } else if (totalOffset === err.endOffset-1) {
            within = false;
            return errColor(stripColor(str));
        } else if (within) {
            return errColor(stripColor(str));
        } else {
            return str;
        }
    }

    function decorateError(totalOffset, screenOffset, str) {
        if (totalOffset === err.offset) {
            return errColor(stripColor(str));
        } else {
            return str;
        }
    }
}
1361791
@FFDCIgnore({ XMLStreamException.class })
    public BaseConfiguration parseDefaultConfiguration(Reader reader, String docLocation) throws ConfigParserException, ConfigValidationException {
        try {
            XMLStreamReader parser = getXMLInputFactory().createXMLStreamReader(reader);
            BaseConfiguration config = new BaseConfiguration();
            if (!parseServerConfiguration(new DepthAwareXMLStreamReader(parser), docLocation, config, MergeBehavior.MERGE)) {
                config = null;
            }
            parser.close();
            return config;
        } catch (XMLStreamException e) {
            throw new ConfigParserException(e);
        }
    }
1056090
public static ConfigurationException createConfigurationException(
			final ErrorKeys errorId, final String message)
	{

		return new ConfigurationException(errorId.toString() + ":\r\n"
				+ message);
	}
809667
public static ImmutableConfig copyOf(Config config) {
        if (config instanceof ImmutableConfig) {
            return (ImmutableConfig) config;
        } else {
            return new ImmutableConfig(config);
        }
    }
1093668
public static TypesafeConfigModule fromConfigWithReflections(Config config, Reflections reflections) {
		return new TypesafeConfigModule(config, new ReflectionsReflector(reflections));
	}
1082876
@SuppressWarnings("UnusedDeclaration")
    public static boolean validOptions(String[][] options, DocErrorReporter errorReporter) {
        return validOptions(options, errorReporter, new StandardAdapter());
    }
1080230
public static ConfigProvider getConfigProvider(String configProviderClassName) {
    ConfigProvider configProvider = null;

    if (configProviderClassName != null && !"".equals(configProviderClassName)) {
      Class userConfigProviderClass = null;
      try {
        userConfigProviderClass = Class.forName(configProviderClassName);
      } catch (Exception e) {
        thisLogger.error("Could not get the config provider class: {}.",
                configProviderClassName, e.getMessage());
      }
      if (userConfigProviderClass != null) {
        try {
          Constructor<ConfigProvider> constructor = userConfigProviderClass.getConstructor();
          configProvider = constructor.newInstance();
        } catch (Exception e) {
          thisLogger.error("Could not create the config provider.", e);
        }
      }
    }
    return configProvider;
  }
821401
@SuppressWarnings("unchecked")
    public TextFormatter<T> getFormatter(final FieldAccessor field, final Configuration config) {

        if(field.hasAnnotation(CsvFormat.class)) {
            CsvFormat formatAnno = field.getAnnotation(CsvFormat.class).get();

            final TextFormatter<T> formatter = (TextFormatter<T>) config.getBeanFactory().create(formatAnno.formatter());
            if(!formatAnno.message().isEmpty()) {
                formatter.setValidationMessage(formatAnno.message());
            }
            return formatter;

        } else {
            return getDefaultFormatter(field, config);

        }
    }
998723
function( config, parent ) {
		var typeErrorMsg, contentItem;

		if( typeof config.type !== 'string' ) {
			throw new lm.errors.ConfigurationError( 'Missing parameter \'type\'', config );
		}

		if( !this._typeToItem[ config.type ] ) {
			typeErrorMsg = 'Unknown type \'' + config.type + '\'. ' +
				'Valid types are ' + lm.utils.objectKeys( this._typeToItem ).join( ',' );

			throw new lm.errors.ConfigurationError( typeErrorMsg );
		}


		/**
		 * We add an additional stack around every component that's not within a stack anyways
		 */
		if( config.type === 'component' && !( parent instanceof lm.items.Stack ) && !!parent ) {
			config = {
				type: 'stack',
				isClosable: config.isClosable,
				width: config.width,
				height: config.height,
				content: [ config ]
			};
		}

		contentItem = new this._typeToItem[ config.type ]( this, config, parent );

		return contentItem;
	}
228289
@Nonnull
    public static UpdateCenter createUpdateCenter(@CheckForNull UpdateCenterConfiguration config) {
        String requiredClassName = SystemProperties.getString(UpdateCenter.class.getName()+".className", null);
        if (requiredClassName == null) {
            // Use the default Update Center
            LOGGER.log(Level.FINE, "Using the default Update Center implementation");
            return createDefaultUpdateCenter(config);
        }
        
        LOGGER.log(Level.FINE, "Using the custom update center: {0}", requiredClassName);
        try {
            final Class<?> clazz = Class.forName(requiredClassName).asSubclass(UpdateCenter.class);
            if (!UpdateCenter.class.isAssignableFrom(clazz)) {
                LOGGER.log(Level.SEVERE, "The specified custom Update Center {0} is not an instance of {1}. Falling back to default.",
                        new Object[] {requiredClassName, UpdateCenter.class.getName()});
                return createDefaultUpdateCenter(config);
            }
            final Class<? extends UpdateCenter> ucClazz = clazz.asSubclass(UpdateCenter.class);
            final Constructor<? extends UpdateCenter> defaultConstructor = ucClazz.getConstructor();
            final Constructor<? extends UpdateCenter> configConstructor = ucClazz.getConstructor(UpdateCenterConfiguration.class);
            LOGGER.log(Level.FINE, "Using the constructor {0} Update Center configuration for {1}",
                    new Object[] {config != null ? "with" : "without", requiredClassName});
            return config != null ? configConstructor.newInstance(config) : defaultConstructor.newInstance();
        } catch(ClassCastException e) {
            // Should never happen
            LOGGER.log(WARNING, "UpdateCenter class {0} does not extend hudson.model.UpdateCenter. Using default.", requiredClassName);
        } catch(NoSuchMethodException e) {
            LOGGER.log(WARNING, String.format("UpdateCenter class %s does not define one of the required constructors. Using default", requiredClassName), e);
        } catch(Exception e) {
            LOGGER.log(WARNING, String.format("Unable to instantiate custom plugin manager [%s]. Using default.", requiredClassName), e);
        }
        return createDefaultUpdateCenter(config);
    }