public static AbstractConfiguration getConfigFromPropertiesFile(URL startingUrl, Set<String> loaded, String... nextLoadKeys) throws FileNotFoundException { if (loaded.contains(startingUrl.toExternalForm())) { logger.warn(startingUrl + " is already loaded"); return null; } PropertiesConfiguration propConfig = null; try { propConfig = new OverridingPropertiesConfiguration(startingUrl); logger.info("Loaded properties file " + startingUrl); } catch (ConfigurationException e) { Throwable cause = e.getCause(); if (cause instanceof FileNotFoundException) { throw (FileNotFoundException) cause; } else { throw new RuntimeException(e); } } if (nextLoadKeys == null) { return propConfig; } String urlString = startingUrl.toExternalForm(); String base = urlString.substring(0, urlString.lastIndexOf("/")); loaded.add(startingUrl.toString()); loadFromPropertiesFile(propConfig, base, loaded, nextLoadKeys); return propConfig; }
public static AbstractConfiguration getConfigFromPropertiesFile(URL startingUrl, Set<String> loaded, String... nextLoadKeys) throws FileNotFoundException { if (loaded.contains(startingUrl.toExternalForm())) { logger.warn(startingUrl + " is already loaded"); return null; } PropertiesConfiguration propConfig = null; try { propConfig = new OverridingPropertiesConfiguration(startingUrl); logger.info("Loaded properties file " + startingUrl); } catch (ConfigurationException e) { Throwable cause = e.getCause(); if (cause instanceof FileNotFoundException) { throw (FileNotFoundException) cause; } else { throw new RuntimeException(e); } } if (nextLoadKeys == null) { return propConfig; } String urlString = startingUrl.toExternalForm(); String base = urlString.substring(0, urlString.lastIndexOf("/")); loaded.add(startingUrl.toString()); loadFromPropertiesFile(propConfig, base, loaded, nextLoadKeys); return propConfig; }