@@ -79,11 +79,12 @@ public class Level implements java.io.Serializable {
7979 /**
8080 * @serial The resource bundle name to be used in localizing the level name.
8181 */
82- private final String resourceBundleName ;
82+ // private final String resourceBundleName;
8383
8484 // localized level name
85- private transient String localizedLevelName ;
86- private transient Locale cachedLocale ;
85+ // SwingJS -- not worth the trouble or extra file loading
86+ // private transient String localizedLevelName;
87+ // private transient Locale cachedLocale;
8788
8889 /**
8990 * OFF is a special level that can be used to turn off logging.
@@ -215,9 +216,9 @@ private Level(String name, int value, String resourceBundleName, boolean visible
215216 }
216217 this .name = name ;
217218 this .value = value ;
218- this .resourceBundleName = resourceBundleName ;
219- this .localizedLevelName = resourceBundleName == null ? name : null ;
220- this .cachedLocale = null ;
219+ // this.resourceBundleName = resourceBundleName;
220+ // this.localizedLevelName = resourceBundleName == null ? name : null;
221+ // this.cachedLocale = null;
221222 if (visible ) {
222223 KnownLevel .add (this );
223224 }
@@ -230,7 +231,7 @@ private Level(String name, int value, String resourceBundleName, boolean visible
230231 * @return localization resource bundle name
231232 */
232233 public String getResourceBundleName () {
233- return resourceBundleName ;
234+ return null ; // resourceBundleName;
234235 }
235236
236237 /**
@@ -261,72 +262,73 @@ final String getLevelName() {
261262 return this .name ;
262263 }
263264
264- private String computeLocalizedLevelName (Locale newLocale ) {
265- ResourceBundle rb = ResourceBundle .getBundle (resourceBundleName , newLocale );
266- final String localizedName = rb .getString (name );
267-
268- final boolean isDefaultBundle = defaultBundle .equals (resourceBundleName );
269- if (!isDefaultBundle ) return localizedName ;
270-
271- // This is a trick to determine whether the name has been translated
272- // or not. If it has not been translated, we need to use Locale.ROOT
273- // when calling toUpperCase().
274- final Locale rbLocale = rb .getLocale ();
275- final Locale locale =
276- Locale .ROOT .equals (rbLocale )
277- || name .equals (localizedName .toUpperCase (Locale .ROOT ))
278- ? Locale .ROOT : rbLocale ;
279-
280- // ALL CAPS in a resource bundle's message indicates no translation
281- // needed per Oracle translation guideline. To workaround this
282- // in Oracle JDK implementation, convert the localized level name
283- // to uppercase for compatibility reason.
284- return Locale .ROOT .equals (locale ) ? name : localizedName .toUpperCase (locale );
285- }
265+ // private String computeLocalizedLevelName(Locale newLocale) {
266+ // ResourceBundle rb = ResourceBundle.getBundle(resourceBundleName, newLocale);
267+ // final String localizedName = rb.getString(name);
268+ //
269+ // final boolean isDefaultBundle = defaultBundle.equals(resourceBundleName);
270+ // if (!isDefaultBundle) return localizedName;
271+ //
272+ // // This is a trick to determine whether the name has been translated
273+ // // or not. If it has not been translated, we need to use Locale.ROOT
274+ // // when calling toUpperCase().
275+ // final Locale rbLocale = rb.getLocale();
276+ // final Locale locale =
277+ // Locale.ROOT.equals(rbLocale)
278+ // || name.equals(localizedName.toUpperCase(Locale.ROOT))
279+ // ? Locale.ROOT : rbLocale;
280+ //
281+ // // ALL CAPS in a resource bundle's message indicates no translation
282+ // // needed per Oracle translation guideline. To workaround this
283+ // // in Oracle JDK implementation, convert the localized level name
284+ // // to uppercase for compatibility reason.
285+ // return Locale.ROOT.equals(locale) ? name : localizedName.toUpperCase(locale);
286+ // }
286287
287288 // Avoid looking up the localizedLevelName twice if we already
288289 // have it.
289- final String getCachedLocalizedLevelName () {
290-
291- if (localizedLevelName != null ) {
292- if (cachedLocale != null ) {
293- if (cachedLocale .equals (Locale .getDefault ())) {
294- // OK: our cached value was looked up with the same
295- // locale. We can use it.
296- return localizedLevelName ;
297- }
298- }
299- }
300-
301- if (resourceBundleName == null ) {
302- // No resource bundle: just use the name.
303- return name ;
304- }
305-
306- // We need to compute the localized name.
307- // Either because it's the first time, or because our cached
308- // value is for a different locale. Just return null.
309- return null ;
310- }
290+ // final String getCachedLocalizedLevelName() {
291+ //
292+ // if (localizedLevelName != null) {
293+ // if (cachedLocale != null) {
294+ // if (cachedLocale.equals(Locale.getDefault())) {
295+ // // OK: our cached value was looked up with the same
296+ // // locale. We can use it.
297+ // return localizedLevelName;
298+ // }
299+ // }
300+ // }
301+ //
302+ // if (resourceBundleName == null) {
303+ // // No resource bundle: just use the name.
304+ // return name;
305+ // }
306+ //
307+ // // We need to compute the localized name.
308+ // // Either because it's the first time, or because our cached
309+ // // value is for a different locale. Just return null.
310+ // return null;
311+ // }
311312
312313 final synchronized String getLocalizedLevelName () {
313-
314- // See if we have a cached localized name
315- final String cachedLocalizedName = getCachedLocalizedLevelName ();
316- if (cachedLocalizedName != null ) {
317- return cachedLocalizedName ;
318- }
319-
320- // No cached localized name or cache invalid.
321- // Need to compute the localized name.
322- final Locale newLocale = Locale .getDefault ();
323- try {
324- localizedLevelName = computeLocalizedLevelName (newLocale );
325- } catch (Exception ex ) {
326- localizedLevelName = name ;
327- }
328- cachedLocale = newLocale ;
329- return localizedLevelName ;
314+ // SwingJS
315+ return name ;
316+ // // See if we have a cached localized name
317+ // final String cachedLocalizedName = getCachedLocalizedLevelName();
318+ // if (cachedLocalizedName != null) {
319+ // return cachedLocalizedName;
320+ // }
321+ //
322+ // // No cached localized name or cache invalid.
323+ // // Need to compute the localized name.
324+ // final Locale newLocale = Locale.getDefault();
325+ // try {
326+ // localizedLevelName = computeLocalizedLevelName(newLocale);
327+ // } catch (Exception ex) {
328+ // localizedLevelName = name;
329+ // }
330+ // cachedLocale = newLocale;
331+ // return localizedLevelName;
330332 }
331333
332334 // Returns a mirrored Level object that matches the given name as
@@ -410,7 +412,7 @@ private Object readResolve() {
410412
411413 // Woops. Whoever sent us this object knows
412414 // about a new log level. Add it to our list.
413- Level level = new Level (this .name , this .value , this .resourceBundleName );
415+ Level level = new Level (this .name , this .value , null ); // this.resourceBundleName);
414416 return level ;
415417 }
416418
@@ -536,7 +538,7 @@ static final class KnownLevel {
536538 this .mirroredLevel = l ;
537539 } else {
538540 // this mirrored level object is hidden
539- this .mirroredLevel = new Level (l .name , l .value , l .resourceBundleName , false );
541+ this .mirroredLevel = new Level (l .name , l .value , null , false ); // l.resourceBundleName, false);
540542 }
541543 }
542544
@@ -599,10 +601,12 @@ static synchronized KnownLevel matches(Level l) {
599601 if (list != null ) {
600602 for (KnownLevel level : list ) {
601603 Level other = level .mirroredLevel ;
602- if (l .value == other .value &&
603- (l .resourceBundleName == other .resourceBundleName ||
604- (l .resourceBundleName != null &&
605- l .resourceBundleName .equals (other .resourceBundleName )))) {
604+ if (l .value == other .value
605+ // &&
606+ // (l.resourceBundleName == other.resourceBundleName ||
607+ // (l.resourceBundleName != null &&
608+ // l.resourceBundleName.equals(other.resourceBundleName)))
609+ ) {
606610 return level ;
607611 }
608612 }
0 commit comments