/** * Load a specified properties resource * @param resourceName the resourceName of the properties file * * @return the corresponding Properties object */ public static Properties loadProperties(String resourceName) { LOG.info("Finding properties file '" + resourceName + "'"); return loadProperties(new NonOverrideableProperties(), resourceName); }
/** * Override put, but do not allow existing values to be changed. * * {@inheritDoc} */ @Override public synchronized Object put(Object key, Object value) { Object old = get(key); if ((old != null) && (!old.equals(value))) { throw new IllegalArgumentException("Cannot override non-overrideable property " + key + " = " + old + " with new value " + value); } return super.put(key, value); } }
/** * Load a specified properties resource * @param resourceName the resourceName of the properties file * * @return the corresponding Properties object */ public static Properties loadProperties(String resourceName) { LOG.info("Finding properties file '" + resourceName + "'"); return loadProperties(new NonOverrideableProperties(), resourceName); }
/** * Override put, but do not allow existing values to be changed. * * {@inheritDoc} */ @Override public synchronized Object put(Object key, Object value) { Object old = get(key); if ((old != null) && (!old.equals(value))) { throw new IllegalArgumentException("Cannot override non-overrideable property " + key + " = " + old + " with new value " + value); } return super.put(key, value); } }
/** * Load a specified properties file * @param filename the filename of the properties file * @return the corresponding Properties object */ protected static Properties loadProperties(String filename) { Properties props = new NonOverrideableProperties(); try { ClassLoader loader = Util.class.getClassLoader(); InputStream is = loader.getResourceAsStream(filename); if (is == null) { LOG.error("Could not find file " + filename + " from " + loader); return null; } props.load(is); is.close(); } catch (IOException e) { throw new RuntimeException("Failed to load :" + filename, e); } return props; }
/** * Load a specified properties file * @param filename the filename of the properties file * @return the corresponding Properties object */ protected static Properties loadProperties(String filename) { Properties props = new NonOverrideableProperties(); try { ClassLoader loader = Util.class.getClassLoader(); InputStream is = loader.getResourceAsStream(filename); if (is == null) { LOG.error("Could not find file " + filename + " from " + loader); return null; } props.load(is); is.close(); } catch (IOException e) { throw new RuntimeException("Failed to load :" + filename, e); } return props; }