@Override
public synchronized Enumeration<Object> keys()
{
- return Collections.enumeration(new TreeSet<Object>(super.keySet()));
+ return Collections.enumeration(new TreeSet<>(super.keySet()));
}
};
}
}
- /** Called when Jalview is started */
+ /**
+ * Loads properties from the given properties file. Any existing properties
+ * are first cleared.
+ */
public static void loadProperties(String propsFile)
{
propertiesFile = propsFile;
{
fis = new FileInputStream(propertiesFile);
}
+ applicationProperties.clear();
applicationProperties.load(fis);
// remove any old build properties
* @param obj
* String value of property
*
- * @return String value of property
+ * @return previous value of property (or null)
*/
- public static String setProperty(String key, String obj)
+ public static Object setProperty(String key, String obj)
{
-
+ Object oldValue = null;
try
{
- applicationProperties.setProperty(key, obj);
+ oldValue = applicationProperties.setProperty(key, obj);
if (!propsAreReadOnly)
{
FileOutputStream out = new FileOutputStream(propertiesFile);
System.out.println(
"Error setting property: " + key + " " + obj + "\n" + ex);
}
- return obj;
+ return oldValue;
}
/**