public static void validateProperties()

in server/src/main/java/org/apache/hupa/server/utils/ConfigurationProperties.java [117:147]


    public static void validateProperties(Properties properties) {

        List<String> errors = new ArrayList<String>();

        // Test for mandatory and complete properties with default values when
        // missing
        for (ConfigurationProperties confProps : ConfigurationProperties.values()) {
            String propName = confProps.getProperty();
            String propValue = confProps.getPropValue();
            Object value = properties.get(propName);
            if (confProps.isMandatory()) {
                if (value == null) {
                    errors.add("The mandatory Property '"
                            + confProps.getProperty() + "' is not set.");
                }
            } else if (value == null && propValue != null) {
                properties.setProperty(propName, propValue);
            }
        }

        // Test for unknown properties set in configuration
        for (Object key : properties.keySet()) {
            if (ConfigurationProperties.lookup((String) key) == null) {
                errors.add("The Property '" + key
                        + "' is unknown");
            }
        }
        if (!errors.isEmpty()) {
            throw new IllegalArgumentException("Error validating configuration : \n" + properties + "\n" +  errors.toString());
        }
    }