imported properties via -props should never be overwritten
[jalview.git] / src / jalview / bin / Cache.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
3  * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
4  * 
5  * This file is part of Jalview.
6  * 
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 of the License, or (at your option) any later version.
10  * 
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 package jalview.bin;
19
20 import java.io.*;
21 import java.util.*;
22
23 import org.apache.log4j.*;
24 import org.biojava.dasobert.dasregistry.Das1Source;
25
26 /**
27  * Stores and retrieves Jalview Application Properties Lists and fields within
28  * list entries are separated by '|' symbols unless otherwise stated (|) clauses
29  * are alternative values for a tag. <br>
30  * <br>
31  * Current properties include:
32  * <ul>
33  * <br>
34  * logs.Axis.Level - one of the stringified Levels for log4j controlling the
35  * logging level for axis (used for web services) <br>
36  * </li>
37  * <li>logs.Castor.Level - one of the stringified Levels for log4j controlling
38  * the logging level for castor (used for serialization) <br>
39  * </li>
40  * <li>logs.Jalview.Level - Cache.log stringified level. <br>
41  * </li>
42  * <li>DISCOVERY_START - Boolean - controls if discovery services are queried on
43  * startup</li>
44  * <li>DISCOVERY_URLS - comma separated list of Discovery Service endpoints.</li>
45  * <li>SCREEN_WIDTH</li>
46  * <li>SCREEN_HEIGHT</li>
47  * <li>SCREEN_Y=285</li>
48  * <li>SCREEN_X=371</li>
49  * <li>SHOW_FULLSCREEN boolean</li>
50  * <li>FONT_NAME java font name for alignment text display</li>
51  * <li>FONT_SIZE size of displayed alignment text</li>
52  * <li>FONT_STYLE style of font displayed (sequence labels are always italic)</li>
53  * <li>GAP_SYMBOL character to treat as gap symbol (usually -,.,' ')</li>
54  * <li>LAST_DIRECTORY last directory for browsing alignment</li>
55  * <li>USER_DEFINED_COLOURS list of user defined colour scheme files</li>
56  * <li>SHOW_FULL_ID show id with '/start-end' numbers appended</li>
57  * <li>SHOW_IDENTITY show percentage identity annotation</li>
58  * <li>SHOW_QUALITY show alignment quality annotation</li>
59  * <li>SHOW_ANNOTATIONS show alignment annotation rows</li>
60  * <li>SHOW_CONSERVATION show alignment conservation annotation</li>
61  * <li>CENTRE_COLUMN_LABELS centre the labels at each column in a displayed
62  * annotation row</li>
63  * <li>DEFAULT_COLOUR default colour scheme to apply for a new alignment</li>
64  * <li>DEFAULT_FILE_FORMAT file format used to save</li>
65  * <li>STARTUP_FILE file loaded on startup (may be a fully qualified url)</li>
66  * <li>SHOW_STARTUP_FILE flag to control loading of startup file</li>
67  * <li>VERSION the version of the jalview build</li>
68  * <li>BUILD_DATE date of this build</li>
69  * <li>LATEST_VERSION the latest jalview version advertised on the
70  * www.jalview.org</li>
71  * <li>PIR_MODELLER boolean indicating if PIR files are written with MODELLER
72  * descriptions</li>
73  * <li>(FASTA,MSF,PILEUP,CLUSTAL,BLC,PIR,PFAM)_JVSUFFIX boolean for adding jv
74  * suffix to file</li>
75  * <li>RECENT_URL list of recently retrieved URLs</li>
76  * <li>RECENT_FILE list of recently opened files</li>
77  * <li>USE_PROXY flag for whether a http proxy is to be used</li>
78  * <li>PROXY_SERVER the proxy</li>
79  * <li>PROXY_PORT</li>
80  * <li>NOQUESTIONNAIRES true to prevent jalview from checking the questionnaire
81  * service</li>
82  * <li>QUESTIONNAIRE last questionnaire:responder id string from questionnaire
83  * service</li>
84  * <li>USAGESTATS (false - user prompted) Enable google analytics tracker for
85  * collecting usage statistics</li>
86  * <li>DAS_LOCAL_SOURCE list of local das sources</li>
87  * <li>SHOW_OVERVIEW boolean for overview window display</li>
88  * <li>ANTI_ALIAS boolean for smooth fonts</li>
89  * <li>RIGHT_ALIGN_IDS boolean</li>
90  * <li>AUTO_CALC_CONSENSUS boolean for automatic recalculation of consensus</li>
91  * <li>PAD_GAPS boolean</li>
92  * <li>ID_ITALICS boolean</li>
93  * <li>SHOW_JV_SUFFIX</li>
94  * <li>WRAP_ALIGNMENT</li>
95  * <li>EPS_RENDERING (Prompt each time|Lineart|Text) default for EPS rendering
96  * style check</li>
97  * <li>SORT_ALIGNMENT (No sort|Id|Pairwise Identity)</li>
98  * <li>SEQUENCE_LINKS list of name|URL pairs for opening a url with
99  * $SEQUENCE_ID$</li>
100  * <li>GROUP_LINKS list of name|URL[|&lt;separator&gt;] tuples - see
101  * jalview.utils.GroupURLLink for more info</li>
102  * <li>DAS_REGISTRY_URL the registry to query</li>
103  * <li>DEFAULT_BROWSER for unix</li>
104  * <li>DAS_ACTIVE_SOURCE list of active sources</li>
105  * <li>SHOW_MEMUSAGE boolean show memory usage and warning indicator on desktop
106  * (false)</li>
107  * <li>VERSION_CHECK (true) check for the latest release version from
108  * www.jalview.org</li>
109  * <li>SHOW_NPFEATS_TOOLTIP (true) show non-positional features in the Sequence
110  * ID tooltip</li>
111  * <li>SHOW_DBREFS_TOOLTIP (true) show Database Cross References in the Sequence
112  * ID tooltip</li>
113  * <li>SHOW_UNCONSERVED (false) only render unconserved residues - conserved
114  * displayed as '.'</li>
115  * <li>SORT_BY_TREE (false) sort the current alignment view according to the
116  * order of a newly displayed tree</li>
117  * <li>DBFETCH_USEPICR (false) use PICR to recover valid DB references from
118  * sequence ID strings before attempting retrieval from any datasource</li>
119  * <li>SHOW_GROUP_CONSENSUS (false) Show consensus annotation for groups in the
120  * alignment.</li>
121  * <li>SHOW_GROUP_CONSERVATION (false) Show conservation annotation for groups
122  * in the alignment.</li>
123  * <li>SHOW_CONSENSUS_HISTOGRAM (false) Show consensus annotation row's
124  * histogram.</li>
125  * <li>SHOW_CONSENSUS_LOGO (false) Show consensus annotation row's sequence
126  * logo.</li>
127  * <li>FOLLOW_SELECTIONS (true) Controls whether a new alignment view should
128  * respond to selections made in other alignments containing the same sequences.
129  * </li>
130  * <li>SHOW_WSDISCOVERY_ERRORS (true) Controls if the web service URL discovery
131  * warning dialog box is displayed.</li>
132  * 
133  * <li></li>
134  * 
135  * <li></li>
136  * 
137  * </ul>
138  * 
139  * @author $author$
140  * @version $Revision$
141  */
142 public class Cache
143 {
144   /**
145    * property giving log4j level for CASTOR loggers
146    */
147   public static final String CASTORLOGLEVEL = "logs.Castor.level";
148
149   /**
150    * property giving log4j level for AXIS loggers
151    */
152   public static final String AXISLOGLEVEL = "logs.Axis.level";
153
154   /**
155    * property giving log4j level for Jalview Log
156    */
157   public static final String JALVIEWLOGLEVEL = "logs.Jalview.level";
158
159   public static final String DAS_LOCAL_SOURCE = "DAS_LOCAL_SOURCE";
160
161   public static final String DAS_REGISTRY_URL = "DAS_REGISTRY_URL";
162
163   public static final String DAS_ACTIVE_SOURCE = "DAS_ACTIVE_SOURCE";
164
165   /**
166    * Initialises the Jalview Application Log
167    */
168   public static Logger log;
169
170   /** Jalview Properties */
171   public static Properties applicationProperties = new Properties();
172
173   /** Default file is ~/.jalview_properties */
174   static String propertiesFile;
175
176   private static boolean propsAreReadOnly=false;
177
178   public static void initLogger()
179   {
180     if (log != null)
181     {
182       return;
183     }
184     try
185     {
186       // TODO: redirect stdout and stderr here in order to grab the output of
187       // the log
188
189       ConsoleAppender ap = new ConsoleAppender(new SimpleLayout(),
190               "System.err");
191       ap.setName("JalviewLogger");
192       org.apache.log4j.Logger.getRootLogger().addAppender(ap); // catch all for
193       // log output
194       Logger laxis = Logger.getLogger("org.apache.axis");
195       Logger lcastor = Logger.getLogger("org.exolab.castor");
196       jalview.bin.Cache.log = Logger.getLogger("jalview.bin.Jalview");
197
198       laxis.setLevel(Level.toLevel(Cache.getDefault("logs.Axis.Level",
199               Level.INFO.toString())));
200       lcastor.setLevel(Level.toLevel(Cache.getDefault("logs.Castor.Level",
201               Level.INFO.toString())));
202       lcastor = Logger.getLogger("org.exolab.castor.xml");
203       lcastor.setLevel(Level.toLevel(Cache.getDefault("logs.Castor.Level",
204               Level.INFO.toString())));
205       // lcastor = Logger.getLogger("org.exolab.castor.xml.Marshaller");
206       // lcastor.setLevel(Level.toLevel(Cache.getDefault("logs.Castor.Level",
207       // Level.INFO.toString())));
208       jalview.bin.Cache.log.setLevel(Level.toLevel(Cache.getDefault(
209               "logs.Jalview.level", Level.INFO.toString())));
210       // laxis.addAppender(ap);
211       // lcastor.addAppender(ap);
212       // jalview.bin.Cache.log.addAppender(ap);
213       // Tell the user that debug is enabled
214       jalview.bin.Cache.log.debug("Jalview Debugging Output Follows.");
215     } catch (Exception ex)
216     {
217       System.err.println("Problems initializing the log4j system\n");
218       ex.printStackTrace(System.err);
219     }
220   }
221
222   /** Called when Jalview is started */
223   public static void loadProperties(String propsFile)
224   {
225     propertiesFile = propsFile;
226     if (propsFile == null)
227     {
228       propertiesFile = System.getProperty("user.home") + File.separatorChar
229               + ".jalview_properties";
230     } else {
231       // don't corrupt the file we've been given.
232       propsAreReadOnly = true;
233     }
234
235     try
236     {
237       InputStream fis;
238       try
239       {
240         fis = new java.net.URL(propertiesFile).openStream();
241         System.out.println("Loading jalview properties from : "
242                 + propertiesFile);
243         System.out
244                 .println("Disabling Jalview writing to user's local properties file.");
245         propsAreReadOnly = true;
246
247       } catch (Exception ex)
248       {
249         fis = null;
250       }
251       if (fis == null)
252       {
253         fis = new FileInputStream(propertiesFile);
254       }
255       applicationProperties.load(fis);
256       applicationProperties.remove("LATEST_VERSION");
257       applicationProperties.remove("VERSION");
258       fis.close();
259     } catch (Exception ex)
260     {
261       System.out.println("Error reading properties file: " + ex);
262     }
263
264     if (getDefault("USE_PROXY", false))
265     {
266       System.out.println("Using proxyServer: "
267               + getDefault("PROXY_SERVER", null) + " proxyPort: "
268               + getDefault("PROXY_PORT", null));
269       System.setProperty("http.proxyHost", getDefault("PROXY_SERVER", null));
270       System.setProperty("http.proxyPort", getDefault("PROXY_PORT", null));
271     }
272
273     // FIND THE VERSION NUMBER AND BUILD DATE FROM jalview.jar
274     // MUST FOLLOW READING OF LOCAL PROPERTIES FILE AS THE
275     // VERSION MAY HAVE CHANGED SINCE LAST USING JALVIEW
276     try
277     {
278       String buildDetails = "jar:".concat(Cache.class.getProtectionDomain()
279               .getCodeSource().getLocation().toString()
280               .concat("!/.build_properties"));
281
282       java.net.URL localJarFileURL = new java.net.URL(buildDetails);
283
284       InputStream in = localJarFileURL.openStream();
285       applicationProperties.load(in);
286       in.close();
287     } catch (Exception ex)
288     {
289       System.out.println("Error reading build details: " + ex);
290       applicationProperties.remove("VERSION");
291     }
292
293     String jnlpVersion = System.getProperty("jalview.version");
294     String codeVersion = getProperty("VERSION");
295
296     if (codeVersion == null)
297     {
298       // THIS SHOULD ONLY BE THE CASE WHEN TESTING!!
299       codeVersion = "Test";
300       jnlpVersion = "Test";
301     }
302
303     System.out.println("Jalview Version: " + codeVersion);
304
305     // jnlpVersion will be null if we're using InstallAnywhere
306     // Dont do this check if running in headless mode
307     if (jnlpVersion == null
308             && getDefault("VERSION_CHECK", true)
309             && (System.getProperty("java.awt.headless") == null || System
310                     .getProperty("java.awt.headless").equals("false")))
311     {
312
313       class VersionChecker extends Thread
314       {
315         public void run()
316         {
317           String orgtimeout = System
318                   .getProperty("sun.net.client.defaultConnectTimeout");
319           if (orgtimeout == null)
320           {
321             orgtimeout = "30";
322             System.out.println("# INFO: Setting default net timeout to "
323                     + orgtimeout + " seconds.");
324           }
325           String jnlpVersion = null;
326           try
327           {
328             System.setProperty("sun.net.client.defaultConnectTimeout",
329                     "5000");
330             java.net.URL url = new java.net.URL(
331                     "http://www.jalview.org/webstart/jalview.jnlp");
332             BufferedReader in = new BufferedReader(new InputStreamReader(
333                     url.openStream()));
334             String line = null;
335             while ((line = in.readLine()) != null)
336             {
337               if (line.indexOf("jalview.version") == -1)
338               {
339                 continue;
340               }
341
342               line = line.substring(line.indexOf("value=") + 7);
343               line = line.substring(0, line.lastIndexOf("\""));
344               jnlpVersion = line;
345               break;
346             }
347           } catch (Exception ex)
348           {
349             System.out
350                     .println("Non-fatal exceptions when checking version at www.jalview.org :");
351             System.out.println(ex);
352             jnlpVersion = getProperty("VERSION");
353           }
354           System.setProperty("sun.net.client.defaultConnectTimeout",
355                   orgtimeout);
356
357           setProperty("LATEST_VERSION", jnlpVersion);
358         }
359       }
360
361       VersionChecker vc = new VersionChecker();
362       vc.start();
363     }
364     else
365     {
366       if (jnlpVersion != null)
367       {
368         setProperty("LATEST_VERSION", jnlpVersion);
369       }
370       else
371       {
372         applicationProperties.remove("LATEST_VERSION");
373       }
374     }
375
376     setProperty("VERSION", codeVersion);
377
378     // LOAD USERDEFINED COLOURS
379     jalview.gui.UserDefinedColours
380             .initUserColourSchemes(getProperty("USER_DEFINED_COLOURS"));
381     jalview.io.PIRFile.useModellerOutput = Cache.getDefault("PIR_MODELLER",
382             false);
383   }
384
385   /**
386    * Gets Jalview application property of given key. Returns null if key not
387    * found
388    * 
389    * @param key
390    *          Name of property
391    * 
392    * @return Property value
393    */
394   public static String getProperty(String key)
395   {
396     return applicationProperties.getProperty(key);
397   }
398
399   /**
400    * These methods are used when checking if the saved preference is different
401    * to the default setting
402    */
403
404   public static boolean getDefault(String property, boolean def)
405   {
406     String string = getProperty(property);
407     if (string != null)
408     {
409       def = Boolean.valueOf(string).booleanValue();
410     }
411
412     return def;
413   }
414
415   /**
416    * These methods are used when checking if the saved preference is different
417    * to the default setting
418    */
419   public static String getDefault(String property, String def)
420   {
421     String string = getProperty(property);
422     if (string != null)
423     {
424       return string;
425     }
426
427     return def;
428   }
429
430   /**
431    * Stores property in the file "HOME_DIR/.jalview_properties"
432    * 
433    * @param key
434    *          Name of object
435    * @param obj
436    *          String value of property
437    * 
438    * @return String value of property
439    */
440   public static String setProperty(String key, String obj)
441   {
442
443     try
444     {
445       applicationProperties.setProperty(key, obj);
446       if (!propsAreReadOnly)
447       {
448         FileOutputStream out = new FileOutputStream(propertiesFile);
449         applicationProperties.store(out, "---JalviewX Properties File---");
450         out.close();
451       }
452     } catch (Exception ex)
453     {
454       System.out.println("Error setting property: " + key + " " + obj
455               + "\n" + ex);
456     }
457     return obj;
458   }
459
460   /**
461    * remove the specified property from the jalview properties file
462    * 
463    * @param string
464    */
465   public static void removeProperty(String string)
466   {
467     applicationProperties.remove(string);
468     saveProperties();
469   }
470
471   /**
472    * save the properties to the jalview properties path
473    */
474   public static void saveProperties()
475   {
476     if (!propsAreReadOnly)
477     {
478       try
479       {
480         FileOutputStream out = new FileOutputStream(propertiesFile);
481         applicationProperties.store(out, "---JalviewX Properties File---");
482         out.close();
483       } catch (Exception ex)
484       {
485         System.out.println("Error saving properties: " + ex);
486       }
487     }
488   }
489
490   /**
491    * internal vamsas class discovery state
492    */
493   private static int vamsasJarsArePresent = -1;
494
495   /**
496    * Searches for vamsas client classes on class path.
497    * 
498    * @return true if vamsas client is present on classpath
499    */
500   public static boolean vamsasJarsPresent()
501   {
502     if (vamsasJarsArePresent == -1)
503     {
504       try
505       {
506         if (jalview.jbgui.GDesktop.class.getClassLoader().loadClass(
507                 "uk.ac.vamsas.client.VorbaId") != null)
508         {
509           jalview.bin.Cache.log
510                   .debug("Found Vamsas Classes (uk.ac..vamsas.client.VorbaId can be loaded)");
511           vamsasJarsArePresent = 1;
512           Logger lvclient = Logger.getLogger("uk.ac.vamsas");
513           lvclient.setLevel(Level.toLevel(Cache.getDefault(
514                   "logs.Vamsas.Level", Level.INFO.toString())));
515
516           lvclient.addAppender(log.getAppender("JalviewLogger"));
517           // Tell the user that debug is enabled
518           lvclient.debug("Jalview Vamsas Client Debugging Output Follows.");
519         }
520       } catch (Exception e)
521       {
522         vamsasJarsArePresent = 0;
523         jalview.bin.Cache.log.debug("Vamsas Classes are not present");
524       }
525     }
526     return (vamsasJarsArePresent > 0);
527   }
528
529   /**
530    * internal vamsas class discovery state
531    */
532   private static int groovyJarsArePresent = -1;
533
534   /**
535    * Searches for vamsas client classes on class path.
536    * 
537    * @return true if vamsas client is present on classpath
538    */
539   public static boolean groovyJarsPresent()
540   {
541     if (groovyJarsArePresent == -1)
542     {
543       try
544       {
545         if (Cache.class.getClassLoader().loadClass(
546                 "groovy.lang.GroovyObject") != null)
547         {
548           jalview.bin.Cache.log
549                   .debug("Found Groovy (groovy.lang.GroovyObject can be loaded)");
550           groovyJarsArePresent = 1;
551           Logger lgclient = Logger.getLogger("groovy");
552           lgclient.setLevel(Level.toLevel(Cache.getDefault(
553                   "logs.Groovy.Level", Level.INFO.toString())));
554
555           lgclient.addAppender(log.getAppender("JalviewLogger"));
556           // Tell the user that debug is enabled
557           lgclient.debug("Jalview Groovy Client Debugging Output Follows.");
558         }
559       } catch (Error e)
560       {
561         groovyJarsArePresent = 0;
562         jalview.bin.Cache.log.debug("Groovy Classes are not present", e);
563       } catch (Exception e)
564       {
565         groovyJarsArePresent = 0;
566         jalview.bin.Cache.log.debug("Groovy Classes are not present");
567       }
568     }
569     return (groovyJarsArePresent > 0);
570   }
571
572   /**
573    * generate Das1Sources from the local das source list
574    * 
575    * @return Vector of Das1Sources
576    */
577   public static Vector getLocalDasSources()
578   {
579     Vector localSources = new Vector();
580     String local = jalview.bin.Cache.getProperty("DAS_LOCAL_SOURCE");
581     if (local != null)
582     {
583       StringTokenizer st = new StringTokenizer(local, "\t");
584       while (st.hasMoreTokens())
585       {
586         String token = st.nextToken();
587         int bar = token.indexOf("|");
588         Das1Source source = new Das1Source();
589         source.setUrl(token.substring(bar + 1));
590         if (source.getUrl().startsWith("sequence:"))
591         {
592           source.setUrl(source.getUrl().substring(9));
593           // this source also serves sequences as well as features
594           source.setCapabilities(new String[]
595           { "sequence", "features" });
596         }
597         else
598         {
599           // default is that all user added sources serve features
600           source.setCapabilities(new String[]
601           { "features" });
602         }
603
604         source.setNickname(token.substring(0, bar));
605
606         localSources.addElement(source);
607       }
608     }
609     return localSources;
610   }
611
612   /**
613    * GA tracker object - actually JGoogleAnalyticsTracker null if tracking not
614    * enabled.
615    */
616   protected static Object tracker = null;
617
618   protected static Class trackerfocus = null;
619
620   protected static Class jgoogleanalyticstracker = null;
621
622   /**
623    * Initialise the google tracker if it is not done already.
624    */
625   public static void initGoogleTracker()
626   {
627     if (tracker == null)
628     {
629       if (jgoogleanalyticstracker == null)
630       {
631         // try to get the tracker class
632         try
633         {
634           jgoogleanalyticstracker = Cache.class
635                   .getClassLoader()
636                   .loadClass(
637                           "com.boxysystems.jgoogleanalytics.JGoogleAnalyticsTracker");
638           trackerfocus = Cache.class.getClassLoader().loadClass(
639                   "com.boxysystems.jgoogleanalytics.FocusPoint");
640         } catch (Exception e)
641         {
642           log.debug("com.boxysystems.jgoogleanalytics package is not present - tracking not enabled.");
643           tracker = null;
644           jgoogleanalyticstracker = null;
645           trackerfocus = null;
646           return;
647         }
648       }
649       // now initialise tracker
650       Exception re = null, ex = null;
651       Error err = null;
652       String vrs = "No Version Accessible";
653       try
654       {
655         // Google analytics tracking code for Library Finder
656         tracker = jgoogleanalyticstracker.getConstructor(new Class[]
657         { String.class, String.class, String.class }).newInstance(
658                 new Object[]
659                 {
660                     "Jalview Desktop",
661                     (vrs = jalview.bin.Cache.getProperty("VERSION")
662                             + "_"
663                             + jalview.bin.Cache.getDefault("BUILD_DATE",
664                                     "unknown")), "UA-9060947-1" });
665         jgoogleanalyticstracker.getMethod("trackAsynchronously",
666                 new Class[]
667                 { trackerfocus }).invoke(tracker, new Object[]
668         { trackerfocus.getConstructor(new Class[]
669         { String.class }).newInstance(new Object[]
670         { "Application Started." }) });
671       } catch (RuntimeException e)
672       {
673         re = e;
674       } catch (Exception e)
675       {
676         ex = e;
677       } catch (Error e)
678       {
679         err = e;
680       }
681       if (re != null || ex != null || err != null)
682       {
683         if (log != null)
684         {
685           if (re != null)
686             log.debug("Caught runtime exception in googletracker init:", re);
687           if (ex != null)
688             log.warn(
689                     "Failed to initialise GoogleTracker for Jalview Desktop with version "
690                             + vrs, ex);
691           if (err != null)
692             log.error(
693                     "Whilst initing GoogleTracker for Jalview Desktop version "
694                             + vrs, err);
695         }
696         else
697         {
698           if (re != null)
699           {
700             System.err
701                     .println("Debug: Caught runtime exception in googletracker init:"
702                             + vrs);
703             re.printStackTrace();
704           }
705           if (ex != null)
706           {
707             System.err
708                     .println("Warning:  Failed to initialise GoogleTracker for Jalview Desktop with version "
709                             + vrs);
710             ex.printStackTrace();
711           }
712
713           if (err != null)
714           {
715             System.err
716                     .println("ERROR: Whilst initing GoogleTracker for Jalview Desktop version "
717                             + vrs);
718             err.printStackTrace();
719           }
720         }
721       }
722       else
723       {
724         log.debug("Successfully initialised tracker.");
725       }
726     }
727   }
728
729 }