From: gmungoc Date: Tue, 24 Apr 2018 14:07:25 +0000 (+0100) Subject: JAL-591 use constant for Preferences key X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7b5c84397cf62677cedfa8800022acacc905302c;p=jalview.git JAL-591 use constant for Preferences key --- diff --git a/src/jalview/gui/WsParamSetManager.java b/src/jalview/gui/WsParamSetManager.java index d91775c..ab03d69 100644 --- a/src/jalview/gui/WsParamSetManager.java +++ b/src/jalview/gui/WsParamSetManager.java @@ -47,20 +47,21 @@ import java.util.StringTokenizer; */ public class WsParamSetManager implements ParamManager { - Hashtable paramparsers = new Hashtable(); + private static final String WS_PARAM_FILES = "WS_PARAM_FILES"; + Hashtable paramparsers = new Hashtable<>(); @Override public WsParamSetI[] getParameterSet(String name, String serviceUrl, boolean modifiable, boolean unmodifiable) { - String files = Cache.getProperty("WS_PARAM_FILES"); + String files = Cache.getProperty(WS_PARAM_FILES); if (files == null) { return null; } StringTokenizer st = new StringTokenizer(files, "|"); String pfile = null; - ArrayList params = new ArrayList(); + ArrayList params = new ArrayList<>(); while (st.hasMoreTokens()) { pfile = st.nextToken(); @@ -98,7 +99,8 @@ public class WsParamSetManager implements ParamManager } catch (IOException e) { Cache.log.info("Failed to parse parameter file " + pfile - + " (Check that all JALVIEW_WSPARAMFILES entries are valid!)", + + " (Check that all " + WS_PARAM_FILES + + " entries are valid!)", e); } } @@ -107,7 +109,7 @@ public class WsParamSetManager implements ParamManager private WsParamSetI[] parseParamFile(String filename) throws IOException { - List psets = new ArrayList(); + List psets = new ArrayList<>(); InputStreamReader is = new InputStreamReader( new java.io.FileInputStream(new File(filename)), "UTF-8"); @@ -202,7 +204,7 @@ public class WsParamSetManager implements ParamManager } if (outfile != null) { - String paramFiles = jalview.bin.Cache.getDefault("WS_PARAM_FILES", + String paramFiles = jalview.bin.Cache.getDefault(WS_PARAM_FILES, filename); if (paramFiles.indexOf(filename) == -1) { @@ -212,7 +214,7 @@ public class WsParamSetManager implements ParamManager } paramFiles = paramFiles.concat(filename); } - jalview.bin.Cache.setProperty("WS_PARAM_FILES", paramFiles); + jalview.bin.Cache.setProperty(WS_PARAM_FILES, paramFiles); jalview.schemabinding.version2.WebServiceParameterSet paramxml = new jalview.schemabinding.version2.WebServiceParameterSet(); @@ -266,7 +268,7 @@ public class WsParamSetManager implements ParamManager { return; } - String paramFiles = jalview.bin.Cache.getDefault("WS_PARAM_FILES", ""); + String paramFiles = jalview.bin.Cache.getDefault(WS_PARAM_FILES, ""); if (paramFiles.indexOf(filename) > -1) { String nparamFiles = new String(); @@ -279,7 +281,7 @@ public class WsParamSetManager implements ParamManager nparamFiles = nparamFiles.concat("|").concat(fl); } } - jalview.bin.Cache.setProperty("WS_PARAM_FILES", nparamFiles); + jalview.bin.Cache.setProperty(WS_PARAM_FILES, nparamFiles); } try