From: Felix Dörre Date: Thu, 11 Sep 2014 20:39:38 +0000 (+0200) Subject: FIX: syncing issues for Language initialisation. X-Git-Url: https://code.wpia.club/?p=gigi.git;a=commitdiff_plain;h=dc30aa8985c573b89ec42b45355f1b556290daee FIX: syncing issues for Language initialisation. --- diff --git a/src/org/cacert/gigi/localisation/Language.java b/src/org/cacert/gigi/localisation/Language.java index 5e11f09c..4c6e3901 100644 --- a/src/org/cacert/gigi/localisation/Language.java +++ b/src/org/cacert/gigi/localisation/Language.java @@ -111,15 +111,21 @@ public class Language { } Language lang = langs.get(locale.toString()); if (lang == null) { - try { - lang = new Language(locale); - langs.put(locale.toString(), lang); - } catch (ParserConfigurationException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (SAXException e) { - e.printStackTrace(); + synchronized (Language.class) { + lang = langs.get(locale.toString()); + if (lang != null) { + return lang; + } + try { + lang = new Language(locale); + langs.put(locale.toString(), lang); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (SAXException e) { + e.printStackTrace(); + } } } return lang;