changeset 974:2fb53eb9df14

6801467: Defer get the launcher resource bundle until it's needed Summary: Lazily initialize the launcher resource bundle Reviewed-by: ksrini, darcy
author mchung
date Thu, 26 Feb 2009 14:36:51 -0800
parents dde3fe2e8164
children 4f0b6455a977
files src/share/classes/sun/launcher/LauncherHelper.java
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/launcher/LauncherHelper.java	Wed Feb 25 14:32:01 2009 +0000
+++ b/src/share/classes/sun/launcher/LauncherHelper.java	Thu Feb 26 14:36:51 2009 -0800
@@ -1,6 +1,5 @@
-
 /*
- * Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2007-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,18 +54,24 @@
     INSTANCE;
     private static final String defaultBundleName =
             "sun.launcher.resources.launcher";
-    private static ResourceBundle javarb =
-            ResourceBundle.getBundle(defaultBundleName);
     private static final String MAIN_CLASS = "Main-Class";
 
     private static StringBuilder outBuf = new StringBuilder();
 
+    private static ResourceBundle javarb = null;
+    private static synchronized ResourceBundle getLauncherResourceBundle() {
+        if (javarb == null) {
+            javarb = ResourceBundle.getBundle(defaultBundleName);
+        }
+        return javarb;
+    }
+
     /**
      * A private helper method to get a localized message and also
      * apply any arguments that we might pass.
      */
     private static String getLocalizedMessage(String key, Object... args) {
-        String msg = javarb.getString(key);
+        String msg = getLauncherResourceBundle().getString(key);
         return (args != null) ? MessageFormat.format(msg, args) : msg;
     }