/** * Given a property file name, load the property file and return an object representing the * property values. * * @param propertyFile The name of the property file to load. * @param def Default property values, or <code>null</code> if there are no defaults. * @return The loaded SortedProperties object. */ public static SortedProperties loadProperties(String propertyFile, Properties def) { SortedProperties properties = new SortedProperties(); if (def != null) { properties = new SortedProperties(def); } File file = null; try { file = findProperties(propertyFile); if (file == null) { logger.warning("Property file " + propertyFile + " does not exist"); } else if (!file.exists()) { logger.warning("Property file " + file.getPath() + " does not exist"); } else { logger.config("Loading properties from " + file.getPath()); properties.load(new FileInputStream(file)); } } catch (Exception e) { logger.severe("Failure while trying to load properties file " + file.getPath(), e); } return properties; }