X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FCache.java;h=fcc4f6db56e87c1365b12524291e20182fba2b94;hb=a545931fdd1c15ffcdca045a7c054310ee998eb6;hp=dc5084347e9bc01cab00b33cf6a8a44479085053;hpb=3d0101179759ef157b088ea135423cd909512d9f;p=jalview.git diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index dc50843..fcc4f6d 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -178,7 +178,7 @@ import org.apache.log4j.SimpleLayout; *
  • FIGURE_AUTOIDWIDTH (false) Expand the left hand column of an exported * alignment figure to accommodate even the longest sequence ID or annotation * label.
  • - *
  • FIGURE_FIXEDIDWIDTH Specifies the width to use for the left-hand column + *
  • FIGURE_USERIDWIDTH Specifies the width to use for the left-hand column * when exporting an alignment as a figure (setting FIGURE_AUTOIDWIDTH to true * will override this).
  • *
  • STRUCT_FROM_PDB (false) derive secondary structure annotation from PDB @@ -281,7 +281,7 @@ public class Cache @Override public synchronized Enumeration keys() { - return Collections.enumeration(new TreeSet(super.keySet())); + return Collections.enumeration(new TreeSet<>(super.keySet())); } }; @@ -334,7 +334,10 @@ public class Cache } } - /** 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; @@ -369,6 +372,7 @@ public class Cache { fis = new FileInputStream(propertiesFile); } + applicationProperties.clear(); applicationProperties.load(fis); // remove any old build properties @@ -621,14 +625,14 @@ public class Cache * @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); @@ -640,7 +644,7 @@ public class Cache System.out.println( "Error setting property: " + key + " " + obj + "\n" + ex); } - return obj; + return oldValue; } /**