Search in sources :

Example 1 with ConfigValidationException

use of org.graylog2.plugin.validate.ConfigValidationException in project graylog2-server by Graylog2.

the class GeoIpResolverConfigValidator method validateConfig.

private void validateConfig(GeoIpResolverConfig config) throws ConfigValidationException {
    Timer timer = new Timer(new UniformReservoir());
    try {
        // A test address.  This will NOT be in any database, but should only produce an
        // AddressNotFoundException.  Any other exception suggests an actual error such as
        // a database file that does does not belong to the vendor selected
        InetAddress testAddress = InetAddress.getByName("127.0.0.1");
        validateGeoIpLocationResolver(config, timer, testAddress);
        validateGeoIpAsnResolver(config, timer, testAddress);
    } catch (UnknownHostException | IllegalArgumentException e) {
        throw new ConfigValidationException(e.getMessage());
    }
}
Also used : Timer(com.codahale.metrics.Timer) UnknownHostException(java.net.UnknownHostException) UniformReservoir(com.codahale.metrics.UniformReservoir) InetAddress(java.net.InetAddress) ConfigValidationException(org.graylog2.plugin.validate.ConfigValidationException)

Aggregations

Timer (com.codahale.metrics.Timer)1 UniformReservoir (com.codahale.metrics.UniformReservoir)1 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1 ConfigValidationException (org.graylog2.plugin.validate.ConfigValidationException)1