2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import java.awt.Color;
24 import java.io.BufferedReader;
26 import java.io.FileInputStream;
27 import java.io.FileNotFoundException;
28 import java.io.FileOutputStream;
29 import java.io.IOException;
30 import java.io.InputStream;
31 import java.io.InputStreamReader;
32 import java.io.PrintWriter;
33 import java.io.StringWriter;
34 import java.net.Authenticator;
35 import java.net.PasswordAuthentication;
37 import java.text.DateFormat;
38 import java.text.SimpleDateFormat;
39 import java.util.ArrayList;
40 import java.util.Arrays;
41 import java.util.Collection;
42 import java.util.Collections;
43 import java.util.Date;
44 import java.util.Enumeration;
45 import java.util.Locale;
46 import java.util.Properties;
47 import java.util.StringTokenizer;
48 import java.util.TreeSet;
50 import javax.swing.LookAndFeel;
51 import javax.swing.UIManager;
53 import jalview.datamodel.PDBEntry;
54 import jalview.gui.Preferences;
55 import jalview.gui.UserDefinedColours;
56 import jalview.log.JLoggerLog4j;
57 import jalview.schemes.ColourSchemeLoader;
58 import jalview.schemes.ColourSchemes;
59 import jalview.schemes.UserColourScheme;
60 import jalview.structure.StructureImportSettings;
61 import jalview.urls.IdOrgSettings;
62 import jalview.util.ChannelProperties;
63 import jalview.util.ColorUtils;
64 import jalview.util.MessageManager;
65 import jalview.util.Platform;
66 import jalview.ws.sifts.SiftsSettings;
69 * Stores and retrieves Jalview Application Properties Lists and fields within
70 * list entries are separated by '|' symbols unless otherwise stated (|) clauses
71 * are alternative values for a tag. <br>
73 * Current properties include:
76 * logs.Axis.Level - one of the stringified Levels for log4j controlling the
77 * logging level for axis (used for web services) <br>
79 * <li>logs.Castor.Level - one of the stringified Levels for log4j controlling
80 * the logging level for castor (used for serialization) <br>
82 * <li>logs.Jalview.Level - Cache.log stringified level. <br>
84 * <li>SCREEN_WIDTH</li>
85 * <li>SCREEN_HEIGHT</li>
86 * <li>SCREEN_Y=285</li>
87 * <li>SCREEN_X=371</li>
88 * <li>SHOW_FULLSCREEN boolean</li>
89 * <li>FONT_NAME java font name for alignment text display</li>
90 * <li>FONT_SIZE size of displayed alignment text</li>
91 * <li>FONT_STYLE style of font displayed (sequence labels are always
93 * <li>GAP_SYMBOL character to treat as gap symbol (usually -,.,' ')</li>
94 * <li>LAST_DIRECTORY last directory for browsing alignment</li>
95 * <li>USER_DEFINED_COLOURS list of user defined colour scheme files</li>
96 * <li>SHOW_FULL_ID show id with '/start-end' numbers appended</li>
97 * <li>SHOW_IDENTITY show percentage identity annotation</li>
98 * <li>SHOW_QUALITY show alignment quality annotation</li>
99 * <li>SHOW_ANNOTATIONS show alignment annotation rows</li>
100 * <li>SHOW_CONSERVATION show alignment conservation annotation</li>
101 * <li>SORT_ANNOTATIONS currently either SEQUENCE_AND_LABEL or
102 * LABEL_AND_SEQUENCE</li>
103 * <li>SHOW_AUTOCALC_ABOVE true to show autocalculated annotations above
104 * sequence annotations</li>
105 * <li>CENTRE_COLUMN_LABELS centre the labels at each column in a displayed
106 * annotation row</li>
107 * <li>DEFAULT_COLOUR default colour scheme to apply for a new alignment</li>
108 * <li>DEFAULT_FILE_FORMAT file format used to save</li>
109 * <li>STARTUP_FILE file loaded on startup (may be a fully qualified url)</li>
110 * <li>SHOW_STARTUP_FILE flag to control loading of startup file</li>
111 * <li>VERSION the version of the jalview build</li>
112 * <li>BUILD_DATE date of this build</li>
113 * <li>LATEST_VERSION the latest jalview version advertised on the
114 * www.jalview.org</li>
115 * <li>PIR_MODELLER boolean indicating if PIR files are written with MODELLER
117 * <li>(FASTA,MSF,PILEUP,CLUSTAL,BLC,PIR,PFAM)_JVSUFFIX boolean for adding jv
118 * suffix to file</li>
119 * <li>RECENT_URL list of recently retrieved URLs</li>
120 * <li>RECENT_FILE list of recently opened files</li>
121 * <li>USE_PROXY flag for whether a http proxy is to be used</li>
122 * <li>PROXY_SERVER the proxy</li>
123 * <li>PROXY_PORT</li>
124 * <li>NOQUESTIONNAIRES true to prevent jalview from checking the questionnaire
126 * <li>QUESTIONNAIRE last questionnaire:responder id string from questionnaire
128 * <li>USAGESTATS (false - user prompted) Enable google analytics tracker for
129 * collecting usage statistics</li>
130 * <li>SHOW_OVERVIEW boolean for overview window display</li>
131 * <li>ANTI_ALIAS boolean for smooth fonts</li>
132 * <li>RIGHT_ALIGN_IDS boolean</li>
133 * <li>AUTO_CALC_CONSENSUS boolean for automatic recalculation of consensus</li>
134 * <li>PAD_GAPS boolean</li>
135 * <li>ID_ITALICS boolean</li>
136 * <li>SHOW_JV_SUFFIX</li>
137 * <li>WRAP_ALIGNMENT</li>
138 * <li>EPS_RENDERING (Prompt each time|Lineart|Text) default for EPS rendering
140 * <li>SORT_ALIGNMENT (No sort|Id|Pairwise Identity)</li>
141 * <li>SEQUENCE_LINKS list of name|URL pairs for opening a url with
143 * <li>STORED_LINKS list of name|url pairs which user has entered but are not
145 * <li>DEFAULT_LINK name of single url to be used when user double clicks a
146 * sequence id (must be in SEQUENCE_LINKS or STORED_LINKS)
147 * <li>GROUP_LINKS list of name|URL[|<separator>] tuples - see
148 * jalview.utils.GroupURLLink for more info</li>
149 * <li>DEFAULT_BROWSER for unix</li>
150 * <li>SHOW_MEMUSAGE boolean show memory usage and warning indicator on desktop
152 * <li>VERSION_CHECK (true) check for the latest release version from
153 * www.jalview.org (or the alias given by the www.jalview.org property)</li>
154 * <li>SHOW_NPFEATS_TOOLTIP (true) show non-positional features in the Sequence
156 * <li>SHOW_DBREFS_TOOLTIP (true) show Database Cross References in the Sequence
158 * <li>SHOW_UNCONSERVED (false) only render unconserved residues - conserved
159 * displayed as '.'</li>
160 * <li>SORT_BY_TREE (false) sort the current alignment view according to the
161 * order of a newly displayed tree</li>
162 * <li>DBFETCH_USEPICR (false) use PICR to recover valid DB references from
163 * sequence ID strings before attempting retrieval from any datasource</li>
164 * <li>SHOW_GROUP_CONSENSUS (false) Show consensus annotation for groups in the
166 * <li>SHOW_GROUP_CONSERVATION (false) Show conservation annotation for groups
167 * in the alignment.</li>
168 * <li>SHOW_CONSENSUS_HISTOGRAM (false) Show consensus annotation row's
170 * <li>SHOW_CONSENSUS_LOGO (false) Show consensus annotation row's sequence
172 * <li>NORMALISE_CONSENSUS_LOGO (false) Show consensus annotation row's sequence
173 * logo normalised to row height rather than histogram height.</li>
174 * <li>FOLLOW_SELECTIONS (true) Controls whether a new alignment view should
175 * respond to selections made in other alignments containing the same sequences.
177 * <li>SHOW_JWS2_SERVICES (true) when set to false, jalview will not
178 * auto-discover JABAWS services</li>
179 * <li>JWS2HOSTURLS comma-separated list of URLs to try for JABAWS services</li>
180 * <li>SHOW_WSDISCOVERY_ERRORS (true) Controls if the web service URL discovery
181 * warning dialog box is displayed.</li>
182 * <li>ANNOTATIONCOLOUR_MIN (orange) Shade used for minimum value of annotation
183 * when shading by annotation</li>
184 * <li>ANNOTATIONCOLOUR_MAX (red) Shade used for maximum value of annotation
185 * when shading by annotation</li>
186 * <li>www.jalview.org (https://www.jalview.org) a property enabling all HTTP
187 * requests to be redirected to a mirror of https://www.jalview.org</li>
188 * <li>FIGURE_AUTOIDWIDTH (false) Expand the left hand column of an exported
189 * alignment figure to accommodate even the longest sequence ID or annotation
191 * <li>FIGURE_FIXEDIDWIDTH Specifies the width to use for the left-hand column
192 * when exporting an alignment as a figure (setting FIGURE_AUTOIDWIDTH to true
193 * will override this).</li>
194 * <li>STRUCT_FROM_PDB (false) derive secondary structure annotation from PDB
196 * <li>USE_RNAVIEW (false) use RNAViewer to derive secondary structure</li>
197 * <li>ADD_SS_ANN (false) add secondary structure annotation to alignment
199 * <li>ADD_TEMPFACT_ANN (false) add Temperature Factor annotation to alignment
201 * <li>STRUCTURE_DISPLAY choose from JMOL (default) or CHIMERA for 3D structure
203 * <li>CHIMERA_PATH specify full path to Chimera program (if non-standard)</li>
204 * <li>ID_ORG_HOSTURL location of jalview service providing identifiers.org urls
206 * <li>NONEWS - when set disables Jalview News from automatically appearing</li>
207 * <li>NOHTMLTEMPLATES - when set, the
208 * https://github.com/jalview/exporter-templates/tree/master/biojs repository is
209 * not downloaded automatically</li>
210 * <li>NOIDENTIFIERSSERVICE - when set, jalview won't automatically download
211 * available URL linkouts via www.jalview.org/services/identifiers</li>
214 * Deprecated settings:
217 * <li>DISCOVERY_START - Boolean - controls if discovery services are queried on
218 * startup (JWS1 services only)</li>
219 * <li>DISCOVERY_URLS - comma separated list of Discovery Service endpoints.
220 * (JWS1 services only)</li>
221 * <li>SHOW_JWS1_SERVICES (true) enable or disable the original Jalview 2
222 * services in the desktop GUI</li>
223 * <li>ENABLE_RSBS_EDITOR (false for 2.7 release) enable or disable RSBS editing
224 * panel in web service preferences</li>
228 * @version $Revision$
233 * property giving log4j level for CASTOR loggers
235 public static final String CASTORLOGLEVEL = "logs.Castor.level";
238 * property giving log4j level for AXIS loggers
240 public static final String AXISLOGLEVEL = "logs.Axis.level";
243 * property giving log4j level for Jalview Log
245 public static final String JALVIEWLOGLEVEL = "logs.Jalview.level";
248 public static final String BOOTSTRAP_TEST = "BOOTSTRAP_TEST";
253 public static final String DEFAULT_SIFTS_DOWNLOAD_DIR = System
254 .getProperty("user.home") + File.separatorChar
255 + ".sifts_downloads" + File.separatorChar;
257 private final static String DEFAULT_CACHE_THRESHOLD_IN_DAYS = "2";
259 private final static String DEFAULT_FAIL_SAFE_PID_THRESHOLD = "30";
262 * Identifiers.org download settings
264 private static final String ID_ORG_FILE = System.getProperty("user.home")
265 + File.separatorChar + ".identifiers.org.ids.json";
268 * Allowed values are PDB or mmCIF
270 private final static String PDB_DOWNLOAD_FORMAT = PDBEntry.Type.MMCIF
273 private final static String DEFAULT_PDB_FILE_PARSER = StructureImportSettings.StructureParser.JMOL_PARSER
277 * a date formatter using a fixed (rather than the user's) locale;
278 * this ensures that date properties can be written and re-read successfully
279 * even if the user changes their locale setting
281 private static final DateFormat date_format = SimpleDateFormat
282 .getDateTimeInstance(SimpleDateFormat.MEDIUM,
283 SimpleDateFormat.MEDIUM, Locale.UK);
286 * Initialises the Jalview Application Log
289 public final static String JALVIEW_LOGGER_NAME = "JalviewLogger";
291 // save the proxy properties set at startup
292 public final static String[] startupProxyProperties = {
293 System.getProperty("http.proxyHost"),
294 System.getProperty("http.proxyPort"),
295 System.getProperty("https.proxyHost"),
296 System.getProperty("https.proxyPort"),
297 System.getProperty("http.proxyUser"),
298 System.getProperty("http.proxyPassword"),
299 System.getProperty("https.proxyUser"),
300 System.getProperty("https.proxyPassword"),
301 System.getProperty("http.nonProxyHosts") };
303 public final static String PROXYTYPE_NONE = "none";
305 // "false" and "true" for backward compatibility
306 public final static String PROXYTYPE_SYSTEM = "false";
308 public final static String PROXYTYPE_CUSTOM = "true";
310 // in-memory only storage of proxy password, safer to use char array
311 public static char[] proxyAuthPassword = null;
313 /** Jalview Properties */
314 public static Properties applicationProperties = new Properties()
316 // override results in properties output in alphabetical order
318 public synchronized Enumeration<Object> keys()
320 return Collections.enumeration(new TreeSet<>(super.keySet()));
324 /* build Properties (not all saved to .jalview_properties) */
325 public static Properties buildProperties = new Properties();
327 /** Default file is ~/.jalview_properties */
328 static String propertiesFile;
330 private static final String fallbackPropertiesFile = ".jalview_properties";
332 private static boolean propsAreReadOnly = Platform.isJS();
334 public static boolean isPropsAreReadOnly()
336 return propsAreReadOnly;
339 public static void setPropsAreReadOnly(boolean propsAreReadOnly)
341 Cache.propsAreReadOnly = propsAreReadOnly;
344 private final static String JS_PROPERTY_PREFIX = "jalview_";
347 * Loads properties from the given properties file. Any existing properties
350 public static void loadProperties(String propsFile)
352 propertiesFile = propsFile;
353 String releasePropertiesFile = null;
354 boolean defaultProperties = false;
355 if (propsFile == null && !propsAreReadOnly)
357 String channelPrefsFilename = ChannelProperties
358 .getProperty("preferences.filename");
359 String releasePrefsFilename = fallbackPropertiesFile;
360 propertiesFile = System.getProperty("user.home") + File.separatorChar
361 + channelPrefsFilename;
362 releasePropertiesFile = System.getProperty("user.home")
363 + File.separatorChar + releasePrefsFilename;
364 defaultProperties = true;
368 // don't corrupt the file we've been given.
369 propsAreReadOnly = true;
372 if (propertiesFile == null)
374 Platform.readInfoProperties(JS_PROPERTY_PREFIX,
375 applicationProperties);
384 // props file provided as URL
385 fis = new URL(propertiesFile).openStream();
386 if (!Jalview.quiet())
389 "Loading jalview properties from : " + propertiesFile);
391 "Disabling Jalview writing to user's local properties file.");
393 propsAreReadOnly = true;
394 } catch (Exception ex)
400 String readPropertiesFile = propertiesFile;
401 // if we're using the usual properties file and the channel properties
402 // file doesn't exist, read .jalview_properties
403 // (but we'll still save to the channel properties file).
404 if (defaultProperties && (!new File(propertiesFile).exists())
405 && (new File(releasePropertiesFile).exists()))
407 readPropertiesFile = releasePropertiesFile;
409 fis = new FileInputStream(readPropertiesFile);
411 applicationProperties.clear();
412 applicationProperties.load(fis);
414 // remove any old build properties
416 deleteBuildProperties();
418 } catch (Exception ex)
420 if (!Jalview.quiet())
421 System.out.println("Error reading properties file: " + ex);
425 /* TO BE REPLACED WITH PROXY_TYPE SETTINGS
426 if (getDefault("USE_PROXY", false))
428 String proxyServer = getDefault("PROXY_SERVER", ""),
429 proxyPort = getDefault("PROXY_PORT", "8080");
433 // PROXY TYPE settings (now three options "none", "false", "true", but using
434 // backward compatible strings)
435 String proxyType = getDefault("USE_PROXY", PROXYTYPE_SYSTEM);
436 // default to upgrading old settings
440 clearProxyProperties();
442 case PROXYTYPE_SYSTEM: // use system settings
443 resetProxyProperties();
445 case PROXYTYPE_CUSTOM: // use specified proxy settings
446 String httpHost = getDefault("PROXY_SERVER", "");
447 String httpPort = getDefault("PROXY_PORT", "8080");
448 String httpsHost = getDefault("PROXY_SERVER_HTTPS", httpHost);
449 String httpsPort = getDefault("PROXY_PORT_HTTPS", httpPort);
450 String httpUser = getDefault("PROXY_AUTH_USER", null);
451 // https.proxyUser and https.proxyPassword are not able to be
452 // independently set in Preferences yet (or http.nonProxyHosts)
453 String httpsUser = getDefault("PROXY_AUTH_USER_HTTPS", httpUser);
454 setProxyProperties(httpHost, httpPort, httpsHost, httpsPort, httpUser,
455 proxyAuthPassword, httpsUser, proxyAuthPassword, "localhost");
458 String message = "Incorrect PROXY_TYPE - should be 'none' (clear proxy properties), 'false' (system settings), 'true' (custom settings): "
460 Console.warn(message);
463 // LOAD THE AUTHORS FROM THE authors.props file
464 String authorDetails = resolveResourceURLFor("/authors.props");
468 if (authorDetails != null)
470 URL localJarFileURL = new URL(authorDetails);
471 InputStream in = localJarFileURL.openStream();
472 applicationProperties.load(in);
475 } catch (Exception ex)
477 if (!Jalview.quiet())
478 System.out.println("Error reading author details: " + ex);
479 authorDetails = null;
481 if (authorDetails == null)
483 applicationProperties.remove("AUTHORS");
484 applicationProperties.remove("AUTHORFNAMES");
485 applicationProperties.remove("YEAR");
488 loadBuildProperties(false);
491 .setMapWithSifts(Cache.getDefault("MAP_WITH_SIFTS", false));
493 SiftsSettings.setSiftDownloadDirectory(Cache
494 .getDefault("sifts_download_dir", DEFAULT_SIFTS_DOWNLOAD_DIR));
496 SiftsSettings.setFailSafePIDThreshold(
497 Cache.getDefault("sifts_fail_safe_pid_threshold",
498 DEFAULT_FAIL_SAFE_PID_THRESHOLD));
500 SiftsSettings.setCacheThresholdInDays(
501 Cache.getDefault("sifts_cache_threshold_in_days",
502 DEFAULT_CACHE_THRESHOLD_IN_DAYS));
504 IdOrgSettings.setUrl(getDefault("ID_ORG_HOSTURL",
505 "https://www.jalview.org/services/identifiers"));
506 IdOrgSettings.setDownloadLocation(ID_ORG_FILE);
508 StructureImportSettings.setDefaultStructureFileFormat(
509 Cache.getDefault("PDB_DOWNLOAD_FORMAT", PDB_DOWNLOAD_FORMAT));
510 StructureImportSettings
511 .setDefaultPDBFileParser(DEFAULT_PDB_FILE_PARSER);
512 // StructureImportSettings
513 // .setDefaultPDBFileParser(Cache.getDefault(
514 // "DEFAULT_PDB_FILE_PARSER", DEFAULT_PDB_FILE_PARSER));
516 String jnlpVersion = System.getProperty("jalview.version");
518 // jnlpVersion will be null if a latest version check for the channel needs
520 // Dont do this check if running in headless mode
522 if (jnlpVersion == null && getDefault("VERSION_CHECK", true)
523 && (System.getProperty("java.awt.headless") == null || System
524 .getProperty("java.awt.headless").equals("false")))
527 class VersionChecker extends Thread
533 String remoteBuildPropertiesUrl = Cache
534 .getAppbaseBuildProperties();
536 String orgtimeout = System
537 .getProperty("sun.net.client.defaultConnectTimeout");
538 if (orgtimeout == null)
541 Console.debug("Setting default net timeout to " + orgtimeout
544 String remoteVersion = null;
545 if (remoteBuildPropertiesUrl.startsWith("http"))
549 System.setProperty("sun.net.client.defaultConnectTimeout",
552 URL url = new URL(remoteBuildPropertiesUrl);
554 BufferedReader in = new BufferedReader(
555 new InputStreamReader(url.openStream()));
557 Properties remoteBuildProperties = new Properties();
558 remoteBuildProperties.load(in);
559 remoteVersion = remoteBuildProperties.getProperty("VERSION");
560 } catch (Exception ex)
562 if (!Jalview.quiet())
565 "Non-fatal exception when checking version at "
566 + remoteBuildPropertiesUrl + ":");
567 System.out.println(ex);
569 remoteVersion = getProperty("VERSION");
572 System.setProperty("sun.net.client.defaultConnectTimeout",
575 setProperty("LATEST_VERSION", remoteVersion);
579 VersionChecker vc = new VersionChecker();
584 if (jnlpVersion != null)
586 setProperty("LATEST_VERSION", jnlpVersion);
590 applicationProperties.remove("LATEST_VERSION");
594 // LOAD USERDEFINED COLOURS
595 Cache.initUserColourSchemes(getProperty("USER_DEFINED_COLOURS"));
596 jalview.io.PIRFile.useModellerOutput = Cache.getDefault("PIR_MODELLER",
601 * construct a resource URL for the given absolute resource pathname
603 * @param resourcePath
606 private static String resolveResourceURLFor(String resourcePath)
609 if (Platform.isJS() || !Cache.class.getProtectionDomain()
610 .getCodeSource().getLocation().toString().endsWith(".jar"))
614 url = Cache.class.getResource(resourcePath).toString();
615 } catch (Exception ex)
617 System.err.println("Failed to resolve resource " + resourcePath
618 + ": " + ex.getMessage());
623 url = "jar:".concat(Cache.class.getProtectionDomain().getCodeSource()
624 .getLocation().toString().concat("!" + resourcePath));
629 public static void loadBuildProperties(boolean reportVersion)
631 String codeInstallation = getProperty("INSTALLATION");
632 boolean printVersion = codeInstallation == null;
635 * read build properties - from the Jalview jar for a Java distribution,
636 * or from codebase file in test or JalviewJS context
640 String buildDetails = resolveResourceURLFor("/.build_properties");
641 URL localJarFileURL = new URL(buildDetails);
642 InputStream in = localJarFileURL.openStream();
643 buildProperties.load(in);
645 if (buildProperties.getProperty("BUILD_DATE", null) != null)
647 applicationProperties.put("BUILD_DATE",
648 buildProperties.getProperty("BUILD_DATE"));
650 if (buildProperties.getProperty("INSTALLATION", null) != null)
652 applicationProperties.put("INSTALLATION",
653 buildProperties.getProperty("INSTALLATION"));
655 if (buildProperties.getProperty("VERSION", null) != null)
657 applicationProperties.put("VERSION",
658 buildProperties.getProperty("VERSION"));
660 if (buildProperties.getProperty("JAVA_COMPILE_VERSION", null) != null)
662 applicationProperties.put("JAVA_COMPILE_VERSION",
663 buildProperties.getProperty("JAVA_COMPILE_VERSION"));
665 } catch (Exception ex)
667 if (!Jalview.quiet())
668 System.out.println("Error reading build details: " + ex);
669 applicationProperties.remove("VERSION");
671 String codeVersion = getProperty("VERSION");
672 codeInstallation = getProperty("INSTALLATION");
674 if (codeVersion == null)
676 // THIS SHOULD ONLY BE THE CASE WHEN TESTING!!
677 codeVersion = "Test";
678 codeInstallation = "";
682 codeInstallation = " (" + codeInstallation + ")";
684 setProperty("VERSION", codeVersion);
685 new BuildDetails(codeVersion, null, codeInstallation);
686 if (printVersion && reportVersion)
688 System.out.println(ChannelProperties.getProperty("app_name")
689 + " version: " + codeVersion + codeInstallation);
693 private static void deleteBuildProperties()
695 applicationProperties.remove("LATEST_VERSION");
696 applicationProperties.remove("VERSION");
697 applicationProperties.remove("AUTHORS");
698 applicationProperties.remove("AUTHORFNAMES");
699 applicationProperties.remove("YEAR");
700 applicationProperties.remove("BUILD_DATE");
701 applicationProperties.remove("INSTALLATION");
705 * Gets Jalview application property of given key. Returns null if key not
711 * @return Property value
713 public static String getProperty(String key)
715 String prop = applicationProperties.getProperty(key);
716 if (prop == null && Platform.isJS())
718 prop = applicationProperties.getProperty(Platform.getUniqueAppletID()
719 + "_" + JS_PROPERTY_PREFIX + key);
725 * These methods are used when checking if the saved preference is different
726 * to the default setting
729 public static boolean getDefault(String property, boolean def)
731 String string = getProperty(property);
734 def = Boolean.valueOf(string).booleanValue();
740 public static int getDefault(String property, int def)
742 String string = getProperty(property);
747 def = Integer.parseInt(string);
748 } catch (NumberFormatException e)
750 if (!Jalview.quiet())
751 System.out.println("Error parsing int property '" + property
752 + "' with value '" + string + "'");
760 * Answers the value of the given property, or the supplied default value if
761 * the property is not set
763 public static String getDefault(String property, String def)
765 String value = getProperty(property);
766 return value == null ? def : value;
770 * Stores property in the file "HOME_DIR/.jalview_properties"
775 * String value of property
777 * @return previous value of property (or null)
779 public static Object setProperty(String key, String obj)
781 Object oldValue = null;
784 oldValue = applicationProperties.setProperty(key, obj);
785 if (propertiesFile != null && !propsAreReadOnly)
787 FileOutputStream out = new FileOutputStream(propertiesFile);
788 applicationProperties.store(out, "---JalviewX Properties File---");
791 } catch (Exception ex)
793 if (!Jalview.quiet())
795 "Error setting property: " + key + " " + obj + "\n" + ex);
801 * remove the specified property from the jalview properties file
805 public static void removeProperty(String string)
807 applicationProperties.remove(string);
812 * save the properties to the jalview properties path
814 public static void saveProperties()
816 if (!propsAreReadOnly)
820 FileOutputStream out = new FileOutputStream(propertiesFile);
821 applicationProperties.store(out, "---JalviewX Properties File---");
823 } catch (Exception ex)
825 if (!Jalview.quiet())
826 System.out.println("Error saving properties: " + ex);
832 * internal vamsas class discovery state
834 private static int vamsasJarsArePresent = -1;
837 * Searches for vamsas client classes on class path.
839 * @return true if vamsas client is present on classpath
841 public static boolean vamsasJarsPresent()
843 if (vamsasJarsArePresent == -1)
847 if (jalview.jbgui.GDesktop.class.getClassLoader()
848 .loadClass("uk.ac.vamsas.client.VorbaId") != null)
851 "Found Vamsas Classes (uk.ac..vamsas.client.VorbaId can be loaded)");
852 vamsasJarsArePresent = 1;
853 JLoggerLog4j lvclient = JLoggerLog4j.getLogger("uk.ac.vamsas",
854 Console.getCachedLogLevel("logs.Vamsas.Level"));
855 JLoggerLog4j.addAppender(lvclient, Console.log,
856 JALVIEW_LOGGER_NAME);
857 // Tell the user that debug is enabled
858 lvclient.debug(ChannelProperties.getProperty("app_name")
859 + " Vamsas Client Debugging Output Follows.");
861 } catch (Exception e)
863 vamsasJarsArePresent = 0;
864 Console.debug("Vamsas Classes are not present");
867 return (vamsasJarsArePresent > 0);
871 * internal vamsas class discovery state
873 private static int groovyJarsArePresent = -1;
876 * Searches for vamsas client classes on class path.
878 * @return true if vamsas client is present on classpath
880 public static boolean groovyJarsPresent()
882 if (groovyJarsArePresent == -1)
886 if (Cache.class.getClassLoader()
887 .loadClass("groovy.lang.GroovyObject") != null)
890 "Found Groovy (groovy.lang.GroovyObject can be loaded)");
891 groovyJarsArePresent = 1;
892 JLoggerLog4j lgclient = JLoggerLog4j.getLogger("groovy",
893 Console.getCachedLogLevel("logs.Groovy.Level"));
894 JLoggerLog4j.addAppender(lgclient, Console.log,
895 JALVIEW_LOGGER_NAME);
896 // Tell the user that debug is enabled
897 lgclient.debug(ChannelProperties.getProperty("app_name")
898 + " Groovy Client Debugging Output Follows.");
902 groovyJarsArePresent = 0;
903 Console.debug("Groovy Classes are not present", e);
904 } catch (Exception e)
906 groovyJarsArePresent = 0;
907 Console.debug("Groovy Classes are not present");
910 return (groovyJarsArePresent > 0);
914 * GA tracker object - actually JGoogleAnalyticsTracker null if tracking not
917 protected static Object tracker = null;
919 protected static Class trackerfocus = null;
921 protected static Class jgoogleanalyticstracker = null;
924 * Initialise the google tracker if it is not done already.
926 public static void initGoogleTracker()
930 if (jgoogleanalyticstracker == null)
932 // try to get the tracker class
935 jgoogleanalyticstracker = Cache.class.getClassLoader().loadClass(
936 "com.boxysystems.jgoogleanalytics.JGoogleAnalyticsTracker");
937 trackerfocus = Cache.class.getClassLoader()
938 .loadClass("com.boxysystems.jgoogleanalytics.FocusPoint");
939 } catch (Exception e)
942 "com.boxysystems.jgoogleanalytics package is not present - tracking not enabled.");
944 jgoogleanalyticstracker = null;
949 // now initialise tracker
950 Exception re = null, ex = null;
952 String vrs = "No Version Accessible";
955 // Google analytics tracking code for Library Finder
956 tracker = jgoogleanalyticstracker
957 .getConstructor(new Class[]
958 { String.class, String.class, String.class })
959 .newInstance(new Object[]
960 { ChannelProperties.getProperty("app_name") + " Desktop",
961 (vrs = Cache.getProperty("VERSION") + "_"
962 + Cache.getDefault("BUILD_DATE", "unknown")),
964 jgoogleanalyticstracker
965 .getMethod("trackAsynchronously", new Class[]
967 .invoke(tracker, new Object[]
968 { trackerfocus.getConstructor(new Class[] { String.class })
969 .newInstance(new Object[]
970 { "Application Started." }) });
971 } catch (RuntimeException e)
974 } catch (Exception e)
981 if (re != null || ex != null || err != null)
985 Console.debug("Caught runtime exception in googletracker init:",
991 "Failed to initialise GoogleTracker for Jalview Desktop with version "
998 "Whilst initing GoogleTracker for Jalview Desktop version "
1005 Console.debug("Successfully initialised tracker.");
1011 * get the user's default colour if available
1017 public static Color getDefaultColour(String property, Color defcolour)
1019 String colprop = getProperty(property);
1020 if (colprop == null)
1024 Color col = ColorUtils.parseColourString(colprop);
1027 Console.warn("Couldn't parse '" + colprop + "' as a colour for "
1030 return (col == null) ? defcolour : col;
1034 * store a colour as a Jalview user default property
1039 public static void setColourProperty(String property, Color colour)
1041 setProperty(property, jalview.util.Format.getHexString(colour));
1045 * Stores a formatted date in a jalview property, using a fixed locale.
1047 * @param propertyName
1049 * @return the formatted date string
1051 public static String setDateProperty(String propertyName, Date date)
1053 String formatted = date_format.format(date);
1054 setProperty(propertyName, formatted);
1059 * Reads a date stored in a Jalview property, parses it (using a fixed locale
1060 * format) and returns as a Date, or null if parsing fails
1062 * @param propertyName
1066 public static Date getDateProperty(String propertyName)
1068 String val = getProperty(propertyName);
1073 return date_format.parse(val);
1074 } catch (Exception ex)
1076 System.err.println("Invalid or corrupt date in property '"
1077 + propertyName + "' : value was '" + val + "'");
1084 * get and parse a property as an integer. send any parsing problems to
1088 * @return null or Integer
1090 public static Integer getIntegerProperty(String property)
1092 String val = getProperty(property);
1093 if (val != null && (val = val.trim()).length() > 0)
1097 return Integer.valueOf(val);
1098 } catch (NumberFormatException x)
1100 System.err.println("Invalid integer in property '" + property
1101 + "' (value was '" + val + "')");
1108 * Set the specified value, or remove it if null or empty. Does not save the
1114 public static void setOrRemove(String propName, String value)
1116 if (propName == null)
1120 if (value == null || value.trim().length() < 1)
1122 Cache.applicationProperties.remove(propName);
1126 Cache.applicationProperties.setProperty(propName, value);
1131 * Loads in user colour schemes from files.
1134 * a '|'-delimited list of file paths
1136 public static void initUserColourSchemes(String files)
1138 if (files == null || files.length() == 0)
1143 // In case colours can't be loaded, we'll remove them
1144 // from the default list here.
1145 StringBuffer coloursFound = new StringBuffer();
1146 StringTokenizer st = new StringTokenizer(files, "|");
1147 while (st.hasMoreElements())
1149 String file = st.nextToken();
1152 UserColourScheme ucs = ColourSchemeLoader.loadColourScheme(file);
1155 if (coloursFound.length() > 0)
1157 coloursFound.append("|");
1159 coloursFound.append(file);
1160 ColourSchemes.getInstance().registerColourScheme(ucs);
1162 } catch (Exception ex)
1164 if (!Jalview.quiet())
1165 System.out.println("Error loading User ColourFile\n" + ex);
1168 if (!files.equals(coloursFound.toString()))
1170 if (coloursFound.toString().length() > 1)
1172 setProperty(UserDefinedColours.USER_DEFINED_COLOURS,
1173 coloursFound.toString());
1177 applicationProperties
1178 .remove(UserDefinedColours.USER_DEFINED_COLOURS);
1184 * Initial logging information helper for various versions output
1188 * @param defaultValue
1190 private static void appendIfNotNull(StringBuilder sb, String prefix,
1191 String value, String suffix, String defaultValue)
1193 if (value == null && defaultValue == null)
1199 sb.append(value == null ? defaultValue : value);
1206 * @return Jalview version, build details and JVM platform version for console
1208 public static String getVersionDetailsForConsole()
1210 StringBuilder sb = new StringBuilder();
1211 sb.append(ChannelProperties.getProperty("app_name"))
1212 .append(" Version: ");
1213 sb.append(Cache.getDefault("VERSION", "TEST"));
1215 sb.append(ChannelProperties.getProperty("app_name"))
1216 .append(" Installation: ");
1217 sb.append(Cache.getDefault("INSTALLATION", "unknown"));
1219 sb.append("Build Date: ");
1220 sb.append(Cache.getDefault("BUILD_DATE", "unknown"));
1222 sb.append("Java version: ");
1223 sb.append(System.getProperty("java.version"));
1225 sb.append("Java platform: ");
1226 sb.append(System.getProperty("os.arch"));
1228 sb.append(System.getProperty("os.name"));
1230 sb.append(System.getProperty("os.version"));
1232 appendIfNotNull(sb, "Install4j version: ",
1233 System.getProperty("sys.install4jVersion"), "\n", null);
1234 appendIfNotNull(sb, "Install4j template version: ",
1235 System.getProperty("installer_template_version"), "\n", null);
1236 appendIfNotNull(sb, "Launcher version: ",
1237 System.getProperty("launcher_version"), "\n", null);
1238 LookAndFeel laf = UIManager.getLookAndFeel();
1239 String lafName = laf == null ? "Not obtained" : laf.getName();
1240 String lafClass = laf == null ? "unknown" : laf.getClass().getName();
1241 sb.append("LookAndFeel: ");
1244 sb.append(lafClass);
1246 appendIfNotNull(sb, "Channel: ",
1247 ChannelProperties.getProperty("channel"), "\n", null);
1248 if (Console.isDebugEnabled()
1249 || !"release".equals(ChannelProperties.getProperty("channel")))
1251 appendIfNotNull(sb, "Getdown appdir: ",
1252 System.getProperty("getdowninstanceappdir"), "\n", null);
1253 appendIfNotNull(sb, "Getdown appbase: ",
1254 System.getProperty("getdowninstanceappbase"), "\n", null);
1255 appendIfNotNull(sb, "Java home: ", System.getProperty("java.home"),
1257 appendIfNotNull(sb, "Preferences file: ", propertiesFile, "\n",
1260 return sb.toString();
1265 * @return build details as reported in splashscreen
1267 public static String getBuildDetailsForSplash()
1269 // consider returning more human friendly info
1270 // eg 'built from Source' or update channel
1271 return Cache.getDefault("INSTALLATION", "unknown");
1274 public static String getStackTraceString(Throwable t)
1276 StringWriter sw = new StringWriter();
1277 PrintWriter pw = new PrintWriter(sw);
1278 t.printStackTrace(pw);
1279 return sw.toString();
1282 // proxy properties methods
1283 public static void clearProxyProperties()
1285 setProxyProperties(null, null, null, null, null, null, null, null,
1289 public static void resetProxyProperties()
1291 setProxyProperties(startupProxyProperties[0], startupProxyProperties[1],
1292 startupProxyProperties[2], startupProxyProperties[3],
1293 startupProxyProperties[4],
1294 startupProxyProperties[5] == null ? null
1295 : startupProxyProperties[5].toCharArray(),
1296 startupProxyProperties[6],
1297 startupProxyProperties[7] == null ? null
1298 : startupProxyProperties[7].toCharArray(),
1299 startupProxyProperties[8]);
1300 StringBuilder sb = new StringBuilder();
1301 sb.append("Setting proxy properties to: http.proxyHost=")
1302 .append(startupProxyProperties[0]).append(", http.proxyPort=")
1303 .append(startupProxyProperties[1])
1304 .append(startupProxyProperties[4] != null
1305 && !startupProxyProperties[4].isEmpty()
1306 ? " [" + startupProxyProperties[4] + "]"
1308 .append(", https.proxyHost=").append(startupProxyProperties[2])
1309 .append(", https.proxyPort=").append(startupProxyProperties[3])
1310 .append(startupProxyProperties[6] != null
1311 && !startupProxyProperties[6].isEmpty()
1312 ? " [" + startupProxyProperties[6] + "]"
1315 Console.debug(sb.toString());
1318 public static void setProxyPropertiesFromPreferences()
1320 setProxyPropertiesFromPreferences(Cache.PROXYTYPE_SYSTEM);
1323 public static void setProxyPropertiesFromPreferences(
1324 String previousProxyType)
1326 String proxyType = Cache.getDefault("USE_PROXY",
1327 Cache.PROXYTYPE_SYSTEM);
1328 if (previousProxyType != null
1329 && !proxyType.equals(Cache.PROXYTYPE_CUSTOM) // always apply
1331 && proxyType.equals(previousProxyType))
1338 case Cache.PROXYTYPE_NONE:
1339 if (!previousProxyType.equals(proxyType))
1341 Console.info("Setting no proxy settings");
1342 Cache.setProxyProperties(null, null, null, null, null, null, null,
1346 case Cache.PROXYTYPE_CUSTOM:
1347 // always re-set a custom proxy -- it might have changed, particularly
1349 Console.info("Setting custom proxy settings");
1350 boolean proxyAuthSet = Cache.getDefault("PROXY_AUTH", false);
1351 Cache.setProxyProperties(Cache.getDefault("PROXY_SERVER", null),
1352 Cache.getDefault("PROXY_PORT", null),
1353 Cache.getDefault("PROXY_SERVER_HTTPS", null),
1354 Cache.getDefault("PROXY_PORT_HTTPS", null),
1355 proxyAuthSet ? Cache.getDefault("PROXY_AUTH_USERNAME", "")
1357 proxyAuthSet ? Cache.proxyAuthPassword : null,
1358 proxyAuthSet ? Cache.getDefault("PROXY_AUTH_USERNAME", "")
1360 proxyAuthSet ? Cache.proxyAuthPassword : null, "localhost");
1362 default: // system proxy settings by default
1363 Console.info("Setting system proxy settings");
1364 Cache.resetProxyProperties();
1368 public static void setProxyProperties(String httpHost, String httpPort,
1369 String httpsHost, String httpsPort, String httpUser,
1370 char[] httpPassword, String httpsUser, char[] httpsPassword,
1371 String nonProxyHosts)
1373 setOrClearSystemProperty("http.proxyHost", httpHost);
1374 setOrClearSystemProperty("http.proxyPort", httpPort);
1375 setOrClearSystemProperty("https.proxyHost", httpsHost);
1376 setOrClearSystemProperty("https.proxyPort", httpsPort);
1377 setOrClearSystemProperty("http.proxyUser", httpUser);
1378 setOrClearSystemProperty("https.proxyUser", httpsUser);
1379 // note: passwords for http.proxyPassword and https.proxyPassword are sent
1380 // via the Authenticator, properties do not need to be set
1382 // are we using a custom proxy (password prompt might be required)?
1383 boolean customProxySet = getDefault("USE_PROXY", PROXYTYPE_SYSTEM)
1384 .equals(PROXYTYPE_CUSTOM);
1387 * A bug in Java means the AuthCache does not get reset, so once it has working credentials,
1388 * it never asks for more, so changing the Authenticator has no effect (as getPasswordAuthentication()
1389 * is not re-called).
1390 * This could lead to password leak to a hostile proxy server, so I'm putting in a hack to clear
1392 * see https://www.generacodice.com/en/articolo/154918/Reset-the-Authenticator-credentials
1394 * Turns out this is only accessible in Java 8, and not in Java 9 onwards, so commenting out
1399 sun.net.www.protocol.http.AuthCacheValue
1400 .setAuthCache(new sun.net.www.protocol.http.AuthCacheImpl());
1401 } catch (Throwable t)
1403 Cache.error(t.getMessage());
1404 Cache.debug(getStackTraceString(t));
1408 if (httpUser != null || httpsUser != null)
1412 char[] displayHttpPw = new char[httpPassword == null ? 0
1413 : httpPassword.length];
1414 Arrays.fill(displayHttpPw, '*');
1416 "CACHE Proxy: setting new Authenticator with httpUser='"
1417 + httpUser + "' httpPassword='" + displayHttpPw
1419 if (!Platform.isJS())
1421 * java.net.Authenticator not implemented in SwingJS yet
1427 Authenticator.setDefault(new Authenticator()
1430 protected PasswordAuthentication getPasswordAuthentication()
1432 if (getRequestorType() == RequestorType.PROXY)
1434 String protocol = getRequestingProtocol();
1435 boolean needProxyPasswordSet = false;
1436 if (customProxySet &&
1437 // we have a username but no password for the scheme being
1439 (protocol.equalsIgnoreCase("http")
1440 && (httpUser != null
1441 && httpUser.length() > 0
1442 && (httpPassword == null
1443 || httpPassword.length == 0)))
1444 || (protocol.equalsIgnoreCase("https")
1445 && (httpsUser != null
1446 && httpsUser.length() > 0
1447 && (httpsPassword == null
1448 || httpsPassword.length == 0))))
1450 // open Preferences -> Connections
1451 String message = MessageManager
1452 .getString("label.proxy_password_required");
1453 Preferences.openPreferences(
1454 Preferences.TabRef.CONNECTIONS_TAB, message);
1455 Preferences.getInstance()
1456 .proxyAuthPasswordCheckHighlight(true, true);
1462 if (protocol.equalsIgnoreCase("http")
1463 && getRequestingHost()
1464 .equalsIgnoreCase(httpHost)
1465 && getRequestingPort() == Integer
1469 "AUTHENTICATOR returning PasswordAuthentication(\""
1470 + httpUser + "\", '"
1471 + new String(displayHttpPw) + "')");
1472 return new PasswordAuthentication(httpUser,
1475 if (protocol.equalsIgnoreCase("https")
1476 && getRequestingHost()
1477 .equalsIgnoreCase(httpsHost)
1478 && getRequestingPort() == Integer
1479 .valueOf(httpsPort))
1481 char[] displayHttpsPw = new char[httpPassword.length];
1482 Arrays.fill(displayHttpsPw, '*');
1484 "AUTHENTICATOR returning PasswordAuthentication(\""
1485 + httpsUser + "\", '" + displayHttpsPw
1487 return new PasswordAuthentication(httpsUser,
1490 } catch (NumberFormatException e)
1492 Console.error("Problem with proxy port values [http:"
1493 + httpPort + ", https:" + httpsPort + "]");
1496 "AUTHENTICATOR after trying to get PasswordAuthentication");
1499 // non proxy request
1500 Console.debug("AUTHENTICATOR returning null");
1504 } // end of j2sIgnore for java.net.Authenticator
1506 // required to re-enable basic authentication (should be okay for a
1509 "AUTHENTICATOR setting property 'jdk.http.auth.tunneling.disabledSchemes' to \"\"");
1510 System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");
1511 } catch (SecurityException e)
1513 Console.error("Could not set default Authenticator");
1514 Console.debug(getStackTraceString(e));
1519 // reset the Authenticator to protect http.proxyUser and
1520 // http.proxyPassword Just In Case
1521 /* as noted above, due to bug in java this doesn't work if the sun.net.www.protocol.http.AuthCache
1522 * has working credentials. No workaround for Java 11.
1524 if (!Platform.isJS())
1526 * java.net.Authenticator not implemented in SwingJS yet
1533 "AUTHENTICATOR setting default Authenticator to null");
1534 Authenticator.setDefault(null);
1538 // nonProxyHosts not currently configurable in Preferences
1540 "AUTHENTICATOR setting property 'http.nonProxyHosts' to \""
1541 + nonProxyHosts + "\"");
1542 setOrClearSystemProperty("http.nonProxyHosts", nonProxyHosts);
1545 public static void setOrClearSystemProperty(String key, char[] value)
1547 setOrClearSystemProperty(key,
1548 (value == null) ? null : new String(value));
1551 public static void setOrClearSystemProperty(String key, String value)
1559 System.clearProperty(key);
1563 System.setProperty(key, value);
1568 * Getdown appbase methods
1571 private static final String releaseAppbase;
1573 private static String getdownAppbase;
1575 private static String getdownDistDir;
1579 if (!Platform.isJS())
1581 Float specversion = Float
1582 .parseFloat(System.getProperty("java.specification.version"));
1583 releaseAppbase = (specversion < 9)
1584 ? "https://www.jalview.org/getdown/release/1.8"
1585 : "https://www.jalview.org/getdown/release/11";
1589 // this value currenly made up, can be changed to URL that will be
1590 // "https://www.jalview.org/jalview-js/swingjs/j2s/build_properties"
1591 releaseAppbase = "https://www.jalview.org/jalview-js";
1592 getdownAppbase = releaseAppbase;
1593 getdownDistDir = "/swingjs/j2s";
1597 // look for properties (passed in by getdown) otherwise default to release
1598 private static void setGetdownAppbase()
1600 if (getdownAppbase != null)
1604 String appbase = System.getProperty("getdownappbase");
1605 String distDir = System.getProperty("getdowndistdir");
1606 if (appbase == null)
1608 appbase = buildProperties.getProperty("GETDOWNAPPBASE");
1609 distDir = buildProperties.getProperty("GETDOWNAPPDISTDIR");
1611 if (appbase == null)
1613 appbase = releaseAppbase;
1614 distDir = "release";
1616 if (appbase.endsWith("/"))
1618 appbase = appbase.substring(0, appbase.length() - 1);
1620 if (distDir == null)
1622 distDir = appbase.equals(releaseAppbase) ? "release" : "alt";
1624 getdownAppbase = appbase;
1625 getdownDistDir = distDir;
1628 public static String getGetdownAppbase()
1630 setGetdownAppbase();
1631 return getdownAppbase;
1634 public static String getAppbaseBuildProperties()
1636 String appbase = getGetdownAppbase();
1637 return appbase + "/" + getdownDistDir + "/build_properties";
1640 private static final Collection<String> bootstrapProperties = new ArrayList<>(
1641 Arrays.asList(JALVIEWLOGLEVEL, BOOTSTRAP_TEST));
1643 public static Properties bootstrapProperties(String filename)
1645 Properties bootstrapProps = new Properties();
1647 if (filename != null)
1649 file = new File(filename);
1651 if (file == null || !file.exists())
1653 String channelPrefsFilename = ChannelProperties
1654 .getProperty("preferences.filename");
1655 String propertiesFilename = System.getProperty("user.home")
1656 + File.separatorChar + channelPrefsFilename;
1657 file = new File(propertiesFilename);
1659 if (file == null || !file.exists())
1661 String releasePrefsFilename = fallbackPropertiesFile;
1662 String releasePropertiesFilename = System.getProperty("user.home")
1663 + File.separatorChar + releasePrefsFilename;
1664 file = new File(releasePropertiesFilename);
1667 if (filename == null)
1671 System.err.println("Could not load bootstrap preferences file '"
1678 FileInputStream in = new FileInputStream(file.getAbsoluteFile());
1679 Properties props = new Properties();
1681 for (String prop : bootstrapProperties)
1683 if (props.containsKey(prop))
1684 bootstrapProps.put(prop, props.getProperty(prop));
1686 } catch (FileNotFoundException e)
1688 System.err.println("Could not find bootstrap preferences file '"
1689 + file.getAbsolutePath() + "'");
1690 } catch (IOException e)
1693 "IOException when loading bootstrap preferences file '"
1694 + file.getAbsolutePath() + "'");
1696 return bootstrapProps;