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";
250 public static final String DEFAULT_SIFTS_DOWNLOAD_DIR = System
251 .getProperty("user.home") + File.separatorChar
252 + ".sifts_downloads" + File.separatorChar;
254 private final static String DEFAULT_CACHE_THRESHOLD_IN_DAYS = "2";
256 private final static String DEFAULT_FAIL_SAFE_PID_THRESHOLD = "30";
259 * Identifiers.org download settings
261 private static final String ID_ORG_FILE = System.getProperty("user.home")
262 + File.separatorChar + ".identifiers.org.ids.json";
265 * Allowed values are PDB or mmCIF
267 private final static String PDB_DOWNLOAD_FORMAT = PDBEntry.Type.MMCIF
270 private final static String DEFAULT_PDB_FILE_PARSER = StructureImportSettings.StructureParser.JMOL_PARSER
274 * a date formatter using a fixed (rather than the user's) locale;
275 * this ensures that date properties can be written and re-read successfully
276 * even if the user changes their locale setting
278 private static final DateFormat date_format = SimpleDateFormat
279 .getDateTimeInstance(SimpleDateFormat.MEDIUM,
280 SimpleDateFormat.MEDIUM, Locale.UK);
283 * Initialises the Jalview Application Log
286 public final static String JALVIEW_LOGGER_NAME = "JalviewLogger";
288 // save the proxy properties set at startup
289 public final static String[] startupProxyProperties = {
290 System.getProperty("http.proxyHost"),
291 System.getProperty("http.proxyPort"),
292 System.getProperty("https.proxyHost"),
293 System.getProperty("https.proxyPort"),
294 System.getProperty("http.proxyUser"),
295 System.getProperty("http.proxyPassword"),
296 System.getProperty("https.proxyUser"),
297 System.getProperty("https.proxyPassword"),
298 System.getProperty("http.nonProxyHosts") };
300 public final static String PROXYTYPE_NONE = "none";
302 // "false" and "true" for backward compatibility
303 public final static String PROXYTYPE_SYSTEM = "false";
305 public final static String PROXYTYPE_CUSTOM = "true";
307 // in-memory only storage of proxy password, safer to use char array
308 public static char[] proxyAuthPassword = null;
310 /** Jalview Properties */
311 public static Properties applicationProperties = new Properties()
313 // override results in properties output in alphabetical order
315 public synchronized Enumeration<Object> keys()
317 return Collections.enumeration(new TreeSet<>(super.keySet()));
321 /* build Properties (not all saved to .jalview_properties) */
322 public static Properties buildProperties = new Properties();
324 /** Default file is ~/.jalview_properties */
325 static String propertiesFile;
327 private static final String fallbackPropertiesFile = ".jalview_properties";
329 private static boolean propsAreReadOnly = Platform.isJS();
331 public static boolean isPropsAreReadOnly()
333 return propsAreReadOnly;
336 public static void setPropsAreReadOnly(boolean propsAreReadOnly)
338 Cache.propsAreReadOnly = propsAreReadOnly;
341 private final static String JS_PROPERTY_PREFIX = "jalview_";
344 * Loads properties from the given properties file. Any existing properties
347 public static void loadProperties(String propsFile)
349 propertiesFile = propsFile;
350 String releasePropertiesFile = null;
351 boolean defaultProperties = false;
352 if (propsFile == null && !propsAreReadOnly)
354 String channelPrefsFilename = ChannelProperties
355 .getProperty("preferences.filename");
356 String releasePrefsFilename = fallbackPropertiesFile;
357 propertiesFile = System.getProperty("user.home") + File.separatorChar
358 + channelPrefsFilename;
359 releasePropertiesFile = System.getProperty("user.home")
360 + File.separatorChar + releasePrefsFilename;
361 defaultProperties = true;
365 // don't corrupt the file we've been given.
366 propsAreReadOnly = true;
369 if (propertiesFile == null)
371 Platform.readInfoProperties(JS_PROPERTY_PREFIX,
372 applicationProperties);
381 // props file provided as URL
382 fis = new URL(propertiesFile).openStream();
384 "Loading jalview properties from : " + propertiesFile);
386 "Disabling Jalview writing to user's local properties file.");
387 propsAreReadOnly = true;
388 } catch (Exception ex)
394 String readPropertiesFile = propertiesFile;
395 // if we're using the usual properties file and the channel properties
396 // file doesn't exist, read .jalview_properties
397 // (but we'll still save to the channel properties file).
398 if (defaultProperties && (!new File(propertiesFile).exists())
399 && (new File(releasePropertiesFile).exists()))
401 readPropertiesFile = releasePropertiesFile;
403 fis = new FileInputStream(readPropertiesFile);
405 applicationProperties.clear();
406 applicationProperties.load(fis);
408 // remove any old build properties
410 deleteBuildProperties();
412 } catch (Exception ex)
414 System.out.println("Error reading properties file: " + ex);
418 /* TO BE REPLACED WITH PROXY_TYPE SETTINGS
419 if (getDefault("USE_PROXY", false))
421 String proxyServer = getDefault("PROXY_SERVER", ""),
422 proxyPort = getDefault("PROXY_PORT", "8080");
426 // PROXY TYPE settings (now three options "none", "false", "true", but using
427 // backward compatible strings)
428 String proxyType = getDefault("USE_PROXY", PROXYTYPE_SYSTEM);
429 // default to upgrading old settings
433 clearProxyProperties();
435 case PROXYTYPE_SYSTEM: // use system settings
436 resetProxyProperties();
438 case PROXYTYPE_CUSTOM: // use specified proxy settings
439 String httpHost = getDefault("PROXY_SERVER", "");
440 String httpPort = getDefault("PROXY_PORT", "8080");
441 String httpsHost = getDefault("PROXY_SERVER_HTTPS", httpHost);
442 String httpsPort = getDefault("PROXY_PORT_HTTPS", httpPort);
443 String httpUser = getDefault("PROXY_AUTH_USER", null);
444 // https.proxyUser and https.proxyPassword are not able to be
445 // independently set in Preferences yet (or http.nonProxyHosts)
446 String httpsUser = getDefault("PROXY_AUTH_USER_HTTPS", httpUser);
447 setProxyProperties(httpHost, httpPort, httpsHost, httpsPort, httpUser,
448 proxyAuthPassword, httpsUser, proxyAuthPassword, "localhost");
451 String message = "Incorrect PROXY_TYPE - should be 'none' (clear proxy properties), 'false' (system settings), 'true' (custom settings): "
453 Console.warn(message);
456 // LOAD THE AUTHORS FROM THE authors.props file
457 String authorDetails = resolveResourceURLFor("/authors.props");
461 if (authorDetails != null)
463 URL localJarFileURL = new URL(authorDetails);
464 InputStream in = localJarFileURL.openStream();
465 applicationProperties.load(in);
468 } catch (Exception ex)
470 System.out.println("Error reading author details: " + ex);
471 authorDetails = null;
473 if (authorDetails == null)
475 applicationProperties.remove("AUTHORS");
476 applicationProperties.remove("AUTHORFNAMES");
477 applicationProperties.remove("YEAR");
480 loadBuildProperties(false);
483 .setMapWithSifts(Cache.getDefault("MAP_WITH_SIFTS", false));
485 SiftsSettings.setSiftDownloadDirectory(Cache
486 .getDefault("sifts_download_dir", DEFAULT_SIFTS_DOWNLOAD_DIR));
488 SiftsSettings.setFailSafePIDThreshold(
489 Cache.getDefault("sifts_fail_safe_pid_threshold",
490 DEFAULT_FAIL_SAFE_PID_THRESHOLD));
492 SiftsSettings.setCacheThresholdInDays(
493 Cache.getDefault("sifts_cache_threshold_in_days",
494 DEFAULT_CACHE_THRESHOLD_IN_DAYS));
496 IdOrgSettings.setUrl(getDefault("ID_ORG_HOSTURL",
497 "https://www.jalview.org/services/identifiers"));
498 IdOrgSettings.setDownloadLocation(ID_ORG_FILE);
500 StructureImportSettings.setDefaultStructureFileFormat(
501 Cache.getDefault("PDB_DOWNLOAD_FORMAT", PDB_DOWNLOAD_FORMAT));
502 StructureImportSettings
503 .setDefaultPDBFileParser(DEFAULT_PDB_FILE_PARSER);
504 // StructureImportSettings
505 // .setDefaultPDBFileParser(Cache.getDefault(
506 // "DEFAULT_PDB_FILE_PARSER", DEFAULT_PDB_FILE_PARSER));
508 String jnlpVersion = System.getProperty("jalview.version");
510 // jnlpVersion will be null if a latest version check for the channel needs
512 // Dont do this check if running in headless mode
514 if (jnlpVersion == null && getDefault("VERSION_CHECK", true)
515 && (System.getProperty("java.awt.headless") == null || System
516 .getProperty("java.awt.headless").equals("false")))
519 class VersionChecker extends Thread
525 String remoteBuildPropertiesUrl = Cache
526 .getAppbaseBuildProperties();
528 String orgtimeout = System
529 .getProperty("sun.net.client.defaultConnectTimeout");
530 if (orgtimeout == null)
533 System.out.println("# INFO: Setting default net timeout to "
534 + orgtimeout + " seconds.");
536 String remoteVersion = null;
537 if (remoteBuildPropertiesUrl.startsWith("http"))
541 System.setProperty("sun.net.client.defaultConnectTimeout",
544 URL url = new URL(remoteBuildPropertiesUrl);
546 BufferedReader in = new BufferedReader(
547 new InputStreamReader(url.openStream()));
549 Properties remoteBuildProperties = new Properties();
550 remoteBuildProperties.load(in);
551 remoteVersion = remoteBuildProperties.getProperty("VERSION");
552 } catch (Exception ex)
555 "Non-fatal exception when checking version at "
556 + remoteBuildPropertiesUrl + ":");
557 System.out.println(ex);
558 remoteVersion = getProperty("VERSION");
561 System.setProperty("sun.net.client.defaultConnectTimeout",
564 setProperty("LATEST_VERSION", remoteVersion);
568 VersionChecker vc = new VersionChecker();
573 if (jnlpVersion != null)
575 setProperty("LATEST_VERSION", jnlpVersion);
579 applicationProperties.remove("LATEST_VERSION");
583 // LOAD USERDEFINED COLOURS
584 Cache.initUserColourSchemes(getProperty("USER_DEFINED_COLOURS"));
585 jalview.io.PIRFile.useModellerOutput = Cache.getDefault("PIR_MODELLER",
590 * construct a resource URL for the given absolute resource pathname
592 * @param resourcePath
595 private static String resolveResourceURLFor(String resourcePath)
598 if (Platform.isJS() || !Cache.class.getProtectionDomain()
599 .getCodeSource().getLocation().toString().endsWith(".jar"))
603 url = Cache.class.getResource(resourcePath).toString();
604 } catch (Exception ex)
606 System.err.println("Failed to resolve resource " + resourcePath
607 + ": " + ex.getMessage());
612 url = "jar:".concat(Cache.class.getProtectionDomain().getCodeSource()
613 .getLocation().toString().concat("!" + resourcePath));
618 public static void loadBuildProperties(boolean reportVersion)
620 String codeInstallation = getProperty("INSTALLATION");
621 boolean printVersion = codeInstallation == null;
624 * read build properties - from the Jalview jar for a Java distribution,
625 * or from codebase file in test or JalviewJS context
629 String buildDetails = resolveResourceURLFor("/.build_properties");
630 URL localJarFileURL = new URL(buildDetails);
631 InputStream in = localJarFileURL.openStream();
632 buildProperties.load(in);
634 if (buildProperties.getProperty("BUILD_DATE", null) != null)
636 applicationProperties.put("BUILD_DATE",
637 buildProperties.getProperty("BUILD_DATE"));
639 if (buildProperties.getProperty("INSTALLATION", null) != null)
641 applicationProperties.put("INSTALLATION",
642 buildProperties.getProperty("INSTALLATION"));
644 if (buildProperties.getProperty("VERSION", null) != null)
646 applicationProperties.put("VERSION",
647 buildProperties.getProperty("VERSION"));
649 if (buildProperties.getProperty("JAVA_COMPILE_VERSION", null) != null)
651 applicationProperties.put("JAVA_COMPILE_VERSION",
652 buildProperties.getProperty("JAVA_COMPILE_VERSION"));
654 } catch (Exception ex)
656 System.out.println("Error reading build details: " + ex);
657 applicationProperties.remove("VERSION");
659 String codeVersion = getProperty("VERSION");
660 codeInstallation = getProperty("INSTALLATION");
662 if (codeVersion == null)
664 // THIS SHOULD ONLY BE THE CASE WHEN TESTING!!
665 codeVersion = "Test";
666 codeInstallation = "";
670 codeInstallation = " (" + codeInstallation + ")";
672 setProperty("VERSION", codeVersion);
673 new BuildDetails(codeVersion, null, codeInstallation);
674 if (printVersion && reportVersion)
676 System.out.println(ChannelProperties.getProperty("app_name")
677 + " Version: " + codeVersion + codeInstallation);
681 private static void deleteBuildProperties()
683 applicationProperties.remove("LATEST_VERSION");
684 applicationProperties.remove("VERSION");
685 applicationProperties.remove("AUTHORS");
686 applicationProperties.remove("AUTHORFNAMES");
687 applicationProperties.remove("YEAR");
688 applicationProperties.remove("BUILD_DATE");
689 applicationProperties.remove("INSTALLATION");
693 * Gets Jalview application property of given key. Returns null if key not
699 * @return Property value
701 public static String getProperty(String key)
703 String prop = applicationProperties.getProperty(key);
704 if (prop == null && Platform.isJS())
706 prop = applicationProperties.getProperty(Platform.getUniqueAppletID()
707 + "_" + JS_PROPERTY_PREFIX + key);
713 * These methods are used when checking if the saved preference is different
714 * to the default setting
717 public static boolean getDefault(String property, boolean def)
719 String string = getProperty(property);
722 def = Boolean.valueOf(string).booleanValue();
728 public static int getDefault(String property, int def)
730 String string = getProperty(property);
735 def = Integer.parseInt(string);
736 } catch (NumberFormatException e)
738 System.out.println("Error parsing int property '" + property
739 + "' with value '" + string + "'");
747 * Answers the value of the given property, or the supplied default value if
748 * the property is not set
750 public static String getDefault(String property, String def)
752 String value = getProperty(property);
753 return value == null ? def : value;
757 * Stores property in the file "HOME_DIR/.jalview_properties"
762 * String value of property
764 * @return previous value of property (or null)
766 public static Object setProperty(String key, String obj)
768 Object oldValue = null;
771 oldValue = applicationProperties.setProperty(key, obj);
772 if (propertiesFile != null && !propsAreReadOnly)
774 FileOutputStream out = new FileOutputStream(propertiesFile);
775 applicationProperties.store(out, "---JalviewX Properties File---");
778 } catch (Exception ex)
781 "Error setting property: " + key + " " + obj + "\n" + ex);
787 * remove the specified property from the jalview properties file
791 public static void removeProperty(String string)
793 applicationProperties.remove(string);
798 * save the properties to the jalview properties path
800 public static void saveProperties()
802 if (!propsAreReadOnly)
806 FileOutputStream out = new FileOutputStream(propertiesFile);
807 applicationProperties.store(out, "---JalviewX Properties File---");
809 } catch (Exception ex)
811 System.out.println("Error saving properties: " + ex);
817 * internal vamsas class discovery state
819 private static int vamsasJarsArePresent = -1;
822 * Searches for vamsas client classes on class path.
824 * @return true if vamsas client is present on classpath
826 public static boolean vamsasJarsPresent()
828 if (vamsasJarsArePresent == -1)
832 if (jalview.jbgui.GDesktop.class.getClassLoader()
833 .loadClass("uk.ac.vamsas.client.VorbaId") != null)
836 "Found Vamsas Classes (uk.ac..vamsas.client.VorbaId can be loaded)");
837 vamsasJarsArePresent = 1;
838 JLoggerLog4j lvclient = JLoggerLog4j.getLogger("uk.ac.vamsas",
839 Console.getCachedLogLevel("logs.Vamsas.Level"));
840 JLoggerLog4j.addAppender(lvclient, Console.log,
841 JALVIEW_LOGGER_NAME);
842 // Tell the user that debug is enabled
843 lvclient.debug(ChannelProperties.getProperty("app_name")
844 + " Vamsas Client Debugging Output Follows.");
846 } catch (Exception e)
848 vamsasJarsArePresent = 0;
849 Console.debug("Vamsas Classes are not present");
852 return (vamsasJarsArePresent > 0);
856 * internal vamsas class discovery state
858 private static int groovyJarsArePresent = -1;
861 * Searches for vamsas client classes on class path.
863 * @return true if vamsas client is present on classpath
865 public static boolean groovyJarsPresent()
867 if (groovyJarsArePresent == -1)
871 if (Cache.class.getClassLoader()
872 .loadClass("groovy.lang.GroovyObject") != null)
875 "Found Groovy (groovy.lang.GroovyObject can be loaded)");
876 groovyJarsArePresent = 1;
877 JLoggerLog4j lgclient = JLoggerLog4j.getLogger("groovy",
878 Console.getCachedLogLevel("logs.Groovy.Level"));
879 JLoggerLog4j.addAppender(lgclient, Console.log,
880 JALVIEW_LOGGER_NAME);
881 // Tell the user that debug is enabled
882 lgclient.debug(ChannelProperties.getProperty("app_name")
883 + " Groovy Client Debugging Output Follows.");
887 groovyJarsArePresent = 0;
888 Console.debug("Groovy Classes are not present", e);
889 } catch (Exception e)
891 groovyJarsArePresent = 0;
892 Console.debug("Groovy Classes are not present");
895 return (groovyJarsArePresent > 0);
899 * GA tracker object - actually JGoogleAnalyticsTracker null if tracking not
902 protected static Object tracker = null;
904 protected static Class trackerfocus = null;
906 protected static Class jgoogleanalyticstracker = null;
909 * Initialise the google tracker if it is not done already.
911 public static void initGoogleTracker()
915 if (jgoogleanalyticstracker == null)
917 // try to get the tracker class
920 jgoogleanalyticstracker = Cache.class.getClassLoader().loadClass(
921 "com.boxysystems.jgoogleanalytics.JGoogleAnalyticsTracker");
922 trackerfocus = Cache.class.getClassLoader()
923 .loadClass("com.boxysystems.jgoogleanalytics.FocusPoint");
924 } catch (Exception e)
927 "com.boxysystems.jgoogleanalytics package is not present - tracking not enabled.");
929 jgoogleanalyticstracker = null;
934 // now initialise tracker
935 Exception re = null, ex = null;
937 String vrs = "No Version Accessible";
940 // Google analytics tracking code for Library Finder
941 tracker = jgoogleanalyticstracker
942 .getConstructor(new Class[]
943 { String.class, String.class, String.class })
944 .newInstance(new Object[]
945 { ChannelProperties.getProperty("app_name") + " Desktop",
946 (vrs = Cache.getProperty("VERSION") + "_"
947 + Cache.getDefault("BUILD_DATE", "unknown")),
949 jgoogleanalyticstracker
950 .getMethod("trackAsynchronously", new Class[]
952 .invoke(tracker, new Object[]
953 { trackerfocus.getConstructor(new Class[] { String.class })
954 .newInstance(new Object[]
955 { "Application Started." }) });
956 } catch (RuntimeException e)
959 } catch (Exception e)
966 if (re != null || ex != null || err != null)
970 Console.debug("Caught runtime exception in googletracker init:",
976 "Failed to initialise GoogleTracker for Jalview Desktop with version "
983 "Whilst initing GoogleTracker for Jalview Desktop version "
990 Console.debug("Successfully initialised tracker.");
996 * get the user's default colour if available
1002 public static Color getDefaultColour(String property, Color defcolour)
1004 String colprop = getProperty(property);
1005 if (colprop == null)
1009 Color col = ColorUtils.parseColourString(colprop);
1012 Console.warn("Couldn't parse '" + colprop + "' as a colour for "
1015 return (col == null) ? defcolour : col;
1019 * store a colour as a Jalview user default property
1024 public static void setColourProperty(String property, Color colour)
1026 setProperty(property, jalview.util.Format.getHexString(colour));
1030 * Stores a formatted date in a jalview property, using a fixed locale.
1032 * @param propertyName
1034 * @return the formatted date string
1036 public static String setDateProperty(String propertyName, Date date)
1038 String formatted = date_format.format(date);
1039 setProperty(propertyName, formatted);
1044 * Reads a date stored in a Jalview property, parses it (using a fixed locale
1045 * format) and returns as a Date, or null if parsing fails
1047 * @param propertyName
1051 public static Date getDateProperty(String propertyName)
1053 String val = getProperty(propertyName);
1058 return date_format.parse(val);
1059 } catch (Exception ex)
1061 System.err.println("Invalid or corrupt date in property '"
1062 + propertyName + "' : value was '" + val + "'");
1069 * get and parse a property as an integer. send any parsing problems to
1073 * @return null or Integer
1075 public static Integer getIntegerProperty(String property)
1077 String val = getProperty(property);
1078 if (val != null && (val = val.trim()).length() > 0)
1082 return Integer.valueOf(val);
1083 } catch (NumberFormatException x)
1085 System.err.println("Invalid integer in property '" + property
1086 + "' (value was '" + val + "')");
1093 * Set the specified value, or remove it if null or empty. Does not save the
1099 public static void setOrRemove(String propName, String value)
1101 if (propName == null)
1105 if (value == null || value.trim().length() < 1)
1107 Cache.applicationProperties.remove(propName);
1111 Cache.applicationProperties.setProperty(propName, value);
1116 * Loads in user colour schemes from files.
1119 * a '|'-delimited list of file paths
1121 public static void initUserColourSchemes(String files)
1123 if (files == null || files.length() == 0)
1128 // In case colours can't be loaded, we'll remove them
1129 // from the default list here.
1130 StringBuffer coloursFound = new StringBuffer();
1131 StringTokenizer st = new StringTokenizer(files, "|");
1132 while (st.hasMoreElements())
1134 String file = st.nextToken();
1137 UserColourScheme ucs = ColourSchemeLoader.loadColourScheme(file);
1140 if (coloursFound.length() > 0)
1142 coloursFound.append("|");
1144 coloursFound.append(file);
1145 ColourSchemes.getInstance().registerColourScheme(ucs);
1147 } catch (Exception ex)
1149 System.out.println("Error loading User ColourFile\n" + ex);
1152 if (!files.equals(coloursFound.toString()))
1154 if (coloursFound.toString().length() > 1)
1156 setProperty(UserDefinedColours.USER_DEFINED_COLOURS,
1157 coloursFound.toString());
1161 applicationProperties
1162 .remove(UserDefinedColours.USER_DEFINED_COLOURS);
1168 * Initial logging information helper for various versions output
1172 * @param defaultValue
1174 private static void appendIfNotNull(StringBuilder sb, String prefix,
1175 String value, String suffix, String defaultValue)
1177 if (value == null && defaultValue == null)
1183 sb.append(value == null ? defaultValue : value);
1190 * @return Jalview version, build details and JVM platform version for console
1192 public static String getVersionDetailsForConsole()
1194 StringBuilder sb = new StringBuilder();
1195 sb.append(ChannelProperties.getProperty("app_name"))
1196 .append(" Version: ");
1197 sb.append(Cache.getDefault("VERSION", "TEST"));
1199 sb.append(ChannelProperties.getProperty("app_name"))
1200 .append(" Installation: ");
1201 sb.append(Cache.getDefault("INSTALLATION", "unknown"));
1203 sb.append("Build Date: ");
1204 sb.append(Cache.getDefault("BUILD_DATE", "unknown"));
1206 sb.append("Java version: ");
1207 sb.append(System.getProperty("java.version"));
1209 sb.append("Java platform: ");
1210 sb.append(System.getProperty("os.arch"));
1212 sb.append(System.getProperty("os.name"));
1214 sb.append(System.getProperty("os.version"));
1216 appendIfNotNull(sb, "Install4j version: ",
1217 System.getProperty("sys.install4jVersion"), "\n", null);
1218 appendIfNotNull(sb, "Install4j template version: ",
1219 System.getProperty("installer_template_version"), "\n", null);
1220 appendIfNotNull(sb, "Launcher version: ",
1221 System.getProperty("launcher_version"), "\n", null);
1222 LookAndFeel laf = UIManager.getLookAndFeel();
1223 String lafName = laf == null ? "Not obtained" : laf.getName();
1224 String lafClass = laf == null ? "unknown" : laf.getClass().getName();
1225 sb.append("LookAndFeel: ");
1228 sb.append(lafClass);
1230 appendIfNotNull(sb, "Channel: ",
1231 ChannelProperties.getProperty("channel"), "\n", null);
1232 if (Console.isDebugEnabled()
1233 || !"release".equals(ChannelProperties.getProperty("channel")))
1235 appendIfNotNull(sb, "Getdown appdir: ",
1236 System.getProperty("getdowninstanceappdir"), "\n", null);
1237 appendIfNotNull(sb, "Getdown appbase: ",
1238 System.getProperty("getdowninstanceappbase"), "\n", null);
1239 appendIfNotNull(sb, "Java home: ", System.getProperty("java.home"),
1241 appendIfNotNull(sb, "Preferences file: ", propertiesFile, "\n",
1244 return sb.toString();
1249 * @return build details as reported in splashscreen
1251 public static String getBuildDetailsForSplash()
1253 // consider returning more human friendly info
1254 // eg 'built from Source' or update channel
1255 return Cache.getDefault("INSTALLATION", "unknown");
1258 public static String getStackTraceString(Throwable t)
1260 StringWriter sw = new StringWriter();
1261 PrintWriter pw = new PrintWriter(sw);
1262 t.printStackTrace(pw);
1263 return sw.toString();
1266 // proxy properties methods
1267 public static void clearProxyProperties()
1269 setProxyProperties(null, null, null, null, null, null, null, null,
1273 public static void resetProxyProperties()
1275 setProxyProperties(startupProxyProperties[0], startupProxyProperties[1],
1276 startupProxyProperties[2], startupProxyProperties[3],
1277 startupProxyProperties[4],
1278 startupProxyProperties[5] == null ? null
1279 : startupProxyProperties[5].toCharArray(),
1280 startupProxyProperties[6],
1281 startupProxyProperties[7] == null ? null
1282 : startupProxyProperties[7].toCharArray(),
1283 startupProxyProperties[8]);
1284 StringBuilder sb = new StringBuilder();
1285 sb.append("Setting proxy properties to: http.proxyHost=")
1286 .append(startupProxyProperties[0]).append(", http.proxyPort=")
1287 .append(startupProxyProperties[1])
1288 .append(startupProxyProperties[4] != null
1289 && !startupProxyProperties[4].isEmpty()
1290 ? " [" + startupProxyProperties[4] + "]"
1292 .append(", https.proxyHost=").append(startupProxyProperties[2])
1293 .append(", https.proxyPort=").append(startupProxyProperties[3])
1294 .append(startupProxyProperties[6] != null
1295 && !startupProxyProperties[6].isEmpty()
1296 ? " [" + startupProxyProperties[6] + "]"
1299 Console.debug(sb.toString());
1302 public static void setProxyPropertiesFromPreferences()
1304 setProxyPropertiesFromPreferences(Cache.PROXYTYPE_SYSTEM);
1307 public static void setProxyPropertiesFromPreferences(
1308 String previousProxyType)
1310 String proxyType = Cache.getDefault("USE_PROXY",
1311 Cache.PROXYTYPE_SYSTEM);
1312 if (previousProxyType != null
1313 && !proxyType.equals(Cache.PROXYTYPE_CUSTOM) // always apply
1315 && proxyType.equals(previousProxyType))
1322 case Cache.PROXYTYPE_NONE:
1323 if (!previousProxyType.equals(proxyType))
1325 Console.info("Setting no proxy settings");
1326 Cache.setProxyProperties(null, null, null, null, null, null, null,
1330 case Cache.PROXYTYPE_CUSTOM:
1331 // always re-set a custom proxy -- it might have changed, particularly
1333 Console.info("Setting custom proxy settings");
1334 boolean proxyAuthSet = Cache.getDefault("PROXY_AUTH", false);
1335 Cache.setProxyProperties(Cache.getDefault("PROXY_SERVER", null),
1336 Cache.getDefault("PROXY_PORT", null),
1337 Cache.getDefault("PROXY_SERVER_HTTPS", null),
1338 Cache.getDefault("PROXY_PORT_HTTPS", null),
1339 proxyAuthSet ? Cache.getDefault("PROXY_AUTH_USERNAME", "")
1341 proxyAuthSet ? Cache.proxyAuthPassword : null,
1342 proxyAuthSet ? Cache.getDefault("PROXY_AUTH_USERNAME", "")
1344 proxyAuthSet ? Cache.proxyAuthPassword : null, "localhost");
1346 default: // system proxy settings by default
1347 Console.info("Setting system proxy settings");
1348 Cache.resetProxyProperties();
1352 public static void setProxyProperties(String httpHost, String httpPort,
1353 String httpsHost, String httpsPort, String httpUser,
1354 char[] httpPassword, String httpsUser, char[] httpsPassword,
1355 String nonProxyHosts)
1357 setOrClearSystemProperty("http.proxyHost", httpHost);
1358 setOrClearSystemProperty("http.proxyPort", httpPort);
1359 setOrClearSystemProperty("https.proxyHost", httpsHost);
1360 setOrClearSystemProperty("https.proxyPort", httpsPort);
1361 setOrClearSystemProperty("http.proxyUser", httpUser);
1362 setOrClearSystemProperty("https.proxyUser", httpsUser);
1363 // note: passwords for http.proxyPassword and https.proxyPassword are sent
1364 // via the Authenticator, properties do not need to be set
1366 // are we using a custom proxy (password prompt might be required)?
1367 boolean customProxySet = getDefault("USE_PROXY", PROXYTYPE_SYSTEM)
1368 .equals(PROXYTYPE_CUSTOM);
1371 * A bug in Java means the AuthCache does not get reset, so once it has working credentials,
1372 * it never asks for more, so changing the Authenticator has no effect (as getPasswordAuthentication()
1373 * is not re-called).
1374 * This could lead to password leak to a hostile proxy server, so I'm putting in a hack to clear
1376 * see https://www.generacodice.com/en/articolo/154918/Reset-the-Authenticator-credentials
1378 * Turns out this is only accessible in Java 8, and not in Java 9 onwards, so commenting out
1383 sun.net.www.protocol.http.AuthCacheValue
1384 .setAuthCache(new sun.net.www.protocol.http.AuthCacheImpl());
1385 } catch (Throwable t)
1387 Cache.error(t.getMessage());
1388 Cache.debug(getStackTraceString(t));
1392 if (httpUser != null || httpsUser != null)
1396 char[] displayHttpPw = new char[httpPassword == null ? 0
1397 : httpPassword.length];
1398 Arrays.fill(displayHttpPw, '*');
1400 "CACHE Proxy: setting new Authenticator with httpUser='"
1401 + httpUser + "' httpPassword='" + displayHttpPw
1403 if (!Platform.isJS())
1405 * java.net.Authenticator not implemented in SwingJS yet
1411 Authenticator.setDefault(new Authenticator()
1414 protected PasswordAuthentication getPasswordAuthentication()
1416 if (getRequestorType() == RequestorType.PROXY)
1418 String protocol = getRequestingProtocol();
1419 boolean needProxyPasswordSet = false;
1420 if (customProxySet &&
1421 // we have a username but no password for the scheme being
1423 (protocol.equalsIgnoreCase("http")
1424 && (httpUser != null
1425 && httpUser.length() > 0
1426 && (httpPassword == null
1427 || httpPassword.length == 0)))
1428 || (protocol.equalsIgnoreCase("https")
1429 && (httpsUser != null
1430 && httpsUser.length() > 0
1431 && (httpsPassword == null
1432 || httpsPassword.length == 0))))
1434 // open Preferences -> Connections
1435 String message = MessageManager
1436 .getString("label.proxy_password_required");
1437 Preferences.openPreferences(
1438 Preferences.TabRef.CONNECTIONS_TAB, message);
1439 Preferences.getInstance()
1440 .proxyAuthPasswordCheckHighlight(true, true);
1446 if (protocol.equalsIgnoreCase("http")
1447 && getRequestingHost()
1448 .equalsIgnoreCase(httpHost)
1449 && getRequestingPort() == Integer
1453 "AUTHENTICATOR returning PasswordAuthentication(\""
1454 + httpUser + "\", '"
1455 + new String(displayHttpPw) + "')");
1456 return new PasswordAuthentication(httpUser,
1459 if (protocol.equalsIgnoreCase("https")
1460 && getRequestingHost()
1461 .equalsIgnoreCase(httpsHost)
1462 && getRequestingPort() == Integer
1463 .valueOf(httpsPort))
1465 char[] displayHttpsPw = new char[httpPassword.length];
1466 Arrays.fill(displayHttpsPw, '*');
1468 "AUTHENTICATOR returning PasswordAuthentication(\""
1469 + httpsUser + "\", '" + displayHttpsPw
1471 return new PasswordAuthentication(httpsUser,
1474 } catch (NumberFormatException e)
1476 Console.error("Problem with proxy port values [http:"
1477 + httpPort + ", https:" + httpsPort + "]");
1480 "AUTHENTICATOR after trying to get PasswordAuthentication");
1483 // non proxy request
1484 Console.debug("AUTHENTICATOR returning null");
1488 } // end of j2sIgnore for java.net.Authenticator
1490 // required to re-enable basic authentication (should be okay for a
1493 "AUTHENTICATOR setting property 'jdk.http.auth.tunneling.disabledSchemes' to \"\"");
1494 System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");
1495 } catch (SecurityException e)
1497 Console.error("Could not set default Authenticator");
1498 Console.debug(getStackTraceString(e));
1503 // reset the Authenticator to protect http.proxyUser and
1504 // http.proxyPassword Just In Case
1505 /* as noted above, due to bug in java this doesn't work if the sun.net.www.protocol.http.AuthCache
1506 * has working credentials. No workaround for Java 11.
1508 if (!Platform.isJS())
1510 * java.net.Authenticator not implemented in SwingJS yet
1517 "AUTHENTICATOR setting default Authenticator to null");
1518 Authenticator.setDefault(null);
1522 // nonProxyHosts not currently configurable in Preferences
1524 "AUTHENTICATOR setting property 'http.nonProxyHosts' to \""
1525 + nonProxyHosts + "\"");
1526 setOrClearSystemProperty("http.nonProxyHosts", nonProxyHosts);
1529 public static void setOrClearSystemProperty(String key, char[] value)
1531 setOrClearSystemProperty(key,
1532 (value == null) ? null : new String(value));
1535 public static void setOrClearSystemProperty(String key, String value)
1543 System.clearProperty(key);
1547 System.setProperty(key, value);
1552 * Getdown appbase methods
1555 private static final String releaseAppbase;
1557 private static String getdownAppbase;
1559 private static String getdownDistDir;
1563 if (!Platform.isJS())
1565 Float specversion = Float
1566 .parseFloat(System.getProperty("java.specification.version"));
1567 releaseAppbase = (specversion < 9)
1568 ? "https://www.jalview.org/getdown/release/1.8"
1569 : "https://www.jalview.org/getdown/release/11";
1573 // this value currenly made up, can be changed to URL that will be
1574 // "https://www.jalview.org/jalview-js/swingjs/j2s/build_properties"
1575 releaseAppbase = "https://www.jalview.org/jalview-js";
1576 getdownAppbase = releaseAppbase;
1577 getdownDistDir = "/swingjs/j2s";
1581 // look for properties (passed in by getdown) otherwise default to release
1582 private static void setGetdownAppbase()
1584 if (getdownAppbase != null)
1588 String appbase = System.getProperty("getdownappbase");
1589 String distDir = System.getProperty("getdowndistdir");
1590 if (appbase == null)
1592 appbase = buildProperties.getProperty("GETDOWNAPPBASE");
1593 distDir = buildProperties.getProperty("GETDOWNAPPDISTDIR");
1595 if (appbase == null)
1597 appbase = releaseAppbase;
1598 distDir = "release";
1600 if (appbase.endsWith("/"))
1602 appbase = appbase.substring(0, appbase.length() - 1);
1604 if (distDir == null)
1606 distDir = appbase.equals(releaseAppbase) ? "release" : "alt";
1608 getdownAppbase = appbase;
1609 getdownDistDir = distDir;
1612 public static String getGetdownAppbase()
1614 setGetdownAppbase();
1615 return getdownAppbase;
1618 public static String getAppbaseBuildProperties()
1620 String appbase = getGetdownAppbase();
1621 return appbase + "/" + getdownDistDir + "/build_properties";
1624 private static final Collection<String> bootstrapProperties = new ArrayList<>(
1625 Arrays.asList(JALVIEWLOGLEVEL));
1627 public static Properties bootstrapProperties(String filename)
1629 Properties bootstrapProps = new Properties();
1631 if (filename != null)
1633 file = new File(filename);
1635 if (file == null || !file.exists())
1637 String channelPrefsFilename = ChannelProperties
1638 .getProperty("preferences.filename");
1639 String propertiesFilename = System.getProperty("user.home")
1640 + File.separatorChar + channelPrefsFilename;
1641 file = new File(propertiesFilename);
1643 if (file == null || !file.exists())
1645 String releasePrefsFilename = fallbackPropertiesFile;
1646 String releasePropertiesFilename = System.getProperty("user.home")
1647 + File.separatorChar + releasePrefsFilename;
1648 file = new File(releasePropertiesFilename);
1651 if (filename == null || !file.exists())
1653 System.err.println("Could not load bootstrap preferences file '"
1660 FileInputStream in = new FileInputStream(file.getAbsoluteFile());
1661 Properties props = new Properties();
1663 for (String prop : bootstrapProperties)
1665 if (props.containsKey(prop))
1666 bootstrapProps.put(prop, props.getProperty(prop));
1668 } catch (FileNotFoundException e)
1670 System.err.println("Could not find bootstrap preferences file '"
1671 + file.getAbsolutePath() + "'");
1672 } catch (IOException e)
1675 "IOException when loading bootstrap preferences file '"
1676 + file.getAbsolutePath() + "'");
1678 return bootstrapProps;