diff --git a/jdk/make/java/java/FILES_java.gmk b/jdk/make/java/java/FILES_java.gmk index d07efda0aa1..b5449106cd7 100644 --- a/jdk/make/java/java/FILES_java.gmk +++ b/jdk/make/java/java/FILES_java.gmk @@ -189,7 +189,6 @@ JAVA_JAVA_java = \ java/util/ListResourceBundle.java \ sun/util/EmptyListResourceBundle.java \ java/util/Locale.java \ - sun/util/locale/AsciiUtil.java \ sun/util/locale/BaseLocale.java \ sun/util/locale/Extension.java \ sun/util/locale/InternalLocaleBuilder.java \ @@ -197,6 +196,7 @@ JAVA_JAVA_java = \ sun/util/locale/LocaleExtensions.java \ sun/util/locale/LocaleObjectCache.java \ sun/util/locale/LocaleSyntaxException.java \ + sun/util/locale/LocaleUtils.java \ sun/util/locale/ParseStatus.java \ sun/util/locale/StringTokenIterator.java \ sun/util/locale/UnicodeLocaleExtension.java \ diff --git a/jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java b/jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java index a73a4c68f39..fe9fde7fefe 100644 --- a/jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java +++ b/jdk/src/share/classes/com/sun/media/sound/DLSInstrument.java @@ -25,6 +25,7 @@ package com.sun.media.sound; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -439,10 +440,10 @@ public class DLSInstrument extends ModelInstrument { } public byte[] getGuid() { - return guid; + return guid == null ? null : Arrays.copyOf(guid, guid.length); } public void setGuid(byte[] guid) { - this.guid = guid; + this.guid = guid == null ? null : Arrays.copyOf(guid, guid.length); } } diff --git a/jdk/src/share/classes/com/sun/media/sound/DLSSample.java b/jdk/src/share/classes/com/sun/media/sound/DLSSample.java index afddfd0fa55..28327e68f6c 100644 --- a/jdk/src/share/classes/com/sun/media/sound/DLSSample.java +++ b/jdk/src/share/classes/com/sun/media/sound/DLSSample.java @@ -25,6 +25,7 @@ package com.sun.media.sound; import java.io.InputStream; +import java.util.Arrays; import javax.sound.midi.Soundbank; import javax.sound.midi.SoundbankResource; import javax.sound.sampled.AudioFormat; @@ -113,10 +114,10 @@ public class DLSSample extends SoundbankResource { } public byte[] getGuid() { - return guid; + return guid == null ? null : Arrays.copyOf(guid, guid.length); } public void setGuid(byte[] guid) { - this.guid = guid; + this.guid = guid == null ? null : Arrays.copyOf(guid, guid.length); } } diff --git a/jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java b/jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java index 2f8702c2026..3f21aa0b9d6 100644 --- a/jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java +++ b/jdk/src/share/classes/com/sun/media/sound/ModelConnectionBlock.java @@ -24,6 +24,8 @@ */ package com.sun.media.sound; +import java.util.Arrays; + /** * Connection blocks are used to connect source variable * to a destination variable. @@ -117,19 +119,17 @@ public class ModelConnectionBlock { } public ModelSource[] getSources() { - return sources; + return Arrays.copyOf(sources, sources.length); } public void setSources(ModelSource[] source) { - this.sources = source; + this.sources = source == null ? no_sources : Arrays.copyOf(source, source.length); } public void addSource(ModelSource source) { ModelSource[] oldsources = sources; sources = new ModelSource[oldsources.length + 1]; - for (int i = 0; i < oldsources.length; i++) { - sources[i] = oldsources[i]; - } + System.arraycopy(oldsources, 0, sources, 0, oldsources.length); sources[sources.length - 1] = source; } } diff --git a/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java b/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java index 1fc20b75b83..70208f78e7d 100644 --- a/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java +++ b/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java @@ -503,7 +503,7 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer { firstVoice = true; voiceNo = 0; - int tunedKey = (int)(Math.round(tuning.getTuning()[noteNumber]/100.0)); + int tunedKey = (int)(Math.round(tuning.getTuning(noteNumber)/100.0)); play_noteNumber = noteNumber; play_velocity = velocity; play_delay = delay; @@ -607,7 +607,7 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer { firstVoice = true; voiceNo = 0; - int tunedKey = (int)(Math.round(tuning.getTuning()[noteNumber]/100.0)); + int tunedKey = (int)(Math.round(tuning.getTuning(noteNumber)/100.0)); play_noteNumber = noteNumber; play_velocity = lastVelocity[noteNumber]; play_releasetriggered = true; @@ -632,7 +632,7 @@ public class SoftChannel implements MidiChannel, ModelDirectedPlayer { int delay = play_delay; boolean releasetriggered = play_releasetriggered; - SoftPerformer p = current_instrument.getPerformers()[performerIndex]; + SoftPerformer p = current_instrument.getPerformer(performerIndex); if (firstVoice) { firstVoice = false; diff --git a/jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java b/jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java index 3f26a2be518..78f8926b5c2 100644 --- a/jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java +++ b/jdk/src/share/classes/com/sun/media/sound/SoftInstrument.java @@ -76,7 +76,12 @@ public class SoftInstrument extends Instrument { return data; } + /* am: currently getPerformers() is not used (replaced with getPerformer(int)) public SoftPerformer[] getPerformers() { return performers; } + */ + public SoftPerformer getPerformer(int index) { + return performers[index]; + } } diff --git a/jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java b/jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java index 738c5289bb7..baaf9e844d9 100644 --- a/jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java +++ b/jdk/src/share/classes/com/sun/media/sound/SoftMixingDataLine.java @@ -505,7 +505,7 @@ public abstract class SoftMixingDataLine implements DataLine { } public Control[] getControls() { - return controls; + return Arrays.copyOf(controls, controls.length); } public boolean isControlSupported(Type control) { diff --git a/jdk/src/share/classes/com/sun/media/sound/SoftProvider.java b/jdk/src/share/classes/com/sun/media/sound/SoftProvider.java index dfa0fb2bfb4..bf3c45eb7fb 100644 --- a/jdk/src/share/classes/com/sun/media/sound/SoftProvider.java +++ b/jdk/src/share/classes/com/sun/media/sound/SoftProvider.java @@ -24,6 +24,7 @@ */ package com.sun.media.sound; +import java.util.Arrays; import javax.sound.midi.MidiDevice; import javax.sound.midi.MidiDevice.Info; import javax.sound.midi.spi.MidiDeviceProvider; @@ -39,7 +40,7 @@ public class SoftProvider extends MidiDeviceProvider { private static Info[] softinfos = {softinfo}; public MidiDevice.Info[] getDeviceInfo() { - return softinfos; + return Arrays.copyOf(softinfos, softinfos.length); } public MidiDevice getDevice(MidiDevice.Info info) { diff --git a/jdk/src/share/classes/com/sun/media/sound/SoftTuning.java b/jdk/src/share/classes/com/sun/media/sound/SoftTuning.java index 8fbdfa96dc8..611db14e527 100644 --- a/jdk/src/share/classes/com/sun/media/sound/SoftTuning.java +++ b/jdk/src/share/classes/com/sun/media/sound/SoftTuning.java @@ -25,6 +25,7 @@ package com.sun.media.sound; import java.io.UnsupportedEncodingException; +import java.util.Arrays; import javax.sound.midi.Patch; @@ -234,8 +235,10 @@ public class SoftTuning { } } + // am: getTuning(int) is more effective. + // currently getTuning() is used only by tests public double[] getTuning() { - return tuning; + return Arrays.copyOf(tuning, tuning.length); } public double getTuning(int noteNumber) { diff --git a/jdk/src/share/classes/java/text/ChoiceFormat.java b/jdk/src/share/classes/java/text/ChoiceFormat.java index 31b138539cf..f513cd9de80 100644 --- a/jdk/src/share/classes/java/text/ChoiceFormat.java +++ b/jdk/src/share/classes/java/text/ChoiceFormat.java @@ -136,8 +136,8 @@ import java.util.Arrays; * * * And the output result would be like the following: - *
  * 
+ *
  *   Format with -INF : is negative
  *   Format with -1.0 : is negative
  *   Format with 0 : is zero or fraction
diff --git a/jdk/src/share/classes/java/util/Locale.java b/jdk/src/share/classes/java/util/Locale.java
index 05f5fb6fe0b..363d28585d5 100644
--- a/jdk/src/share/classes/java/util/Locale.java
+++ b/jdk/src/share/classes/java/util/Locale.java
@@ -51,13 +51,13 @@ import java.util.spi.LocaleNameProvider;
 
 import sun.security.action.GetPropertyAction;
 import sun.util.LocaleServiceProviderPool;
-import sun.util.locale.AsciiUtil;
 import sun.util.locale.BaseLocale;
 import sun.util.locale.InternalLocaleBuilder;
 import sun.util.locale.LanguageTag;
 import sun.util.locale.LocaleExtensions;
 import sun.util.locale.LocaleObjectCache;
 import sun.util.locale.LocaleSyntaxException;
+import sun.util.locale.LocaleUtils;
 import sun.util.locale.ParseStatus;
 import sun.util.locale.UnicodeLocaleExtension;
 import sun.util.resources.LocaleData;
@@ -412,59 +412,59 @@ public final class Locale implements Cloneable, Serializable {
 
     /** Useful constant for language.
      */
-    static public final Locale ENGLISH = getInstance("en", "", "");
+    static public final Locale ENGLISH = createConstant("en", "");
 
     /** Useful constant for language.
      */
-    static public final Locale FRENCH = getInstance("fr", "", "");
+    static public final Locale FRENCH = createConstant("fr", "");
 
     /** Useful constant for language.
      */
-    static public final Locale GERMAN = getInstance("de", "", "");
+    static public final Locale GERMAN = createConstant("de", "");
 
     /** Useful constant for language.
      */
-    static public final Locale ITALIAN = getInstance("it", "", "");
+    static public final Locale ITALIAN = createConstant("it", "");
 
     /** Useful constant for language.
      */
-    static public final Locale JAPANESE = getInstance("ja", "", "");
+    static public final Locale JAPANESE = createConstant("ja", "");
 
     /** Useful constant for language.
      */
-    static public final Locale KOREAN = getInstance("ko", "", "");
+    static public final Locale KOREAN = createConstant("ko", "");
 
     /** Useful constant for language.
      */
-    static public final Locale CHINESE = getInstance("zh", "", "");
+    static public final Locale CHINESE = createConstant("zh", "");
 
     /** Useful constant for language.
      */
-    static public final Locale SIMPLIFIED_CHINESE = getInstance("zh", "CN", "");
+    static public final Locale SIMPLIFIED_CHINESE = createConstant("zh", "CN");
 
     /** Useful constant for language.
      */
-    static public final Locale TRADITIONAL_CHINESE = getInstance("zh", "TW", "");
+    static public final Locale TRADITIONAL_CHINESE = createConstant("zh", "TW");
 
     /** Useful constant for country.
      */
-    static public final Locale FRANCE = getInstance("fr", "FR", "");
+    static public final Locale FRANCE = createConstant("fr", "FR");
 
     /** Useful constant for country.
      */
-    static public final Locale GERMANY = getInstance("de", "DE", "");
+    static public final Locale GERMANY = createConstant("de", "DE");
 
     /** Useful constant for country.
      */
-    static public final Locale ITALY = getInstance("it", "IT", "");
+    static public final Locale ITALY = createConstant("it", "IT");
 
     /** Useful constant for country.
      */
-    static public final Locale JAPAN = getInstance("ja", "JP", "");
+    static public final Locale JAPAN = createConstant("ja", "JP");
 
     /** Useful constant for country.
      */
-    static public final Locale KOREA = getInstance("ko", "KR", "");
+    static public final Locale KOREA = createConstant("ko", "KR");
 
     /** Useful constant for country.
      */
@@ -480,19 +480,19 @@ public final class Locale implements Cloneable, Serializable {
 
     /** Useful constant for country.
      */
-    static public final Locale UK = getInstance("en", "GB", "");
+    static public final Locale UK = createConstant("en", "GB");
 
     /** Useful constant for country.
      */
-    static public final Locale US = getInstance("en", "US", "");
+    static public final Locale US = createConstant("en", "US");
 
     /** Useful constant for country.
      */
-    static public final Locale CANADA = getInstance("en", "CA", "");
+    static public final Locale CANADA = createConstant("en", "CA");
 
     /** Useful constant for country.
      */
-    static public final Locale CANADA_FRENCH = getInstance("fr", "CA", "");
+    static public final Locale CANADA_FRENCH = createConstant("fr", "CA");
 
     /**
      * Useful constant for the root locale.  The root locale is the locale whose
@@ -502,7 +502,7 @@ public final class Locale implements Cloneable, Serializable {
      *
      * @since 1.6
      */
-    static public final Locale ROOT = getInstance("", "", "");
+    static public final Locale ROOT = createConstant("", "");
 
     /**
      * The key for the private use extension ('x').
@@ -532,14 +532,14 @@ public final class Locale implements Cloneable, Serializable {
     private static final int DISPLAY_LANGUAGE = 0;
     private static final int DISPLAY_COUNTRY  = 1;
     private static final int DISPLAY_VARIANT  = 2;
-    private static final int DISPLAY_SCRIPT = 3;
+    private static final int DISPLAY_SCRIPT   = 3;
 
     /**
      * Private constructor used by getInstance method
      */
     private Locale(BaseLocale baseLocale, LocaleExtensions extensions) {
-        _baseLocale = baseLocale;
-        _extensions = extensions;
+        this.baseLocale = baseLocale;
+        this.localeExtensions = extensions;
     }
 
     /**
@@ -572,8 +572,8 @@ public final class Locale implements Cloneable, Serializable {
         if (language== null || country == null || variant == null) {
             throw new NullPointerException();
         }
-        _baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), "", country, variant);
-        _extensions = getCompatibilityExtensions(language, "", country, variant);
+        baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), "", country, variant);
+        localeExtensions = getCompatibilityExtensions(language, "", country, variant);
     }
 
     /**
@@ -626,6 +626,15 @@ public final class Locale implements Cloneable, Serializable {
         this(language, "", "");
     }
 
+    /**
+     * This method must be called only for creating the Locale.*
+     * constants due to making shortcuts.
+     */
+    private static Locale createConstant(String lang, String country) {
+        BaseLocale base = BaseLocale.createInstance(lang, country);
+        return getInstance(base, null);
+    }
+
     /**
      * Returns a Locale constructed from the given
      * language, country and
@@ -641,7 +650,7 @@ public final class Locale implements Cloneable, Serializable {
      * @exception NullPointerException if any argument is null.
      */
     static Locale getInstance(String language, String country, String variant) {
-        return getInstance(language, "", country, variant, LocaleExtensions.EMPTY_EXTENSIONS);
+        return getInstance(language, "", country, variant, null);
     }
 
     static Locale getInstance(String language, String script, String country,
@@ -651,10 +660,6 @@ public final class Locale implements Cloneable, Serializable {
         }
 
         if (extensions == null) {
-            extensions = LocaleExtensions.EMPTY_EXTENSIONS;
-        }
-
-        if (extensions.equals(LocaleExtensions.EMPTY_EXTENSIONS)) {
             extensions = getCompatibilityExtensions(language, script, country, variant);
         }
 
@@ -668,22 +673,33 @@ public final class Locale implements Cloneable, Serializable {
     }
 
     private static class Cache extends LocaleObjectCache {
-        public Cache() {
+        private Cache() {
         }
+
+        @Override
         protected Locale createObject(LocaleKey key) {
-            return new Locale(key._base, key._exts);
+            return new Locale(key.base, key.exts);
         }
     }
 
-    private static class LocaleKey {
-        private BaseLocale _base;
-        private LocaleExtensions _exts;
+    private static final class LocaleKey {
+        private final BaseLocale base;
+        private final LocaleExtensions exts;
+        private final int hash;
 
         private LocaleKey(BaseLocale baseLocale, LocaleExtensions extensions) {
-            _base = baseLocale;
-            _exts = extensions;
+            base = baseLocale;
+            exts = extensions;
+
+            // Calculate the hash value here because it's always used.
+            int h = base.hashCode();
+            if (exts != null) {
+                h ^= exts.hashCode();
+            }
+            hash = h;
         }
 
+        @Override
         public boolean equals(Object obj) {
             if (this == obj) {
                 return true;
@@ -692,11 +708,18 @@ public final class Locale implements Cloneable, Serializable {
                 return false;
             }
             LocaleKey other = (LocaleKey)obj;
-            return _base.equals(other._base) && _exts.equals(other._exts);
+            if (hash != other.hash || !base.equals(other.base)) {
+                return false;
+            }
+            if (exts == null) {
+                return other.exts == null;
+            }
+            return exts.equals(other.exts);
         }
 
+        @Override
         public int hashCode() {
-            return _base.hashCode() ^ _exts.hashCode();
+            return hash;
         }
     }
 
@@ -981,7 +1004,7 @@ public final class Locale implements Cloneable, Serializable {
      * @see #getDisplayLanguage
      */
     public String getLanguage() {
-        return _baseLocale.getLanguage();
+        return baseLocale.getLanguage();
     }
 
     /**
@@ -995,7 +1018,7 @@ public final class Locale implements Cloneable, Serializable {
      * @since 1.7
      */
     public String getScript() {
-        return _baseLocale.getScript();
+        return baseLocale.getScript();
     }
 
     /**
@@ -1007,7 +1030,7 @@ public final class Locale implements Cloneable, Serializable {
      * @see #getDisplayCountry
      */
     public String getCountry() {
-        return _baseLocale.getRegion();
+        return baseLocale.getRegion();
     }
 
     /**
@@ -1017,7 +1040,7 @@ public final class Locale implements Cloneable, Serializable {
      * @see #getDisplayVariant
      */
     public String getVariant() {
-        return _baseLocale.getVariant();
+        return baseLocale.getVariant();
     }
 
     /**
@@ -1039,7 +1062,7 @@ public final class Locale implements Cloneable, Serializable {
         if (!LocaleExtensions.isValidKey(key)) {
             throw new IllegalArgumentException("Ill-formed extension key: " + key);
         }
-        return _extensions.getExtensionValue(key);
+        return (localeExtensions == null) ? null : localeExtensions.getExtensionValue(key);
     }
 
     /**
@@ -1052,7 +1075,10 @@ public final class Locale implements Cloneable, Serializable {
      * @since 1.7
      */
     public Set getExtensionKeys() {
-        return _extensions.getKeys();
+        if (localeExtensions == null) {
+            return Collections.emptySet();
+        }
+        return localeExtensions.getKeys();
     }
 
     /**
@@ -1064,7 +1090,10 @@ public final class Locale implements Cloneable, Serializable {
      * @since 1.7
      */
     public Set getUnicodeLocaleAttributes() {
-        return _extensions.getUnicodeLocaleAttributes();
+        if (localeExtensions == null) {
+            return Collections.emptySet();
+        }
+        return localeExtensions.getUnicodeLocaleAttributes();
     }
 
     /**
@@ -1085,7 +1114,7 @@ public final class Locale implements Cloneable, Serializable {
         if (!UnicodeLocaleExtension.isKey(key)) {
             throw new IllegalArgumentException("Ill-formed Unicode locale key: " + key);
         }
-        return _extensions.getUnicodeLocaleType(key);
+        return (localeExtensions == null) ? null : localeExtensions.getUnicodeLocaleType(key);
     }
 
     /**
@@ -1097,7 +1126,10 @@ public final class Locale implements Cloneable, Serializable {
      * @since 1.7
      */
     public Set getUnicodeLocaleKeys() {
-        return _extensions.getUnicodeLocaleKeys();
+        if (localeExtensions == null) {
+            return Collections.emptySet();
+        }
+        return localeExtensions.getUnicodeLocaleKeys();
     }
 
     /**
@@ -1106,16 +1138,17 @@ public final class Locale implements Cloneable, Serializable {
      * @return base locale of this Locale
      */
     BaseLocale getBaseLocale() {
-        return _baseLocale;
+        return baseLocale;
     }
 
     /**
-     * Package local method returning the Locale's LocaleExtensions,
-     * used by ResourceBundle
-     * @return locale exnteions of this Locale
+     * Package private method returning the Locale's LocaleExtensions,
+     * used by ResourceBundle.
+     * @return locale exnteions of this Locale,
+     *         or {@code null} if no extensions are defined
      */
      LocaleExtensions getLocaleExtensions() {
-         return _extensions;
+         return localeExtensions;
      }
 
     /**
@@ -1160,26 +1193,27 @@ public final class Locale implements Cloneable, Serializable {
      * @see #getDisplayName
      * @see #toLanguageTag
      */
+    @Override
     public final String toString() {
-        boolean l = (_baseLocale.getLanguage().length() != 0);
-        boolean s = (_baseLocale.getScript().length() != 0);
-        boolean r = (_baseLocale.getRegion().length() != 0);
-        boolean v = (_baseLocale.getVariant().length() != 0);
-        boolean e = (_extensions.getID().length() != 0);
+        boolean l = (baseLocale.getLanguage().length() != 0);
+        boolean s = (baseLocale.getScript().length() != 0);
+        boolean r = (baseLocale.getRegion().length() != 0);
+        boolean v = (baseLocale.getVariant().length() != 0);
+        boolean e = (localeExtensions != null && localeExtensions.getID().length() != 0);
 
-        StringBuilder result = new StringBuilder(_baseLocale.getLanguage());
+        StringBuilder result = new StringBuilder(baseLocale.getLanguage());
         if (r || (l && (v || s || e))) {
             result.append('_')
-                .append(_baseLocale.getRegion()); // This may just append '_'
+                .append(baseLocale.getRegion()); // This may just append '_'
         }
         if (v && (l || r)) {
             result.append('_')
-                .append(_baseLocale.getVariant());
+                .append(baseLocale.getVariant());
         }
 
         if (s && (l || r)) {
             result.append("_#")
-                .append(_baseLocale.getScript());
+                .append(baseLocale.getScript());
         }
 
         if (e && (l || r)) {
@@ -1187,7 +1221,7 @@ public final class Locale implements Cloneable, Serializable {
             if (!s) {
                 result.append('#');
             }
-            result.append(_extensions.getID());
+            result.append(localeExtensions.getID());
         }
 
         return result.toString();
@@ -1261,7 +1295,7 @@ public final class Locale implements Cloneable, Serializable {
      * @since 1.7
      */
     public String toLanguageTag() {
-        LanguageTag tag = LanguageTag.parseLocale(_baseLocale, _extensions);
+        LanguageTag tag = LanguageTag.parseLocale(baseLocale, localeExtensions);
         StringBuilder buf = new StringBuilder();
 
         String subtag = tag.getLanguage();
@@ -1433,8 +1467,9 @@ public final class Locale implements Cloneable, Serializable {
         bldr.setLanguageTag(tag);
         BaseLocale base = bldr.getBaseLocale();
         LocaleExtensions exts = bldr.getLocaleExtensions();
-        if (exts.isEmpty() && base.getVariant().length() > 0) {
-            exts = getCompatibilityExtensions(base.getLanguage(), base.getScript(), base.getRegion(), base.getVariant());
+        if (exts == null && base.getVariant().length() > 0) {
+            exts = getCompatibilityExtensions(base.getLanguage(), base.getScript(),
+                                              base.getRegion(), base.getVariant());
         }
         return getInstance(base, exts);
     }
@@ -1454,7 +1489,7 @@ public final class Locale implements Cloneable, Serializable {
      * three-letter language abbreviation is not available for this locale.
      */
     public String getISO3Language() throws MissingResourceException {
-        String lang = _baseLocale.getLanguage();
+        String lang = baseLocale.getLanguage();
         if (lang.length() == 3) {
             return lang;
         }
@@ -1481,10 +1516,10 @@ public final class Locale implements Cloneable, Serializable {
      * three-letter country abbreviation is not available for this locale.
      */
     public String getISO3Country() throws MissingResourceException {
-        String country3 = getISO3Code(_baseLocale.getRegion(), LocaleISOData.isoCountryTable);
+        String country3 = getISO3Code(baseLocale.getRegion(), LocaleISOData.isoCountryTable);
         if (country3 == null) {
             throw new MissingResourceException("Couldn't find 3-letter country code for "
-                    + _baseLocale.getRegion(), "FormatData_" + toString(), "ShortCountry");
+                    + baseLocale.getRegion(), "FormatData_" + toString(), "ShortCountry");
         }
         return country3;
     }
@@ -1542,7 +1577,7 @@ public final class Locale implements Cloneable, Serializable {
      * @exception NullPointerException if inLocale is null
      */
     public String getDisplayLanguage(Locale inLocale) {
-        return getDisplayString(_baseLocale.getLanguage(), inLocale, DISPLAY_LANGUAGE);
+        return getDisplayString(baseLocale.getLanguage(), inLocale, DISPLAY_LANGUAGE);
     }
 
     /**
@@ -1568,7 +1603,7 @@ public final class Locale implements Cloneable, Serializable {
      * @since 1.7
      */
     public String getDisplayScript(Locale inLocale) {
-        return getDisplayString(_baseLocale.getScript(), inLocale, DISPLAY_SCRIPT);
+        return getDisplayString(baseLocale.getScript(), inLocale, DISPLAY_SCRIPT);
     }
 
     /**
@@ -1603,7 +1638,7 @@ public final class Locale implements Cloneable, Serializable {
      * @exception NullPointerException if inLocale is null
      */
     public String getDisplayCountry(Locale inLocale) {
-        return getDisplayString(_baseLocale.getRegion(), inLocale, DISPLAY_COUNTRY);
+        return getDisplayString(baseLocale.getRegion(), inLocale, DISPLAY_COUNTRY);
     }
 
     private String getDisplayString(String code, Locale inLocale, int type) {
@@ -1662,7 +1697,7 @@ public final class Locale implements Cloneable, Serializable {
      * @exception NullPointerException if inLocale is null
      */
     public String getDisplayVariant(Locale inLocale) {
-        if (_baseLocale.getVariant().length() == 0)
+        if (baseLocale.getVariant().length() == 0)
             return "";
 
         OpenListResourceBundle bundle = LocaleData.getLocaleNames(inLocale);
@@ -1758,7 +1793,7 @@ public final class Locale implements Cloneable, Serializable {
                 return formatList(variantNames, listPattern, listCompositionPattern);
             }
         }
-        ArrayList names = new ArrayList(4);
+        ArrayList names = new ArrayList<>(4);
         if (languageName.length() != 0) {
             names.add(languageName);
         }
@@ -1833,10 +1868,14 @@ public final class Locale implements Cloneable, Serializable {
      * Since Locales are often used in hashtables, caches the value
      * for speed.
      */
+    @Override
     public int hashCode() {
         int hc = hashCodeValue;
         if (hc == 0) {
-            hc = _baseLocale.hashCode() ^ _extensions.hashCode();
+            hc = baseLocale.hashCode();
+            if (localeExtensions != null) {
+                hc ^= localeExtensions.hashCode();
+            }
             hashCodeValue = hc;
         }
         return hc;
@@ -1851,21 +1890,26 @@ public final class Locale implements Cloneable, Serializable {
      *
      * @return true if this Locale is equal to the specified object.
      */
-
+    @Override
     public boolean equals(Object obj) {
         if (this == obj)                      // quick check
             return true;
         if (!(obj instanceof Locale))
             return false;
-        BaseLocale otherBase = ((Locale)obj)._baseLocale;
-        LocaleExtensions otherExt = ((Locale)obj)._extensions;
-        return _baseLocale.equals(otherBase) && _extensions.equals(otherExt);
+        BaseLocale otherBase = ((Locale)obj).baseLocale;
+        if (!baseLocale.equals(otherBase)) {
+            return false;
+        }
+        if (localeExtensions == null) {
+            return ((Locale)obj).localeExtensions == null;
+        }
+        return localeExtensions.equals(((Locale)obj).localeExtensions);
     }
 
     // ================= privates =====================================
 
-    private transient BaseLocale _baseLocale;
-    private transient LocaleExtensions _extensions;
+    private transient BaseLocale baseLocale;
+    private transient LocaleExtensions localeExtensions;
 
     /**
      * Calculated hashcode
@@ -1883,7 +1927,7 @@ public final class Locale implements Cloneable, Serializable {
      */
     private String[] getDisplayVariantArray(OpenListResourceBundle bundle, Locale inLocale) {
         // Split the variant name into tokens separated by '_'.
-        StringTokenizer tokenizer = new StringTokenizer(_baseLocale.getVariant(), "_");
+        StringTokenizer tokenizer = new StringTokenizer(baseLocale.getVariant(), "_");
         String[] names = new String[tokenizer.countTokens()];
 
         // For each variant token, lookup the display name.  If
@@ -1996,11 +2040,11 @@ public final class Locale implements Cloneable, Serializable {
      */
     private void writeObject(ObjectOutputStream out) throws IOException {
         ObjectOutputStream.PutField fields = out.putFields();
-        fields.put("language", _baseLocale.getLanguage());
-        fields.put("script", _baseLocale.getScript());
-        fields.put("country", _baseLocale.getRegion());
-        fields.put("variant", _baseLocale.getVariant());
-        fields.put("extensions", _extensions.getID());
+        fields.put("language", baseLocale.getLanguage());
+        fields.put("script", baseLocale.getScript());
+        fields.put("country", baseLocale.getRegion());
+        fields.put("variant", baseLocale.getVariant());
+        fields.put("extensions", localeExtensions == null ? "" : localeExtensions.getID());
         fields.put("hashcode", -1); // place holder just for backward support
         out.writeFields();
     }
@@ -2020,13 +2064,17 @@ public final class Locale implements Cloneable, Serializable {
         String country = (String)fields.get("country", "");
         String variant = (String)fields.get("variant", "");
         String extStr = (String)fields.get("extensions", "");
-        _baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), script, country, variant);
-        try {
-            InternalLocaleBuilder bldr = new InternalLocaleBuilder();
-            bldr.setExtensions(extStr);
-            _extensions = bldr.getLocaleExtensions();
-        } catch (LocaleSyntaxException e) {
-            throw new IllformedLocaleException(e.getMessage());
+        baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), script, country, variant);
+        if (extStr.length() > 0) {
+            try {
+                InternalLocaleBuilder bldr = new InternalLocaleBuilder();
+                bldr.setExtensions(extStr);
+                localeExtensions = bldr.getLocaleExtensions();
+            } catch (LocaleSyntaxException e) {
+                throw new IllformedLocaleException(e.getMessage());
+            }
+        } else {
+            localeExtensions = null;
         }
     }
 
@@ -2045,8 +2093,8 @@ public final class Locale implements Cloneable, Serializable {
      * @throws java.io.ObjectStreamException
      */
     private Object readResolve() throws java.io.ObjectStreamException {
-        return getInstance(_baseLocale.getLanguage(), _baseLocale.getScript(),
-                _baseLocale.getRegion(), _baseLocale.getVariant(), _extensions);
+        return getInstance(baseLocale.getLanguage(), baseLocale.getScript(),
+                baseLocale.getRegion(), baseLocale.getVariant(), localeExtensions);
     }
 
     private static volatile String[] isoLanguages = null;
@@ -2056,7 +2104,7 @@ public final class Locale implements Cloneable, Serializable {
     private static String convertOldISOCodes(String language) {
         // we accept both the old and the new ISO codes for the languages whose ISO
         // codes have changed, but we always store the OLD code, for backward compatibility
-        language = AsciiUtil.toLowerString(language).intern();
+        language = LocaleUtils.toLowerString(language).intern();
         if (language == "he") {
             return "iw";
         } else if (language == "yi") {
@@ -2068,19 +2116,22 @@ public final class Locale implements Cloneable, Serializable {
         }
     }
 
-    private static LocaleExtensions getCompatibilityExtensions(String language, String script, String country, String variant) {
-        LocaleExtensions extensions = LocaleExtensions.EMPTY_EXTENSIONS;
+    private static LocaleExtensions getCompatibilityExtensions(String language,
+                                                               String script,
+                                                               String country,
+                                                               String variant) {
+        LocaleExtensions extensions = null;
         // Special cases for backward compatibility support
-        if (AsciiUtil.caseIgnoreMatch(language, "ja")
+        if (LocaleUtils.caseIgnoreMatch(language, "ja")
                 && script.length() == 0
-                && AsciiUtil.caseIgnoreMatch(country, "JP")
-                && AsciiUtil.caseIgnoreMatch(variant, "JP")) {
+                && LocaleUtils.caseIgnoreMatch(country, "jp")
+                && "JP".equals(variant)) {
             // ja_JP_JP -> u-ca-japanese (calendar = japanese)
             extensions = LocaleExtensions.CALENDAR_JAPANESE;
-        } else if (AsciiUtil.caseIgnoreMatch(language, "th")
+        } else if (LocaleUtils.caseIgnoreMatch(language, "th")
                 && script.length() == 0
-                && AsciiUtil.caseIgnoreMatch(country, "TH")
-                && AsciiUtil.caseIgnoreMatch(variant, "TH")) {
+                && LocaleUtils.caseIgnoreMatch(country, "th")
+                && "TH".equals(variant)) {
             // th_TH_TH -> u-nu-thai (numbersystem = thai)
             extensions = LocaleExtensions.NUMBER_THAI;
         }
@@ -2196,7 +2247,7 @@ public final class Locale implements Cloneable, Serializable {
      * @since 1.7
      */
     public static final class Builder {
-        private InternalLocaleBuilder _locbld;
+        private final InternalLocaleBuilder localeBuilder;
 
         /**
          * Constructs an empty Builder. The default value of all
@@ -2204,7 +2255,7 @@ public final class Locale implements Cloneable, Serializable {
          * empty string.
          */
         public Builder() {
-            _locbld = new InternalLocaleBuilder();
+            localeBuilder = new InternalLocaleBuilder();
         }
 
         /**
@@ -2229,7 +2280,7 @@ public final class Locale implements Cloneable, Serializable {
          */
         public Builder setLocale(Locale locale) {
             try {
-                _locbld.setLocale(locale._baseLocale, locale._extensions);
+                localeBuilder.setLocale(locale.baseLocale, locale.localeExtensions);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2259,8 +2310,7 @@ public final class Locale implements Cloneable, Serializable {
             if (sts.isError()) {
                 throw new IllformedLocaleException(sts.getErrorMessage(), sts.getErrorIndex());
             }
-            _locbld.setLanguageTag(tag);
-
+            localeBuilder.setLanguageTag(tag);
             return this;
         }
 
@@ -2279,7 +2329,7 @@ public final class Locale implements Cloneable, Serializable {
          */
         public Builder setLanguage(String language) {
             try {
-                _locbld.setLanguage(language);
+                localeBuilder.setLanguage(language);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2300,7 +2350,7 @@ public final class Locale implements Cloneable, Serializable {
          */
         public Builder setScript(String script) {
             try {
-                _locbld.setScript(script);
+                localeBuilder.setScript(script);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2325,7 +2375,7 @@ public final class Locale implements Cloneable, Serializable {
          */
         public Builder setRegion(String region) {
             try {
-                _locbld.setRegion(region);
+                localeBuilder.setRegion(region);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2352,7 +2402,7 @@ public final class Locale implements Cloneable, Serializable {
          */
         public Builder setVariant(String variant) {
             try {
-                _locbld.setVariant(variant);
+                localeBuilder.setVariant(variant);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2384,7 +2434,7 @@ public final class Locale implements Cloneable, Serializable {
          */
         public Builder setExtension(char key, String value) {
             try {
-                _locbld.setExtension(key, value);
+                localeBuilder.setExtension(key, value);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2414,7 +2464,7 @@ public final class Locale implements Cloneable, Serializable {
          */
         public Builder setUnicodeLocaleKeyword(String key, String type) {
             try {
-                _locbld.setUnicodeLocaleKeyword(key, type);
+                localeBuilder.setUnicodeLocaleKeyword(key, type);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2435,7 +2485,7 @@ public final class Locale implements Cloneable, Serializable {
          */
         public Builder addUnicodeLocaleAttribute(String attribute) {
             try {
-                _locbld.addUnicodeLocaleAttribute(attribute);
+                localeBuilder.addUnicodeLocaleAttribute(attribute);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2458,7 +2508,7 @@ public final class Locale implements Cloneable, Serializable {
          */
         public Builder removeUnicodeLocaleAttribute(String attribute) {
             try {
-                _locbld.removeUnicodeLocaleAttribute(attribute);
+                localeBuilder.removeUnicodeLocaleAttribute(attribute);
             } catch (LocaleSyntaxException e) {
                 throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
             }
@@ -2471,7 +2521,7 @@ public final class Locale implements Cloneable, Serializable {
          * @return This builder.
          */
         public Builder clear() {
-            _locbld.clear();
+            localeBuilder.clear();
             return this;
         }
 
@@ -2483,7 +2533,7 @@ public final class Locale implements Cloneable, Serializable {
          * @see #setExtension(char, String)
          */
         public Builder clearExtensions() {
-            _locbld.clearExtensions();
+            localeBuilder.clearExtensions();
             return this;
         }
 
@@ -2498,9 +2548,9 @@ public final class Locale implements Cloneable, Serializable {
          * @return A Locale.
          */
         public Locale build() {
-            BaseLocale baseloc = _locbld.getBaseLocale();
-            LocaleExtensions extensions = _locbld.getLocaleExtensions();
-            if (extensions.isEmpty() && baseloc.getVariant().length() > 0) {
+            BaseLocale baseloc = localeBuilder.getBaseLocale();
+            LocaleExtensions extensions = localeBuilder.getLocaleExtensions();
+            if (extensions == null && baseloc.getVariant().length() > 0) {
                 extensions = getCompatibilityExtensions(baseloc.getLanguage(), baseloc.getScript(),
                         baseloc.getRegion(), baseloc.getVariant());
             }
diff --git a/jdk/src/share/classes/java/util/ResourceBundle.java b/jdk/src/share/classes/java/util/ResourceBundle.java
index 9fbdbe1626d..51b84877dc7 100644
--- a/jdk/src/share/classes/java/util/ResourceBundle.java
+++ b/jdk/src/share/classes/java/util/ResourceBundle.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2011, Oracle and/or its affiliates. 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
@@ -57,7 +57,6 @@ import java.util.concurrent.ConcurrentMap;
 import java.util.jar.JarEntry;
 
 import sun.util.locale.BaseLocale;
-import sun.util.locale.LocaleExtensions;
 import sun.util.locale.LocaleObjectCache;
 
 
@@ -290,7 +289,7 @@ public abstract class ResourceBundle {
      * name for compatibility with some workarounds for bug 4212439.
      */
     private static final ConcurrentMap cacheList
-        = new ConcurrentHashMap(INITIAL_CACHE_SIZE);
+        = new ConcurrentHashMap<>(INITIAL_CACHE_SIZE);
 
     /**
      * Queue for reference objects referring to class loaders or bundles.
@@ -1755,7 +1754,7 @@ public abstract class ResourceBundle {
      * @since 1.6
      */
     public Set keySet() {
-        Set keys = new HashSet();
+        Set keys = new HashSet<>();
         for (ResourceBundle rb = this; rb != null; rb = rb.parent) {
             keys.addAll(rb.handleKeySet());
         }
@@ -1783,7 +1782,7 @@ public abstract class ResourceBundle {
         if (keySet == null) {
             synchronized (this) {
                 if (keySet == null) {
-                    Set keys = new HashSet();
+                    Set keys = new HashSet<>();
                     Enumeration enumKeys = getKeys();
                     while (enumKeys.hasMoreElements()) {
                         String key = enumKeys.nextElement();
@@ -2301,7 +2300,7 @@ public abstract class ResourceBundle {
             if (baseName == null) {
                 throw new NullPointerException();
             }
-            return new ArrayList(CANDIDATES_CACHE.get(locale.getBaseLocale()));
+            return new ArrayList<>(CANDIDATES_CACHE.get(locale.getBaseLocale()));
         }
 
         private static final CandidateListCache CANDIDATES_CACHE = new CandidateListCache();
@@ -2327,14 +2326,14 @@ public abstract class ResourceBundle {
                 if (language.equals("nb") || isNorwegianBokmal) {
                     List tmpList = getDefaultList("nb", script, region, variant);
                     // Insert a locale replacing "nb" with "no" for every list entry
-                    List bokmalList = new LinkedList();
+                    List bokmalList = new LinkedList<>();
                     for (Locale l : tmpList) {
                         bokmalList.add(l);
                         if (l.getLanguage().length() == 0) {
                             break;
                         }
                         bokmalList.add(Locale.getInstance("no", l.getScript(), l.getCountry(),
-                                l.getVariant(), LocaleExtensions.EMPTY_EXTENSIONS));
+                                l.getVariant(), null));
                     }
                     return bokmalList;
                 } else if (language.equals("nn") || isNorwegianNynorsk) {
@@ -2374,7 +2373,7 @@ public abstract class ResourceBundle {
                 List variants = null;
 
                 if (variant.length() > 0) {
-                    variants = new LinkedList();
+                    variants = new LinkedList<>();
                     int idx = variant.length();
                     while (idx != -1) {
                         variants.add(variant.substring(0, idx));
@@ -2382,32 +2381,32 @@ public abstract class ResourceBundle {
                     }
                 }
 
-                LinkedList list = new LinkedList();
+                List list = new LinkedList<>();
 
                 if (variants != null) {
                     for (String v : variants) {
-                        list.add(Locale.getInstance(language, script, region, v, LocaleExtensions.EMPTY_EXTENSIONS));
+                        list.add(Locale.getInstance(language, script, region, v, null));
                     }
                 }
                 if (region.length() > 0) {
-                    list.add(Locale.getInstance(language, script, region, "", LocaleExtensions.EMPTY_EXTENSIONS));
+                    list.add(Locale.getInstance(language, script, region, "", null));
                 }
                 if (script.length() > 0) {
-                    list.add(Locale.getInstance(language, script, "", "", LocaleExtensions.EMPTY_EXTENSIONS));
+                    list.add(Locale.getInstance(language, script, "", "", null));
 
                     // With script, after truncating variant, region and script,
                     // start over without script.
                     if (variants != null) {
                         for (String v : variants) {
-                            list.add(Locale.getInstance(language, "", region, v, LocaleExtensions.EMPTY_EXTENSIONS));
+                            list.add(Locale.getInstance(language, "", region, v, null));
                         }
                     }
                     if (region.length() > 0) {
-                        list.add(Locale.getInstance(language, "", region, "", LocaleExtensions.EMPTY_EXTENSIONS));
+                        list.add(Locale.getInstance(language, "", region, "", null));
                     }
                 }
                 if (language.length() > 0) {
-                    list.add(Locale.getInstance(language, "", "", "", LocaleExtensions.EMPTY_EXTENSIONS));
+                    list.add(Locale.getInstance(language, "", "", "", null));
                 }
                 // Add root locale at the end
                 list.add(Locale.ROOT);
diff --git a/jdk/src/share/classes/javax/sound/midi/MidiSystem.java b/jdk/src/share/classes/javax/sound/midi/MidiSystem.java
index 864129770e1..7a3b186d92e 100644
--- a/jdk/src/share/classes/javax/sound/midi/MidiSystem.java
+++ b/jdk/src/share/classes/javax/sound/midi/MidiSystem.java
@@ -239,6 +239,12 @@ public class MidiSystem {
      * If a suitable MIDI port is not available, the Receiver is
      * retrieved from an installed synthesizer.
      *
+     * 

If a native receiver provided by the default device does not implement + * the {@code MidiDeviceReceiver} interface, it will be wrapped in a + * wrapper class that implements the {@code MidiDeviceReceiver} interface. + * The corresponding {@code Receiver} method calls will be forwarded + * to the native receiver. + * *

If this method returns successfully, the {@link * javax.sound.midi.MidiDevice MidiDevice} the * Receiver belongs to is opened implicitly, if it is @@ -284,7 +290,13 @@ public class MidiSystem { * it is used to identify the device that provides the default transmitter. * For details, refer to the {@link MidiSystem class description}. * - * If this method returns successfully, the {@link + *

If a native transmitter provided by the default device does not implement + * the {@code MidiDeviceTransmitter} interface, it will be wrapped in a + * wrapper class that implements the {@code MidiDeviceTransmitter} interface. + * The corresponding {@code Transmitter} method calls will be forwarded + * to the native transmitter. + * + *

If this method returns successfully, the {@link * javax.sound.midi.MidiDevice MidiDevice} the * Transmitter belongs to is opened implicitly, if it * is not already open. It is possible to close an implicitly diff --git a/jdk/src/share/classes/javax/swing/Painter.java b/jdk/src/share/classes/javax/swing/Painter.java index ca9c214f3e6..7b2e3ef11ef 100644 --- a/jdk/src/share/classes/javax/swing/Painter.java +++ b/jdk/src/share/classes/javax/swing/Painter.java @@ -45,14 +45,16 @@ import java.awt.Graphics2D; * Painter that only works with subclasses of {@link java.awt.Component}. * In that case, when the Painter is declared, you may declare that * it requires a Component, allowing the paint method to be type safe. Ex: - *


- *     Painter p = new Painter() {
- *         public void paint(Graphics2D g, Component c, int width, int height) {
- *             g.setColor(c.getBackground());
- *             //and so forth
- *         }
+ * 
+ * {@code
+ * Painter p = new Painter() {
+ *     public void paint(Graphics2D g, Component c, int width, int height) {
+ *         g.setColor(c.getBackground());
+ *         //and so forth
  *     }
- * 

+ * } + * } + *

* *

This interface makes no guarantees of threadsafety.

* diff --git a/jdk/src/share/classes/javax/swing/border/TitledBorder.java b/jdk/src/share/classes/javax/swing/border/TitledBorder.java index 929fbd07f5b..e20c40384ec 100644 --- a/jdk/src/share/classes/javax/swing/border/TitledBorder.java +++ b/jdk/src/share/classes/javax/swing/border/TitledBorder.java @@ -240,9 +240,7 @@ public class TitledBorder extends AbstractBorder int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING; JLabel label = getLabel(c); Dimension size = label.getPreferredSize(); - Insets insets = (border != null) - ? border.getBorderInsets(c) - : new Insets(0, 0, 0, 0); + Insets insets = getBorderInsets(border, c, new Insets(0, 0, 0, 0)); int borderX = x + edge; int borderY = y + edge; @@ -348,17 +346,8 @@ public class TitledBorder extends AbstractBorder */ public Insets getBorderInsets(Component c, Insets insets) { Border border = getBorder(); - if (border == null) { - insets.set(0, 0, 0, 0); - } - else if (border instanceof AbstractBorder) { - AbstractBorder ab = (AbstractBorder) border; - insets = ab.getBorderInsets(c, insets); - } - else { - Insets i = border.getBorderInsets(c); - insets.set(i.top, i.left, i.bottom, i.right); - } + insets = getBorderInsets(border, c, insets); + String title = getTitle(); if ((title != null) && !title.isEmpty()) { int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING; @@ -588,9 +577,7 @@ public class TitledBorder extends AbstractBorder int edge = (border instanceof TitledBorder) ? 0 : EDGE_SPACING; JLabel label = getLabel(c); Dimension size = label.getPreferredSize(); - Insets insets = (border != null) - ? border.getBorderInsets(c) - : new Insets(0, 0, 0, 0); + Insets insets = getBorderInsets(border, c, new Insets(0, 0, 0, 0)); int baseline = label.getBaseline(size.width, size.height); switch (getPosition()) { @@ -728,4 +715,19 @@ public class TitledBorder extends AbstractBorder this.label.setEnabled(c.isEnabled()); return this.label; } + + private static Insets getBorderInsets(Border border, Component c, Insets insets) { + if (border == null) { + insets.set(0, 0, 0, 0); + } + else if (border instanceof AbstractBorder) { + AbstractBorder ab = (AbstractBorder) border; + insets = ab.getBorderInsets(c, insets); + } + else { + Insets i = border.getBorderInsets(c); + insets.set(i.top, i.left, i.bottom, i.right); + } + return insets; + } } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java index 15d78f96267..8d01287e295 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java @@ -335,9 +335,8 @@ public class BasicColorChooserUI extends ColorChooserUI } /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of . + * Instantiate it only within subclasses of {@code BasicColorChooserUI}. */ public class PropertyHandler implements PropertyChangeListener { public void propertyChange(PropertyChangeEvent e) { diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java index e99b7525c46..e1435a5618e 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java @@ -186,9 +186,8 @@ public class BasicDesktopIconUI extends DesktopIconUI { /** * Listens for mouse movements and acts on them. * - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of . + * Instantiate it only within subclasses of {@code BasicDesktopIconUI}. */ public class MouseInputHandler extends MouseInputAdapter { diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java index c1370303d7d..c735fe812f9 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java @@ -455,6 +455,8 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener } int dka = label.getDisplayedMnemonic(); inputMap.put(KeyStroke.getKeyStroke(dka, ActionEvent.ALT_MASK, true), RELEASE); + // Need this when the sticky keys are enabled + inputMap.put(KeyStroke.getKeyStroke(dka, 0, true), RELEASE); // Need this if ALT is released before the accelerator inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ALT, 0, true), RELEASE); label.requestFocus(); @@ -467,7 +469,9 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener InputMap inputMap = SwingUtilities.getUIInputMap(label, JComponent.WHEN_FOCUSED); if (inputMap != null) { // inputMap should never be null. - inputMap.remove(KeyStroke.getKeyStroke(label.getDisplayedMnemonic(), ActionEvent.ALT_MASK, true)); + int dka = label.getDisplayedMnemonic(); + inputMap.remove(KeyStroke.getKeyStroke(dka, ActionEvent.ALT_MASK, true)); + inputMap.remove(KeyStroke.getKeyStroke(dka, 0, true)); inputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ALT, 0, true)); } if (labelFor instanceof Container && diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java index 054c1e3dfc8..a4160f962ac 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java @@ -1555,9 +1555,8 @@ public class BasicListUI extends ListUI } /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicTableUI. + * Instantiate it only within subclasses of {@code BasicListUI}. */ public class FocusHandler implements FocusListener { diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java index e7f6a5a3ad4..6a0b024ceeb 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java @@ -911,9 +911,8 @@ public class BasicOptionPaneUI extends OptionPaneUI { * right. If syncAllWidths is true, the widths of each * component will be set to the largest preferred size width. * - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicOptionPaneUI. + * Instantiate it only within subclasses of {@code BasicOptionPaneUI}. */ public static class ButtonAreaLayout implements LayoutManager { protected boolean syncAllWidths; @@ -1115,9 +1114,8 @@ public class BasicOptionPaneUI extends OptionPaneUI { /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicOptionPaneUI. + * Instantiate it only within subclasses of {@code BasicOptionPaneUI}. */ public class PropertyChangeHandler implements PropertyChangeListener { /** @@ -1161,9 +1159,8 @@ public class BasicOptionPaneUI extends OptionPaneUI { } /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicOptionPaneUI. + * Instantiate it only within subclasses of {@code BasicOptionPaneUI}. */ public class ButtonActionListener implements ActionListener { protected int buttonIndex; diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java index 150f874e89b..09a45f876e4 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java @@ -1211,9 +1211,8 @@ public class BasicProgressBarUI extends ProgressBarUI { /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicProgressBarUI. + * Instantiate it only within subclasses of {@code BasicProgressBarUI}. */ public class ChangeHandler implements ChangeListener { // NOTE: This class exists only for backward compatability. All diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java index 9d2b26d483d..23fa230d406 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java @@ -88,9 +88,8 @@ public class BasicTableHeaderUI extends TableHeaderUI { }; /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicTableUI. + * Instantiate it only within subclasses of {@code BasicTableHeaderUI}. */ public class MouseInputHandler implements MouseInputListener { diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java index 29932c7aa3d..ad8a34d1e17 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java @@ -730,9 +730,8 @@ public class BasicTableUI extends TableUI // /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicTableUI. + * Instantiate it only within subclasses of {@code BasicTableUI}. *

As of Java 2 platform v1.3 this class is no longer used. * Instead JTable * overrides processKeyBinding to dispatch the event to @@ -761,9 +760,8 @@ public class BasicTableUI extends TableUI // /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of BasicTableUI. + * Instantiate it only within subclasses of {@code BasicTableUI}. */ public class FocusHandler implements FocusListener { // NOTE: This class exists only for backward compatability. All @@ -784,7 +782,6 @@ public class BasicTableUI extends TableUI // /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. * Instantiate it only within subclasses of BasicTableUI. */ diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java index 3a7ef7f0d10..e97416eca1e 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java @@ -199,9 +199,8 @@ public class MetalComboBoxUI extends BasicComboBoxUI { } /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of . + * Instantiate it only within subclasses of {@code MetalComboBoxUI}. */ public class MetalPropertyChangeListener extends BasicComboBoxUI.PropertyChangeHandler { public void propertyChange(PropertyChangeEvent e) { @@ -244,9 +243,8 @@ public class MetalComboBoxUI extends BasicComboBoxUI { } /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of . + * Instantiate it only within subclasses of {@code MetalComboBoxUI}. */ public class MetalComboBoxLayoutManager extends BasicComboBoxUI.ComboBoxLayoutManager { public void layoutContainer( Container parent ) { @@ -356,9 +354,8 @@ public class MetalComboBoxUI extends BasicComboBoxUI { } /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of . + * Instantiate it only within subclasses of {@code MetalComboBoxUI}. * * This class is now obsolete and doesn't do anything and * is only included for backwards API compatibility. Do not call or diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java index 2cf52393b4c..1602ad6fe5b 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java @@ -1196,9 +1196,8 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI { } /** - * This inner class is marked "public" due to a compiler bug. * This class should be treated as a "protected" inner class. - * Instantiate it only within subclasses of MetalTabbedPaneUI. + * Instantiate it only within subclasses of {@code MetalTabbedPaneUI}. */ public class TabbedPaneLayout extends BasicTabbedPaneUI.TabbedPaneLayout { diff --git a/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java b/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java index 1e5403defe8..8b27ec93e4d 100644 --- a/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java +++ b/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java @@ -172,6 +172,11 @@ class GlyphPainter2 extends GlyphView.GlyphPainter { //italic carets and we do not. TextHitInfo hit = layout.hitTestChar(x - (float)alloc.getX(), 0); int pos = hit.getInsertionIndex(); + + if (pos == v.getEndOffset()) { + pos--; + } + biasReturn[0] = hit.isLeadingEdge() ? Position.Bias.Forward : Position.Bias.Backward; return pos + v.getStartOffset(); } diff --git a/jdk/src/share/classes/javax/swing/text/GlyphView.java b/jdk/src/share/classes/javax/swing/text/GlyphView.java index d73ab6f618b..624f737b376 100644 --- a/jdk/src/share/classes/javax/swing/text/GlyphView.java +++ b/jdk/src/share/classes/javax/swing/text/GlyphView.java @@ -541,7 +541,30 @@ public class GlyphView extends View implements TabableView, Cloneable { */ @Override public float getMinimumSpan(int axis) { - return super.getMinimumSpan(axis); + switch (axis) { + case View.X_AXIS: + if (minimumSpan < 0) { + minimumSpan = 0; + int p0 = getStartOffset(); + int p1 = getEndOffset(); + while (p1 > p0) { + int breakSpot = getBreakSpot(p0, p1); + if (breakSpot == BreakIterator.DONE) { + // the rest of the view is non-breakable + breakSpot = p0; + } + minimumSpan = Math.max(minimumSpan, + getPartialSpan(breakSpot, p1)); + // Note: getBreakSpot returns the *last* breakspot + p1 = breakSpot - 1; + } + } + return minimumSpan; + case View.Y_AXIS: + return super.getMinimumSpan(axis); + default: + throw new IllegalArgumentException("Invalid axis: " + axis); + } } /** diff --git a/jdk/src/share/classes/javax/swing/text/ParagraphView.java b/jdk/src/share/classes/javax/swing/text/ParagraphView.java index d06b3bc2bed..b88dd8731bb 100644 --- a/jdk/src/share/classes/javax/swing/text/ParagraphView.java +++ b/jdk/src/share/classes/javax/swing/text/ParagraphView.java @@ -721,7 +721,34 @@ public class ParagraphView extends FlowView implements TabExpander { @Override protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) { - return super.calculateMinorAxisRequirements(axis, r); + r = super.calculateMinorAxisRequirements(axis, r); + + float min = 0; + float glue = 0; + int n = getLayoutViewCount(); + for (int i = 0; i < n; i++) { + View v = getLayoutView(i); + float span = v.getMinimumSpan(axis); + if (v.getBreakWeight(axis, 0, v.getMaximumSpan(axis)) > View.BadBreakWeight) { + // find the longest non-breakable fragments at the view edges + int p0 = v.getStartOffset(); + int p1 = v.getEndOffset(); + float start = findEdgeSpan(v, axis, p0, p0, p1); + float end = findEdgeSpan(v, axis, p1, p0, p1); + glue += start; + min = Math.max(min, Math.max(span, glue)); + glue = end; + } else { + // non-breakable view + glue += span; + min = Math.max(min, glue); + } + } + r.minimum = Math.max(r.minimum, (int) min); + r.preferred = Math.max(r.minimum, r.preferred); + r.maximum = Math.max(r.preferred, r.maximum); + + return r; } /** diff --git a/jdk/src/share/classes/javax/swing/text/Utilities.java b/jdk/src/share/classes/javax/swing/text/Utilities.java index da77d834b43..aaea4812313 100644 --- a/jdk/src/share/classes/javax/swing/text/Utilities.java +++ b/jdk/src/share/classes/javax/swing/text/Utilities.java @@ -395,10 +395,10 @@ public class Utilities { // the length of the string measured as a whole may differ from // the sum of individual character lengths, for example if // fractional metrics are enabled; and we must guard from this. - while (metrics.charsWidth(txt, txtOffset, offset + 1) > (x - x0)) { + while (offset > 0 && metrics.charsWidth(txt, txtOffset, offset) > (x - x0)) { offset--; } - return (offset < 0 ? 0 : offset); + return offset; } currX = nextX; } diff --git a/jdk/src/share/classes/javax/swing/text/html/CSS.java b/jdk/src/share/classes/javax/swing/text/html/CSS.java index 5d62dcdfa47..60efa6cc013 100644 --- a/jdk/src/share/classes/javax/swing/text/html/CSS.java +++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java @@ -62,7 +62,6 @@ import javax.swing.text.*; *

  • background-repeat *
  • background-position *
  • background - *
  • background-repeat *
  • text-decoration (with the exception of blink and overline) *
  • vertical-align (only sup and super) *
  • text-align (justify is treated as center) @@ -75,7 +74,18 @@ import javax.swing.text.*; *
  • padding-right *
  • padding-bottom *
  • padding-left + *
  • padding + *
  • border-top-style + *
  • border-right-style + *
  • border-bottom-style + *
  • border-left-style *
  • border-style (only supports inset, outset and none) + *
  • border-top-color + *
  • border-right-color + *
  • border-bottom-color + *
  • border-left-color + *
  • border-color + *
  • list-style-image *
  • list-style-type *
  • list-style-position * diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java index 48205eb35c5..2638f05bf17 100644 --- a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java +++ b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java @@ -966,6 +966,9 @@ class Parser implements DTDConstants { char data[] = {'&'}; return data; } + + boolean semicolon = false; + switch (ch) { case '\n': ln++; @@ -985,6 +988,8 @@ class Parser implements DTDConstants { break; case ';': + semicolon = true; + ch = readCh(); break; } @@ -1006,7 +1011,7 @@ class Parser implements DTDConstants { return new char[0]; } /* given that there is not a match restore the entity reference */ - String str = "&" + nm + ";"; + String str = "&" + nm + (semicolon ? ";" : ""); char b[] = new char[str.length()]; str.getChars(0, b.length, b, 0); diff --git a/jdk/src/share/classes/sun/swing/SwingUtilities2.java b/jdk/src/share/classes/sun/swing/SwingUtilities2.java index e786da7fbf6..fc7fbf43f13 100644 --- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java +++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java @@ -270,11 +270,10 @@ public class SwingUtilities2 { */ public static int getLeftSideBearing(JComponent c, FontMetrics fm, String string) { - int res = 0; - if (!string.isEmpty()) { - res = getLeftSideBearing(c, fm, string.charAt(0)); + if ((string == null) || (string.length() == 0)) { + return 0; } - return res; + return getLeftSideBearing(c, fm, string.charAt(0)); } /** diff --git a/jdk/src/share/classes/sun/util/locale/BaseLocale.java b/jdk/src/share/classes/sun/util/locale/BaseLocale.java index 2137dbd8691..6eee5829095 100644 --- a/jdk/src/share/classes/sun/util/locale/BaseLocale.java +++ b/jdk/src/share/classes/sun/util/locale/BaseLocale.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 @@ -38,38 +38,46 @@ public final class BaseLocale { public static final String SEP = "_"; private static final Cache CACHE = new Cache(); - public static final BaseLocale ROOT = BaseLocale.getInstance("", "", "", ""); - private String _language = ""; - private String _script = ""; - private String _region = ""; - private String _variant = ""; + private final String language; + private final String script; + private final String region; + private final String variant; - private transient volatile int _hash = 0; + private volatile int hash = 0; - private BaseLocale(String language, String script, String region, String variant) { - if (language != null) { - _language = AsciiUtil.toLowerString(language).intern(); - } - if (script != null) { - _script = AsciiUtil.toTitleString(script).intern(); - } - if (region != null) { - _region = AsciiUtil.toUpperString(region).intern(); - } - if (variant != null) { - _variant = variant.intern(); - } + // This method must be called only when creating the Locale.* constants. + private BaseLocale(String language, String region) { + this.language = language; + this.script = ""; + this.region = region; + this.variant = ""; } - public static BaseLocale getInstance(String language, String script, String region, String variant) { + private BaseLocale(String language, String script, String region, String variant) { + this.language = (language != null) ? LocaleUtils.toLowerString(language).intern() : ""; + this.script = (script != null) ? LocaleUtils.toTitleString(script).intern() : ""; + this.region = (region != null) ? LocaleUtils.toUpperString(region).intern() : ""; + this.variant = (variant != null) ? variant.intern() : ""; + } + + // Called for creating the Locale.* constants. No argument + // validation is performed. + public static BaseLocale createInstance(String language, String region) { + BaseLocale base = new BaseLocale(language, region); + CACHE.put(new Key(language, region), base); + return base; + } + + public static BaseLocale getInstance(String language, String script, + String region, String variant) { // JDK uses deprecated ISO639.1 language codes for he, yi and id if (language != null) { - if (AsciiUtil.caseIgnoreMatch(language, "he")) { + if (LocaleUtils.caseIgnoreMatch(language, "he")) { language = "iw"; - } else if (AsciiUtil.caseIgnoreMatch(language, "yi")) { + } else if (LocaleUtils.caseIgnoreMatch(language, "yi")) { language = "ji"; - } else if (AsciiUtil.caseIgnoreMatch(language, "id")) { + } else if (LocaleUtils.caseIgnoreMatch(language, "id")) { language = "in"; } } @@ -80,21 +88,22 @@ public final class BaseLocale { } public String getLanguage() { - return _language; + return language; } public String getScript() { - return _script; + return script; } public String getRegion() { - return _region; + return region; } public String getVariant() { - return _variant; + return variant; } + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -103,138 +112,178 @@ public final class BaseLocale { return false; } BaseLocale other = (BaseLocale)obj; - return hashCode() == other.hashCode() - && _language.equals(other._language) - && _script.equals(other._script) - && _region.equals(other._region) - && _variant.equals(other._variant); + return language == other.language + && script == other.script + && region == other.region + && variant == other.variant; } + @Override public String toString() { StringBuilder buf = new StringBuilder(); - if (_language.length() > 0) { + if (language.length() > 0) { buf.append("language="); - buf.append(_language); + buf.append(language); } - if (_script.length() > 0) { + if (script.length() > 0) { if (buf.length() > 0) { buf.append(", "); } buf.append("script="); - buf.append(_script); + buf.append(script); } - if (_region.length() > 0) { + if (region.length() > 0) { if (buf.length() > 0) { buf.append(", "); } buf.append("region="); - buf.append(_region); + buf.append(region); } - if (_variant.length() > 0) { + if (variant.length() > 0) { if (buf.length() > 0) { buf.append(", "); } buf.append("variant="); - buf.append(_variant); + buf.append(variant); } return buf.toString(); } + @Override public int hashCode() { - int h = _hash; + int h = hash; if (h == 0) { // Generating a hash value from language, script, region and variant - for (int i = 0; i < _language.length(); i++) { - h = 31*h + _language.charAt(i); - } - for (int i = 0; i < _script.length(); i++) { - h = 31*h + _script.charAt(i); - } - for (int i = 0; i < _region.length(); i++) { - h = 31*h + _region.charAt(i); - } - for (int i = 0; i < _variant.length(); i++) { - h = 31*h + _variant.charAt(i); - } - _hash = h; + h = language.hashCode(); + h = 31 * h + script.hashCode(); + h = 31 * h + region.hashCode(); + h = 31 * h + variant.hashCode(); + hash = h; } return h; } - private static class Key implements Comparable { - private String _lang = ""; - private String _scrt = ""; - private String _regn = ""; - private String _vart = ""; + private static final class Key implements Comparable { + private final String lang; + private final String scrt; + private final String regn; + private final String vart; + private final boolean normalized; + private final int hash; - private volatile int _hash; // Default to 0 + /** + * Creates a Key. language and region must be normalized + * (intern'ed in the proper case). + */ + private Key(String language, String region) { + assert language.intern() == language + && region.intern() == region; - public Key(String language, String script, String region, String variant) { - if (language != null) { - _lang = language; - } - if (script != null) { - _scrt = script; - } - if (region != null) { - _regn = region; - } - if (variant != null) { - _vart = variant; + lang = language; + scrt = ""; + regn = region; + vart = ""; + this.normalized = true; + + int h = language.hashCode(); + if (region != "") { + int len = region.length(); + for (int i = 0; i < len; i++) { + h = 31 * h + LocaleUtils.toLower(region.charAt(i)); + } } + hash = h; } + public Key(String language, String script, String region, String variant) { + this(language, script, region, variant, false); + } + + private Key(String language, String script, String region, + String variant, boolean normalized) { + int h = 0; + if (language != null) { + lang = language; + int len = language.length(); + for (int i = 0; i < len; i++) { + h = 31*h + LocaleUtils.toLower(language.charAt(i)); + } + } else { + lang = ""; + } + if (script != null) { + scrt = script; + int len = script.length(); + for (int i = 0; i < len; i++) { + h = 31*h + LocaleUtils.toLower(script.charAt(i)); + } + } else { + scrt = ""; + } + if (region != null) { + regn = region; + int len = region.length(); + for (int i = 0; i < len; i++) { + h = 31*h + LocaleUtils.toLower(region.charAt(i)); + } + } else { + regn = ""; + } + if (variant != null) { + vart = variant; + int len = variant.length(); + for (int i = 0; i < len; i++) { + h = 31*h + variant.charAt(i); + } + } else { + vart = ""; + } + hash = h; + this.normalized = normalized; + } + + @Override public boolean equals(Object obj) { return (this == obj) || (obj instanceof Key) - && AsciiUtil.caseIgnoreMatch(((Key)obj)._lang, this._lang) - && AsciiUtil.caseIgnoreMatch(((Key)obj)._scrt, this._scrt) - && AsciiUtil.caseIgnoreMatch(((Key)obj)._regn, this._regn) - && ((Key)obj)._vart.equals(_vart); // variant is case sensitive in JDK! + && this.hash == ((Key)obj).hash + && LocaleUtils.caseIgnoreMatch(((Key)obj).lang, this.lang) + && LocaleUtils.caseIgnoreMatch(((Key)obj).scrt, this.scrt) + && LocaleUtils.caseIgnoreMatch(((Key)obj).regn, this.regn) + && ((Key)obj).vart.equals(vart); // variant is case sensitive in JDK! } + @Override public int compareTo(Key other) { - int res = AsciiUtil.caseIgnoreCompare(this._lang, other._lang); + int res = LocaleUtils.caseIgnoreCompare(this.lang, other.lang); if (res == 0) { - res = AsciiUtil.caseIgnoreCompare(this._scrt, other._scrt); + res = LocaleUtils.caseIgnoreCompare(this.scrt, other.scrt); if (res == 0) { - res = AsciiUtil.caseIgnoreCompare(this._regn, other._regn); + res = LocaleUtils.caseIgnoreCompare(this.regn, other.regn); if (res == 0) { - res = this._vart.compareTo(other._vart); + res = this.vart.compareTo(other.vart); } } } return res; } + @Override public int hashCode() { - int h = _hash; - if (h == 0) { - // Generating a hash value from language, script, region and variant - for (int i = 0; i < _lang.length(); i++) { - h = 31*h + AsciiUtil.toLower(_lang.charAt(i)); - } - for (int i = 0; i < _scrt.length(); i++) { - h = 31*h + AsciiUtil.toLower(_scrt.charAt(i)); - } - for (int i = 0; i < _regn.length(); i++) { - h = 31*h + AsciiUtil.toLower(_regn.charAt(i)); - } - for (int i = 0; i < _vart.length(); i++) { - h = 31*h + _vart.charAt(i); - } - _hash = h; - } - return h; + return hash; } public static Key normalize(Key key) { - String lang = AsciiUtil.toLowerString(key._lang).intern(); - String scrt = AsciiUtil.toTitleString(key._scrt).intern(); - String regn = AsciiUtil.toUpperString(key._regn).intern(); - String vart = key._vart.intern(); // preserve upper/lower cases + if (key.normalized) { + return key; + } - return new Key(lang, scrt, regn, vart); + String lang = LocaleUtils.toLowerString(key.lang).intern(); + String scrt = LocaleUtils.toTitleString(key.scrt).intern(); + String regn = LocaleUtils.toUpperString(key.regn).intern(); + String vart = key.vart.intern(); // preserve upper/lower cases + + return new Key(lang, scrt, regn, vart, true); } } @@ -243,13 +292,14 @@ public final class BaseLocale { public Cache() { } + @Override protected Key normalizeKey(Key key) { return Key.normalize(key); } + @Override protected BaseLocale createObject(Key key) { - return new BaseLocale(key._lang, key._scrt, key._regn, key._vart); + return new BaseLocale(key.lang, key.scrt, key.regn, key.vart); } - } } diff --git a/jdk/src/share/classes/sun/util/locale/Extension.java b/jdk/src/share/classes/sun/util/locale/Extension.java index 8d98faf2de5..7c984300fa0 100644 --- a/jdk/src/share/classes/sun/util/locale/Extension.java +++ b/jdk/src/share/classes/sun/util/locale/Extension.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 @@ -32,29 +32,34 @@ package sun.util.locale; -public class Extension { - private char _key; - protected String _value; +class Extension { + private final char key; + private String value, id; protected Extension(char key) { - _key = key; + this.key = key; } Extension(char key, String value) { - _key = key; - _value = value; + this.key = key; + setValue(value); + } + + protected void setValue(String value) { + this.value = value; + this.id = key + LanguageTag.SEP + value; } public char getKey() { - return _key; + return key; } public String getValue() { - return _value; + return value; } public String getID() { - return _key + LanguageTag.SEP + _value; + return id; } public String toString() { diff --git a/jdk/src/share/classes/sun/util/locale/InternalLocaleBuilder.java b/jdk/src/share/classes/sun/util/locale/InternalLocaleBuilder.java index 6c33036b98b..b5e0fb47865 100644 --- a/jdk/src/share/classes/sun/util/locale/InternalLocaleBuilder.java +++ b/jdk/src/share/classes/sun/util/locale/InternalLocaleBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 @@ -35,64 +35,66 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; public final class InternalLocaleBuilder { - private String _language = ""; - private String _script = ""; - private String _region = ""; - private String _variant = ""; + private static final CaseInsensitiveChar PRIVATEUSE_KEY + = new CaseInsensitiveChar(LanguageTag.PRIVATEUSE); - private static final CaseInsensitiveChar PRIVUSE_KEY = new CaseInsensitiveChar(LanguageTag.PRIVATEUSE.charAt(0)); + private String language = ""; + private String script = ""; + private String region = ""; + private String variant = ""; - private HashMap _extensions; - private HashSet _uattributes; - private HashMap _ukeywords; + private Map extensions; + private Set uattributes; + private Map ukeywords; public InternalLocaleBuilder() { } public InternalLocaleBuilder setLanguage(String language) throws LocaleSyntaxException { - if (language == null || language.length() == 0) { - _language = ""; + if (LocaleUtils.isEmpty(language)) { + this.language = ""; } else { if (!LanguageTag.isLanguage(language)) { throw new LocaleSyntaxException("Ill-formed language: " + language, 0); } - _language = language; + this.language = language; } return this; } public InternalLocaleBuilder setScript(String script) throws LocaleSyntaxException { - if (script == null || script.length() == 0) { - _script = ""; + if (LocaleUtils.isEmpty(script)) { + this.script = ""; } else { if (!LanguageTag.isScript(script)) { throw new LocaleSyntaxException("Ill-formed script: " + script, 0); } - _script = script; + this.script = script; } return this; } public InternalLocaleBuilder setRegion(String region) throws LocaleSyntaxException { - if (region == null || region.length() == 0) { - _region = ""; + if (LocaleUtils.isEmpty(region)) { + this.region = ""; } else { if (!LanguageTag.isRegion(region)) { throw new LocaleSyntaxException("Ill-formed region: " + region, 0); } - _region = region; + this.region = region; } return this; } public InternalLocaleBuilder setVariant(String variant) throws LocaleSyntaxException { - if (variant == null || variant.length() == 0) { - _variant = ""; + if (LocaleUtils.isEmpty(variant)) { + this.variant = ""; } else { // normalize separators to "_" String var = variant.replaceAll(LanguageTag.SEP, BaseLocale.SEP); @@ -100,7 +102,7 @@ public final class InternalLocaleBuilder { if (errIdx != -1) { throw new LocaleSyntaxException("Ill-formed variant: " + variant, errIdx); } - _variant = var; + this.variant = var; } return this; } @@ -110,10 +112,10 @@ public final class InternalLocaleBuilder { throw new LocaleSyntaxException("Ill-formed Unicode locale attribute: " + attribute); } // Use case insensitive string to prevent duplication - if (_uattributes == null) { - _uattributes = new HashSet(4); + if (uattributes == null) { + uattributes = new HashSet<>(4); } - _uattributes.add(new CaseInsensitiveString(attribute)); + uattributes.add(new CaseInsensitiveString(attribute)); return this; } @@ -121,8 +123,8 @@ public final class InternalLocaleBuilder { if (attribute == null || !UnicodeLocaleExtension.isAttribute(attribute)) { throw new LocaleSyntaxException("Ill-formed Unicode locale attribute: " + attribute); } - if (_uattributes != null) { - _uattributes.remove(new CaseInsensitiveString(attribute)); + if (uattributes != null) { + uattributes.remove(new CaseInsensitiveString(attribute)); } return this; } @@ -134,9 +136,9 @@ public final class InternalLocaleBuilder { CaseInsensitiveString cikey = new CaseInsensitiveString(key); if (type == null) { - if (_ukeywords != null) { + if (ukeywords != null) { // null type is used for remove the key - _ukeywords.remove(cikey); + ukeywords.remove(cikey); } } else { if (type.length() != 0) { @@ -147,15 +149,17 @@ public final class InternalLocaleBuilder { while (!itr.isDone()) { String s = itr.current(); if (!UnicodeLocaleExtension.isTypeSubtag(s)) { - throw new LocaleSyntaxException("Ill-formed Unicode locale keyword type: " + type, itr.currentStart()); + throw new LocaleSyntaxException("Ill-formed Unicode locale keyword type: " + + type, + itr.currentStart()); } itr.next(); } } - if (_ukeywords == null) { - _ukeywords = new HashMap(4); + if (ukeywords == null) { + ukeywords = new HashMap<>(4); } - _ukeywords.put(cikey, type); + ukeywords.put(cikey, type); } return this; } @@ -167,21 +171,21 @@ public final class InternalLocaleBuilder { throw new LocaleSyntaxException("Ill-formed extension key: " + singleton); } - boolean remove = (value == null || value.length() == 0); + boolean remove = LocaleUtils.isEmpty(value); CaseInsensitiveChar key = new CaseInsensitiveChar(singleton); if (remove) { if (UnicodeLocaleExtension.isSingletonChar(key.value())) { // clear entire Unicode locale extension - if (_uattributes != null) { - _uattributes.clear(); + if (uattributes != null) { + uattributes.clear(); } - if (_ukeywords != null) { - _ukeywords.clear(); + if (ukeywords != null) { + ukeywords.clear(); } } else { - if (_extensions != null && _extensions.containsKey(key)) { - _extensions.remove(key); + if (extensions != null && extensions.containsKey(key)) { + extensions.remove(key); } } } else { @@ -197,7 +201,8 @@ public final class InternalLocaleBuilder { validSubtag = LanguageTag.isExtensionSubtag(s); } if (!validSubtag) { - throw new LocaleSyntaxException("Ill-formed extension value: " + s, itr.currentStart()); + throw new LocaleSyntaxException("Ill-formed extension value: " + s, + itr.currentStart()); } itr.next(); } @@ -205,10 +210,10 @@ public final class InternalLocaleBuilder { if (UnicodeLocaleExtension.isSingletonChar(key.value())) { setUnicodeLocaleExtension(val); } else { - if (_extensions == null) { - _extensions = new HashMap(4); + if (extensions == null) { + extensions = new HashMap<>(4); } - _extensions.put(key, val); + extensions.put(key, val); } } return this; @@ -218,7 +223,7 @@ public final class InternalLocaleBuilder { * Set extension/private subtags in a single string representation */ public InternalLocaleBuilder setExtensions(String subtags) throws LocaleSyntaxException { - if (subtags == null || subtags.length() == 0) { + if (LocaleUtils.isEmpty(subtags)) { clearExtensions(); return this; } @@ -252,11 +257,12 @@ public final class InternalLocaleBuilder { } if (parsed < start) { - throw new LocaleSyntaxException("Incomplete extension '" + singleton + "'", start); + throw new LocaleSyntaxException("Incomplete extension '" + singleton + "'", + start); } if (extensions == null) { - extensions = new ArrayList(4); + extensions = new ArrayList<>(4); } extensions.add(sb.toString()); } else { @@ -281,7 +287,9 @@ public final class InternalLocaleBuilder { itr.next(); } if (parsed <= start) { - throw new LocaleSyntaxException("Incomplete privateuse:" + subtags.substring(start), start); + throw new LocaleSyntaxException("Incomplete privateuse:" + + subtags.substring(start), + start); } else { privateuse = sb.toString(); } @@ -289,7 +297,9 @@ public final class InternalLocaleBuilder { } if (!itr.isDone()) { - throw new LocaleSyntaxException("Ill-formed extension subtags:" + subtags.substring(itr.currentStart()), itr.currentStart()); + throw new LocaleSyntaxException("Ill-formed extension subtags:" + + subtags.substring(itr.currentStart()), + itr.currentStart()); } return setExtensions(extensions, privateuse); @@ -302,30 +312,31 @@ public final class InternalLocaleBuilder { private InternalLocaleBuilder setExtensions(List bcpExtensions, String privateuse) { clearExtensions(); - if (bcpExtensions != null && bcpExtensions.size() > 0) { - HashSet processedExntensions = new HashSet(bcpExtensions.size()); + if (!LocaleUtils.isEmpty(bcpExtensions)) { + Set done = new HashSet<>(bcpExtensions.size()); for (String bcpExt : bcpExtensions) { - CaseInsensitiveChar key = new CaseInsensitiveChar(bcpExt.charAt(0)); + CaseInsensitiveChar key = new CaseInsensitiveChar(bcpExt); // ignore duplicates - if (!processedExntensions.contains(key)) { + if (!done.contains(key)) { // each extension string contains singleton, e.g. "a-abc-def" if (UnicodeLocaleExtension.isSingletonChar(key.value())) { setUnicodeLocaleExtension(bcpExt.substring(2)); } else { - if (_extensions == null) { - _extensions = new HashMap(4); + if (extensions == null) { + extensions = new HashMap<>(4); } - _extensions.put(key, bcpExt.substring(2)); + extensions.put(key, bcpExt.substring(2)); } } + done.add(key); } } if (privateuse != null && privateuse.length() > 0) { // privateuse string contains prefix, e.g. "x-abc-def" - if (_extensions == null) { - _extensions = new HashMap(1); + if (extensions == null) { + extensions = new HashMap<>(1); } - _extensions.put(new CaseInsensitiveChar(privateuse.charAt(0)), privateuse.substring(2)); + extensions.put(new CaseInsensitiveChar(privateuse), privateuse.substring(2)); } return this; @@ -336,24 +347,25 @@ public final class InternalLocaleBuilder { */ public InternalLocaleBuilder setLanguageTag(LanguageTag langtag) { clear(); - if (langtag.getExtlangs().size() > 0) { - _language = langtag.getExtlangs().get(0); + if (!langtag.getExtlangs().isEmpty()) { + language = langtag.getExtlangs().get(0); } else { - String language = langtag.getLanguage(); - if (!language.equals(LanguageTag.UNDETERMINED)) { - _language = language; + String lang = langtag.getLanguage(); + if (!lang.equals(LanguageTag.UNDETERMINED)) { + language = lang; } } - _script = langtag.getScript(); - _region = langtag.getRegion(); + script = langtag.getScript(); + region = langtag.getRegion(); List bcpVariants = langtag.getVariants(); - if (bcpVariants.size() > 0) { + if (!bcpVariants.isEmpty()) { StringBuilder var = new StringBuilder(bcpVariants.get(0)); - for (int i = 1; i < bcpVariants.size(); i++) { + int size = bcpVariants.size(); + for (int i = 1; i < size; i++) { var.append(BaseLocale.SEP).append(bcpVariants.get(i)); } - _variant = var.toString(); + variant = var.toString(); } setExtensions(langtag.getExtensions(), langtag.getPrivateuse()); @@ -361,7 +373,7 @@ public final class InternalLocaleBuilder { return this; } - public InternalLocaleBuilder setLocale(BaseLocale base, LocaleExtensions extensions) throws LocaleSyntaxException { + public InternalLocaleBuilder setLocale(BaseLocale base, LocaleExtensions localeExtensions) throws LocaleSyntaxException { String language = base.getLanguage(); String script = base.getScript(); String region = base.getRegion(); @@ -373,14 +385,14 @@ public final class InternalLocaleBuilder { if (language.equals("ja") && region.equals("JP") && variant.equals("JP")) { // When locale ja_JP_JP is created, ca-japanese is always there. // The builder ignores the variant "JP" - assert("japanese".equals(extensions.getUnicodeLocaleType("ca"))); + assert("japanese".equals(localeExtensions.getUnicodeLocaleType("ca"))); variant = ""; } // Exception 2 - th_TH_TH else if (language.equals("th") && region.equals("TH") && variant.equals("TH")) { // When locale th_TH_TH is created, nu-thai is always there. // The builder ignores the variant "TH" - assert("thai".equals(extensions.getUnicodeLocaleType("nu"))); + assert("thai".equals(localeExtensions.getUnicodeLocaleType("nu"))); variant = ""; } // Exception 3 - no_NO_NY @@ -415,36 +427,36 @@ public final class InternalLocaleBuilder { // The input locale is validated at this point. // Now, updating builder's internal fields. - _language = language; - _script = script; - _region = region; - _variant = variant; + this.language = language; + this.script = script; + this.region = region; + this.variant = variant; clearExtensions(); - Set extKeys = (extensions == null) ? null : extensions.getKeys(); + Set extKeys = (localeExtensions == null) ? null : localeExtensions.getKeys(); if (extKeys != null) { - // map extensions back to builder's internal format + // map localeExtensions back to builder's internal format for (Character key : extKeys) { - Extension e = extensions.getExtension(key); + Extension e = localeExtensions.getExtension(key); if (e instanceof UnicodeLocaleExtension) { UnicodeLocaleExtension ue = (UnicodeLocaleExtension)e; for (String uatr : ue.getUnicodeLocaleAttributes()) { - if (_uattributes == null) { - _uattributes = new HashSet(4); + if (uattributes == null) { + uattributes = new HashSet<>(4); } - _uattributes.add(new CaseInsensitiveString(uatr)); + uattributes.add(new CaseInsensitiveString(uatr)); } for (String ukey : ue.getUnicodeLocaleKeys()) { - if (_ukeywords == null) { - _ukeywords = new HashMap(4); + if (ukeywords == null) { + ukeywords = new HashMap<>(4); } - _ukeywords.put(new CaseInsensitiveString(ukey), ue.getUnicodeLocaleType(ukey)); + ukeywords.put(new CaseInsensitiveString(ukey), ue.getUnicodeLocaleType(ukey)); } } else { - if (_extensions == null) { - _extensions = new HashMap(4); + if (extensions == null) { + extensions = new HashMap<>(4); } - _extensions.put(new CaseInsensitiveChar(key.charValue()), e.getValue()); + extensions.put(new CaseInsensitiveChar(key), e.getValue()); } } } @@ -452,37 +464,37 @@ public final class InternalLocaleBuilder { } public InternalLocaleBuilder clear() { - _language = ""; - _script = ""; - _region = ""; - _variant = ""; + language = ""; + script = ""; + region = ""; + variant = ""; clearExtensions(); return this; } public InternalLocaleBuilder clearExtensions() { - if (_extensions != null) { - _extensions.clear(); + if (extensions != null) { + extensions.clear(); } - if (_uattributes != null) { - _uattributes.clear(); + if (uattributes != null) { + uattributes.clear(); } - if (_ukeywords != null) { - _ukeywords.clear(); + if (ukeywords != null) { + ukeywords.clear(); } return this; } public BaseLocale getBaseLocale() { - String language = _language; - String script = _script; - String region = _region; - String variant = _variant; + String language = this.language; + String script = this.script; + String region = this.region; + String variant = this.variant; // Special private use subtag sequence identified by "lvariant" will be // interpreted as Java variant. - if (_extensions != null) { - String privuse = _extensions.get(PRIVUSE_KEY); + if (extensions != null) { + String privuse = extensions.get(PRIVATEUSE_KEY); if (privuse != null) { StringTokenIterator itr = new StringTokenIterator(privuse, LanguageTag.SEP); boolean sawPrefix = false; @@ -492,7 +504,7 @@ public final class InternalLocaleBuilder { privVarStart = itr.currentStart(); break; } - if (AsciiUtil.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) { + if (LocaleUtils.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) { sawPrefix = true; } itr.next(); @@ -502,7 +514,8 @@ public final class InternalLocaleBuilder { if (sb.length() != 0) { sb.append(BaseLocale.SEP); } - sb.append(privuse.substring(privVarStart).replaceAll(LanguageTag.SEP, BaseLocale.SEP)); + sb.append(privuse.substring(privVarStart).replaceAll(LanguageTag.SEP, + BaseLocale.SEP)); variant = sb.toString(); } } @@ -512,13 +525,13 @@ public final class InternalLocaleBuilder { } public LocaleExtensions getLocaleExtensions() { - if ((_extensions == null || _extensions.size() == 0) - && (_uattributes == null || _uattributes.size() == 0) - && (_ukeywords == null || _ukeywords.size() == 0)) { - return LocaleExtensions.EMPTY_EXTENSIONS; + if (LocaleUtils.isEmpty(extensions) && LocaleUtils.isEmpty(uattributes) + && LocaleUtils.isEmpty(ukeywords)) { + return null; } - return new LocaleExtensions(_extensions, _uattributes, _ukeywords); + LocaleExtensions lext = new LocaleExtensions(extensions, uattributes, ukeywords); + return lext.isEmpty() ? null : lext; } /* @@ -540,7 +553,7 @@ public final class InternalLocaleBuilder { sawPrivuseVar = true; break; } - if (AsciiUtil.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) { + if (LocaleUtils.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) { prefixStart = itr.currentStart(); } itr.next(); @@ -576,11 +589,11 @@ public final class InternalLocaleBuilder { */ private void setUnicodeLocaleExtension(String subtags) { // wipe out existing attributes/keywords - if (_uattributes != null) { - _uattributes.clear(); + if (uattributes != null) { + uattributes.clear(); } - if (_ukeywords != null) { - _ukeywords.clear(); + if (ukeywords != null) { + ukeywords.clear(); } StringTokenIterator itr = new StringTokenIterator(subtags, LanguageTag.SEP); @@ -590,10 +603,10 @@ public final class InternalLocaleBuilder { if (!UnicodeLocaleExtension.isAttribute(itr.current())) { break; } - if (_uattributes == null) { - _uattributes = new HashSet(4); + if (uattributes == null) { + uattributes = new HashSet<>(4); } - _uattributes.add(new CaseInsensitiveString(itr.current())); + uattributes.add(new CaseInsensitiveString(itr.current())); itr.next(); } @@ -608,14 +621,14 @@ public final class InternalLocaleBuilder { // next keyword - emit previous one assert(typeStart == -1 || typeEnd != -1); type = (typeStart == -1) ? "" : subtags.substring(typeStart, typeEnd); - if (_ukeywords == null) { - _ukeywords = new HashMap(4); + if (ukeywords == null) { + ukeywords = new HashMap<>(4); } - _ukeywords.put(key, type); + ukeywords.put(key, type); // reset keyword info CaseInsensitiveString tmpKey = new CaseInsensitiveString(itr.current()); - key = _ukeywords.containsKey(tmpKey) ? null : tmpKey; + key = ukeywords.containsKey(tmpKey) ? null : tmpKey; typeStart = typeEnd = -1; } else { if (typeStart == -1) { @@ -627,7 +640,7 @@ public final class InternalLocaleBuilder { // 1. first keyword or // 2. next keyword, but previous one was duplicate key = new CaseInsensitiveString(itr.current()); - if (_ukeywords != null && _ukeywords.containsKey(key)) { + if (ukeywords != null && ukeywords.containsKey(key)) { // duplicate key = null; } @@ -638,10 +651,10 @@ public final class InternalLocaleBuilder { // last keyword assert(typeStart == -1 || typeEnd != -1); type = (typeStart == -1) ? "" : subtags.substring(typeStart, typeEnd); - if (_ukeywords == null) { - _ukeywords = new HashMap(4); + if (ukeywords == null) { + ukeywords = new HashMap<>(4); } - _ukeywords.put(key, type); + ukeywords.put(key, type); } break; } @@ -650,21 +663,24 @@ public final class InternalLocaleBuilder { } } - static class CaseInsensitiveString { - private String _s; + static final class CaseInsensitiveString { + private final String str, lowerStr; CaseInsensitiveString(String s) { - _s = s; + str = s; + lowerStr = LocaleUtils.toLowerString(s); } public String value() { - return _s; + return str; } + @Override public int hashCode() { - return AsciiUtil.toLowerString(_s).hashCode(); + return lowerStr.hashCode(); } + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -672,25 +688,36 @@ public final class InternalLocaleBuilder { if (!(obj instanceof CaseInsensitiveString)) { return false; } - return AsciiUtil.caseIgnoreMatch(_s, ((CaseInsensitiveString)obj).value()); + return lowerStr.equals(((CaseInsensitiveString)obj).lowerStr); } } - static class CaseInsensitiveChar { - private char _c; + static final class CaseInsensitiveChar { + private final char ch, lowerCh; + + /** + * Constructs a CaseInsensitiveChar with the first char of the + * given s. + */ + private CaseInsensitiveChar(String s) { + this(s.charAt(0)); + } CaseInsensitiveChar(char c) { - _c = c; + ch = c; + lowerCh = LocaleUtils.toLower(ch); } public char value() { - return _c; + return ch; } + @Override public int hashCode() { - return AsciiUtil.toLower(_c); + return lowerCh; } + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -698,8 +725,7 @@ public final class InternalLocaleBuilder { if (!(obj instanceof CaseInsensitiveChar)) { return false; } - return _c == AsciiUtil.toLower(((CaseInsensitiveChar)obj).value()); + return lowerCh == ((CaseInsensitiveChar)obj).lowerCh; } - } } diff --git a/jdk/src/share/classes/sun/util/locale/LanguageTag.java b/jdk/src/share/classes/sun/util/locale/LanguageTag.java index a3d9fd77b90..fc7b07b1b21 100644 --- a/jdk/src/share/classes/sun/util/locale/LanguageTag.java +++ b/jdk/src/share/classes/sun/util/locale/LanguageTag.java @@ -44,25 +44,25 @@ public class LanguageTag { // public static final String SEP = "-"; public static final String PRIVATEUSE = "x"; - public static String UNDETERMINED = "und"; + public static final String UNDETERMINED = "und"; public static final String PRIVUSE_VARIANT_PREFIX = "lvariant"; // // Language subtag fields // - private String _language = ""; // language subtag - private String _script = ""; // script subtag - private String _region = ""; // region subtag - private String _privateuse = ""; // privateuse + private String language = ""; // language subtag + private String script = ""; // script subtag + private String region = ""; // region subtag + private String privateuse = ""; // privateuse - private List _extlangs = Collections.emptyList(); // extlang subtags - private List _variants = Collections.emptyList(); // variant subtags - private List _extensions = Collections.emptyList(); // extensions + private List extlangs = Collections.emptyList(); // extlang subtags + private List variants = Collections.emptyList(); // variant subtags + private List extensions = Collections.emptyList(); // extensions // Map contains grandfathered tags and its preferred mappings from // http://www.ietf.org/rfc/rfc5646.txt - private static final Map GRANDFATHERED = - new HashMap(); + // Keys are lower-case strings. + private static final Map GRANDFATHERED = new HashMap<>(); static { // grandfathered = irregular ; non-redundant tags registered @@ -126,7 +126,7 @@ public class LanguageTag { {"zh-xiang", "hsn"}, }; for (String[] e : entries) { - GRANDFATHERED.put(new AsciiUtil.CaseInsensitiveKey(e[0]), e); + GRANDFATHERED.put(LocaleUtils.toLowerString(e[0]), e); } } @@ -188,7 +188,7 @@ public class LanguageTag { StringTokenIterator itr; // Check if the tag is grandfathered - String[] gfmap = GRANDFATHERED.get(new AsciiUtil.CaseInsensitiveKey(languageTag)); + String[] gfmap = GRANDFATHERED.get(LocaleUtils.toLowerString(languageTag)); if (gfmap != null) { // use preferred mapping itr = new StringTokenIterator(gfmap[1], SEP); @@ -210,11 +210,11 @@ public class LanguageTag { if (!itr.isDone() && !sts.isError()) { String s = itr.current(); - sts._errorIndex = itr.currentStart(); + sts.errorIndex = itr.currentStart(); if (s.length() == 0) { - sts._errorMsg = "Empty subtag"; + sts.errorMsg = "Empty subtag"; } else { - sts._errorMsg = "Invalid subtag: " + s; + sts.errorMsg = "Invalid subtag: " + s; } } @@ -235,8 +235,8 @@ public class LanguageTag { String s = itr.current(); if (isLanguage(s)) { found = true; - _language = s; - sts._parseLength = itr.currentEnd(); + language = s; + sts.parseLength = itr.currentEnd(); itr.next(); } @@ -256,14 +256,14 @@ public class LanguageTag { break; } found = true; - if (_extlangs.isEmpty()) { - _extlangs = new ArrayList(3); + if (extlangs.isEmpty()) { + extlangs = new ArrayList<>(3); } - _extlangs.add(s); - sts._parseLength = itr.currentEnd(); + extlangs.add(s); + sts.parseLength = itr.currentEnd(); itr.next(); - if (_extlangs.size() == 3) { + if (extlangs.size() == 3) { // Maximum 3 extlangs break; } @@ -282,8 +282,8 @@ public class LanguageTag { String s = itr.current(); if (isScript(s)) { found = true; - _script = s; - sts._parseLength = itr.currentEnd(); + script = s; + sts.parseLength = itr.currentEnd(); itr.next(); } @@ -300,8 +300,8 @@ public class LanguageTag { String s = itr.current(); if (isRegion(s)) { found = true; - _region = s; - sts._parseLength = itr.currentEnd(); + region = s; + sts.parseLength = itr.currentEnd(); itr.next(); } @@ -321,11 +321,11 @@ public class LanguageTag { break; } found = true; - if (_variants.isEmpty()) { - _variants = new ArrayList(3); + if (variants.isEmpty()) { + variants = new ArrayList<>(3); } - _variants.add(s); - sts._parseLength = itr.currentEnd(); + variants.add(s); + sts.parseLength = itr.currentEnd(); itr.next(); } @@ -351,23 +351,23 @@ public class LanguageTag { s = itr.current(); if (isExtensionSubtag(s)) { sb.append(SEP).append(s); - sts._parseLength = itr.currentEnd(); + sts.parseLength = itr.currentEnd(); } else { break; } itr.next(); } - if (sts._parseLength <= start) { - sts._errorIndex = start; - sts._errorMsg = "Incomplete extension '" + singleton + "'"; + if (sts.parseLength <= start) { + sts.errorIndex = start; + sts.errorMsg = "Incomplete extension '" + singleton + "'"; break; } - if (_extensions.size() == 0) { - _extensions = new ArrayList(4); + if (extensions.isEmpty()) { + extensions = new ArrayList<>(4); } - _extensions.add(sb.toString()); + extensions.add(sb.toString()); found = true; } else { break; @@ -395,17 +395,17 @@ public class LanguageTag { break; } sb.append(SEP).append(s); - sts._parseLength = itr.currentEnd(); + sts.parseLength = itr.currentEnd(); itr.next(); } - if (sts._parseLength <= start) { + if (sts.parseLength <= start) { // need at least 1 private subtag - sts._errorIndex = start; - sts._errorMsg = "Incomplete privateuse"; + sts.errorIndex = start; + sts.errorMsg = "Incomplete privateuse"; } else { - _privateuse = sb.toString(); + privateuse = sb.toString(); found = true; } } @@ -425,9 +425,8 @@ public class LanguageTag { String privuseVar = null; // store ill-formed variant subtags - if (language.length() > 0 && isLanguage(language)) { - // Convert a deprecated language code used by Java to - // a new code + if (isLanguage(language)) { + // Convert a deprecated language code to its new code if (language.equals("iw")) { language = "he"; } else if (language.equals("ji")) { @@ -435,22 +434,22 @@ public class LanguageTag { } else if (language.equals("in")) { language = "id"; } - tag._language = language; + tag.language = language; } - if (script.length() > 0 && isScript(script)) { - tag._script = canonicalizeScript(script); + if (isScript(script)) { + tag.script = canonicalizeScript(script); hasSubtag = true; } - if (region.length() > 0 && isRegion(region)) { - tag._region = canonicalizeRegion(region); + if (isRegion(region)) { + tag.region = canonicalizeRegion(region); hasSubtag = true; } // Special handling for no_NO_NY - use nn_NO for language tag - if (tag._language.equals("no") && tag._region.equals("NO") && variant.equals("NY")) { - tag._language = "nn"; + if (tag.language.equals("no") && tag.region.equals("NO") && variant.equals("NY")) { + tag.language = "nn"; variant = ""; } @@ -463,13 +462,13 @@ public class LanguageTag { break; } if (variants == null) { - variants = new ArrayList(); + variants = new ArrayList<>(); } variants.add(var); // Do not canonicalize! varitr.next(); } if (variants != null) { - tag._variants = variants; + tag.variants = variants; hasSubtag = true; } if (!varitr.isDone()) { @@ -496,21 +495,23 @@ public class LanguageTag { List extensions = null; String privateuse = null; - Set locextKeys = localeExtensions.getKeys(); - for (Character locextKey : locextKeys) { - Extension ext = localeExtensions.getExtension(locextKey); - if (isPrivateusePrefixChar(locextKey.charValue())) { - privateuse = ext.getValue(); - } else { - if (extensions == null) { - extensions = new ArrayList(); + if (localeExtensions != null) { + Set locextKeys = localeExtensions.getKeys(); + for (Character locextKey : locextKeys) { + Extension ext = localeExtensions.getExtension(locextKey); + if (isPrivateusePrefixChar(locextKey)) { + privateuse = ext.getValue(); + } else { + if (extensions == null) { + extensions = new ArrayList<>(); + } + extensions.add(locextKey.toString() + SEP + ext.getValue()); } - extensions.add(locextKey.toString() + SEP + ext.getValue()); } } if (extensions != null) { - tag._extensions = extensions; + tag.extensions = extensions; hasSubtag = true; } @@ -519,19 +520,20 @@ public class LanguageTag { if (privateuse == null) { privateuse = PRIVUSE_VARIANT_PREFIX + SEP + privuseVar; } else { - privateuse = privateuse + SEP + PRIVUSE_VARIANT_PREFIX + SEP + privuseVar.replace(BaseLocale.SEP, SEP); + privateuse = privateuse + SEP + PRIVUSE_VARIANT_PREFIX + + SEP + privuseVar.replace(BaseLocale.SEP, SEP); } } if (privateuse != null) { - tag._privateuse = privateuse; + tag.privateuse = privateuse; } - if (tag._language.length() == 0 && (hasSubtag || privateuse == null)) { + if (tag.language.length() == 0 && (hasSubtag || privateuse == null)) { // use lang "und" when 1) no language is available AND // 2) any of other subtags other than private use are available or // no private use tag is available - tag._language = UNDETERMINED; + tag.language = UNDETERMINED; } return tag; @@ -542,31 +544,40 @@ public class LanguageTag { // public String getLanguage() { - return _language; + return language; } public List getExtlangs() { - return Collections.unmodifiableList(_extlangs); + if (extlangs.isEmpty()) { + return Collections.emptyList(); + } + return Collections.unmodifiableList(extlangs); } public String getScript() { - return _script; + return script; } public String getRegion() { - return _region; + return region; } public List getVariants() { - return Collections.unmodifiableList(_variants); + if (variants.isEmpty()) { + return Collections.emptyList(); + } + return Collections.unmodifiableList(variants); } public List getExtensions() { - return Collections.unmodifiableList(_extensions); + if (extensions.isEmpty()) { + return Collections.emptyList(); + } + return Collections.unmodifiableList(extensions); } public String getPrivateuse() { - return _privateuse; + return privateuse; } // @@ -579,25 +590,26 @@ public class LanguageTag { // ; extended language subtags // / 4ALPHA ; or reserved for future use // / 5*8ALPHA ; or registered language subtag - return (s.length() >= 2) && (s.length() <= 8) && AsciiUtil.isAlphaString(s); + int len = s.length(); + return (len >= 2) && (len <= 8) && LocaleUtils.isAlphaString(s); } public static boolean isExtlang(String s) { // extlang = 3ALPHA ; selected ISO 639 codes // *2("-" 3ALPHA) ; permanently reserved - return (s.length() == 3) && AsciiUtil.isAlphaString(s); + return (s.length() == 3) && LocaleUtils.isAlphaString(s); } public static boolean isScript(String s) { // script = 4ALPHA ; ISO 15924 code - return (s.length() == 4) && AsciiUtil.isAlphaString(s); + return (s.length() == 4) && LocaleUtils.isAlphaString(s); } public static boolean isRegion(String s) { // region = 2ALPHA ; ISO 3166-1 code // / 3DIGIT ; UN M.49 code - return ((s.length() == 2) && AsciiUtil.isAlphaString(s)) - || ((s.length() == 3) && AsciiUtil.isNumericString(s)); + return ((s.length() == 2) && LocaleUtils.isAlphaString(s)) + || ((s.length() == 3) && LocaleUtils.isNumericString(s)); } public static boolean isVariant(String s) { @@ -605,13 +617,13 @@ public class LanguageTag { // / (DIGIT 3alphanum) int len = s.length(); if (len >= 5 && len <= 8) { - return AsciiUtil.isAlphaNumericString(s); + return LocaleUtils.isAlphaNumericString(s); } if (len == 4) { - return AsciiUtil.isNumeric(s.charAt(0)) - && AsciiUtil.isAlphaNumeric(s.charAt(1)) - && AsciiUtil.isAlphaNumeric(s.charAt(2)) - && AsciiUtil.isAlphaNumeric(s.charAt(3)); + return LocaleUtils.isNumeric(s.charAt(0)) + && LocaleUtils.isAlphaNumeric(s.charAt(1)) + && LocaleUtils.isAlphaNumeric(s.charAt(2)) + && LocaleUtils.isAlphaNumeric(s.charAt(3)); } return false; } @@ -624,8 +636,8 @@ public class LanguageTag { // / %x79-7A ; y - z return (s.length() == 1) - && AsciiUtil.isAlphaString(s) - && !AsciiUtil.caseIgnoreMatch(PRIVATEUSE, s); + && LocaleUtils.isAlphaString(s) + && !LocaleUtils.caseIgnoreMatch(PRIVATEUSE, s); } public static boolean isExtensionSingletonChar(char c) { @@ -634,22 +646,24 @@ public class LanguageTag { public static boolean isExtensionSubtag(String s) { // extension = singleton 1*("-" (2*8alphanum)) - return (s.length() >= 2) && (s.length() <= 8) && AsciiUtil.isAlphaNumericString(s); + int len = s.length(); + return (len >= 2) && (len <= 8) && LocaleUtils.isAlphaNumericString(s); } public static boolean isPrivateusePrefix(String s) { // privateuse = "x" 1*("-" (1*8alphanum)) return (s.length() == 1) - && AsciiUtil.caseIgnoreMatch(PRIVATEUSE, s); + && LocaleUtils.caseIgnoreMatch(PRIVATEUSE, s); } public static boolean isPrivateusePrefixChar(char c) { - return (AsciiUtil.caseIgnoreMatch(PRIVATEUSE, String.valueOf(c))); + return (LocaleUtils.caseIgnoreMatch(PRIVATEUSE, String.valueOf(c))); } public static boolean isPrivateuseSubtag(String s) { // privateuse = "x" 1*("-" (1*8alphanum)) - return (s.length() >= 1) && (s.length() <= 8) && AsciiUtil.isAlphaNumericString(s); + int len = s.length(); + return (len >= 1) && (len <= 8) && LocaleUtils.isAlphaNumericString(s); } // @@ -657,76 +671,77 @@ public class LanguageTag { // public static String canonicalizeLanguage(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } public static String canonicalizeExtlang(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } public static String canonicalizeScript(String s) { - return AsciiUtil.toTitleString(s); + return LocaleUtils.toTitleString(s); } public static String canonicalizeRegion(String s) { - return AsciiUtil.toUpperString(s); + return LocaleUtils.toUpperString(s); } public static String canonicalizeVariant(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } public static String canonicalizeExtension(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } public static String canonicalizeExtensionSingleton(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } public static String canonicalizeExtensionSubtag(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } public static String canonicalizePrivateuse(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } public static String canonicalizePrivateuseSubtag(String s) { - return AsciiUtil.toLowerString(s); + return LocaleUtils.toLowerString(s); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); - if (_language.length() > 0) { - sb.append(_language); + if (language.length() > 0) { + sb.append(language); - for (String extlang : _extlangs) { + for (String extlang : extlangs) { sb.append(SEP).append(extlang); } - if (_script.length() > 0) { - sb.append(SEP).append(_script); + if (script.length() > 0) { + sb.append(SEP).append(script); } - if (_region.length() > 0) { - sb.append(SEP).append(_region); + if (region.length() > 0) { + sb.append(SEP).append(region); } - for (String variant : _extlangs) { + for (String variant : variants) { sb.append(SEP).append(variant); } - for (String extension : _extensions) { + for (String extension : extensions) { sb.append(SEP).append(extension); } } - if (_privateuse.length() > 0) { + if (privateuse.length() > 0) { if (sb.length() > 0) { sb.append(SEP); } - sb.append(_privateuse); + sb.append(privateuse); } return sb.toString(); diff --git a/jdk/src/share/classes/sun/util/locale/LocaleExtensions.java b/jdk/src/share/classes/sun/util/locale/LocaleExtensions.java index 44016382b24..d7afec3f090 100644 --- a/jdk/src/share/classes/sun/util/locale/LocaleExtensions.java +++ b/jdk/src/share/classes/sun/util/locale/LocaleExtensions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 @@ -36,6 +36,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.SortedMap; +import java.util.SortedSet; import java.util.TreeMap; import java.util.TreeSet; @@ -45,55 +46,45 @@ import sun.util.locale.InternalLocaleBuilder.CaseInsensitiveString; public class LocaleExtensions { - private SortedMap _map; - private String _id; + private final Map extensionMap; + private final String id; - private static final SortedMap EMPTY_MAP = - Collections.unmodifiableSortedMap(new TreeMap()); + public static final LocaleExtensions CALENDAR_JAPANESE + = new LocaleExtensions("u-ca-japanese", + UnicodeLocaleExtension.SINGLETON, + UnicodeLocaleExtension.CA_JAPANESE); - public static final LocaleExtensions EMPTY_EXTENSIONS; - public static final LocaleExtensions CALENDAR_JAPANESE; - public static final LocaleExtensions NUMBER_THAI; + public static final LocaleExtensions NUMBER_THAI + = new LocaleExtensions("u-nu-thai", + UnicodeLocaleExtension.SINGLETON, + UnicodeLocaleExtension.NU_THAI); - static { - EMPTY_EXTENSIONS = new LocaleExtensions(); - EMPTY_EXTENSIONS._id = ""; - EMPTY_EXTENSIONS._map = EMPTY_MAP; - - CALENDAR_JAPANESE = new LocaleExtensions(); - CALENDAR_JAPANESE._id = "u-ca-japanese"; - CALENDAR_JAPANESE._map = new TreeMap(); - CALENDAR_JAPANESE._map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), UnicodeLocaleExtension.CA_JAPANESE); - - NUMBER_THAI = new LocaleExtensions(); - NUMBER_THAI._id = "u-nu-thai"; - NUMBER_THAI._map = new TreeMap(); - NUMBER_THAI._map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), UnicodeLocaleExtension.NU_THAI); - } - - private LocaleExtensions() { + private LocaleExtensions(String id, Character key, Extension value) { + this.id = id; + this.extensionMap = Collections.singletonMap(key, value); } /* - * Package local constructor, only used by InternalLocaleBuilder. + * Package private constructor, only used by InternalLocaleBuilder. */ LocaleExtensions(Map extensions, - Set uattributes, Map ukeywords) { - boolean hasExtension = (extensions != null && extensions.size() > 0); - boolean hasUAttributes = (uattributes != null && uattributes.size() > 0); - boolean hasUKeywords = (ukeywords != null && ukeywords.size() > 0); + Set uattributes, + Map ukeywords) { + boolean hasExtension = !LocaleUtils.isEmpty(extensions); + boolean hasUAttributes = !LocaleUtils.isEmpty(uattributes); + boolean hasUKeywords = !LocaleUtils.isEmpty(ukeywords); if (!hasExtension && !hasUAttributes && !hasUKeywords) { - _map = EMPTY_MAP; - _id = ""; + id = ""; + extensionMap = Collections.emptyMap(); return; } // Build extension map - _map = new TreeMap(); + SortedMap map = new TreeMap<>(); if (hasExtension) { for (Entry ext : extensions.entrySet()) { - char key = AsciiUtil.toLower(ext.getKey().value()); + char key = LocaleUtils.toLower(ext.getKey().value()); String value = ext.getValue(); if (LanguageTag.isPrivateusePrefixChar(key)) { @@ -104,54 +95,57 @@ public class LocaleExtensions { } } - Extension e = new Extension(key, AsciiUtil.toLowerString(value)); - _map.put(Character.valueOf(key), e); + map.put(key, new Extension(key, LocaleUtils.toLowerString(value))); } } if (hasUAttributes || hasUKeywords) { - TreeSet uaset = null; - TreeMap ukmap = null; + SortedSet uaset = null; + SortedMap ukmap = null; if (hasUAttributes) { - uaset = new TreeSet(); + uaset = new TreeSet<>(); for (CaseInsensitiveString cis : uattributes) { - uaset.add(AsciiUtil.toLowerString(cis.value())); + uaset.add(LocaleUtils.toLowerString(cis.value())); } } if (hasUKeywords) { - ukmap = new TreeMap(); + ukmap = new TreeMap<>(); for (Entry kwd : ukeywords.entrySet()) { - String key = AsciiUtil.toLowerString(kwd.getKey().value()); - String type = AsciiUtil.toLowerString(kwd.getValue()); + String key = LocaleUtils.toLowerString(kwd.getKey().value()); + String type = LocaleUtils.toLowerString(kwd.getValue()); ukmap.put(key, type); } } UnicodeLocaleExtension ule = new UnicodeLocaleExtension(uaset, ukmap); - _map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), ule); + map.put(UnicodeLocaleExtension.SINGLETON, ule); } - if (_map.size() == 0) { + if (map.isEmpty()) { // this could happen when only privuateuse with special variant - _map = EMPTY_MAP; - _id = ""; + id = ""; + extensionMap = Collections.emptyMap(); } else { - _id = toID(_map); + id = toID(map); + extensionMap = map; } } public Set getKeys() { - return Collections.unmodifiableSet(_map.keySet()); + if (extensionMap.isEmpty()) { + return Collections.emptySet(); + } + return Collections.unmodifiableSet(extensionMap.keySet()); } public Extension getExtension(Character key) { - return _map.get(Character.valueOf(AsciiUtil.toLower(key.charValue()))); + return extensionMap.get(LocaleUtils.toLower(key)); } public String getExtensionValue(Character key) { - Extension ext = _map.get(Character.valueOf(AsciiUtil.toLower(key.charValue()))); + Extension ext = extensionMap.get(LocaleUtils.toLower(key)); if (ext == null) { return null; } @@ -159,7 +153,7 @@ public class LocaleExtensions { } public Set getUnicodeLocaleAttributes() { - Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON)); + Extension ext = extensionMap.get(UnicodeLocaleExtension.SINGLETON); if (ext == null) { return Collections.emptySet(); } @@ -168,7 +162,7 @@ public class LocaleExtensions { } public Set getUnicodeLocaleKeys() { - Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON)); + Extension ext = extensionMap.get(UnicodeLocaleExtension.SINGLETON); if (ext == null) { return Collections.emptySet(); } @@ -177,16 +171,16 @@ public class LocaleExtensions { } public String getUnicodeLocaleType(String unicodeLocaleKey) { - Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON)); + Extension ext = extensionMap.get(UnicodeLocaleExtension.SINGLETON); if (ext == null) { return null; } assert (ext instanceof UnicodeLocaleExtension); - return ((UnicodeLocaleExtension)ext).getUnicodeLocaleType(AsciiUtil.toLowerString(unicodeLocaleKey)); + return ((UnicodeLocaleExtension)ext).getUnicodeLocaleType(LocaleUtils.toLowerString(unicodeLocaleKey)); } public boolean isEmpty() { - return _map.isEmpty(); + return extensionMap.isEmpty(); } public static boolean isValidKey(char c) { @@ -201,7 +195,7 @@ public class LocaleExtensions { StringBuilder buf = new StringBuilder(); Extension privuse = null; for (Entry entry : map.entrySet()) { - char singleton = entry.getKey().charValue(); + char singleton = entry.getKey(); Extension extension = entry.getValue(); if (LanguageTag.isPrivateusePrefixChar(singleton)) { privuse = extension; @@ -221,19 +215,21 @@ public class LocaleExtensions { return buf.toString(); } - + @Override public String toString() { - return _id; + return id; } public String getID() { - return _id; + return id; } + @Override public int hashCode() { - return _id.hashCode(); + return id.hashCode(); } + @Override public boolean equals(Object other) { if (this == other) { return true; @@ -241,6 +237,6 @@ public class LocaleExtensions { if (!(other instanceof LocaleExtensions)) { return false; } - return this._id.equals(((LocaleExtensions)other)._id); + return id.equals(((LocaleExtensions)other).id); } } diff --git a/jdk/src/share/classes/sun/util/locale/LocaleObjectCache.java b/jdk/src/share/classes/sun/util/locale/LocaleObjectCache.java index e5e6810c0eb..35504bcadf0 100644 --- a/jdk/src/share/classes/sun/util/locale/LocaleObjectCache.java +++ b/jdk/src/share/classes/sun/util/locale/LocaleObjectCache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 @@ -34,24 +34,25 @@ package sun.util.locale; import java.lang.ref.ReferenceQueue; import java.lang.ref.SoftReference; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; public abstract class LocaleObjectCache { - private ConcurrentHashMap> _map; - private ReferenceQueue _queue = new ReferenceQueue(); + private ConcurrentMap> map; + private ReferenceQueue queue = new ReferenceQueue<>(); public LocaleObjectCache() { this(16, 0.75f, 16); } public LocaleObjectCache(int initialCapacity, float loadFactor, int concurrencyLevel) { - _map = new ConcurrentHashMap>(initialCapacity, loadFactor, concurrencyLevel); + map = new ConcurrentHashMap<>(initialCapacity, loadFactor, concurrencyLevel); } public V get(K key) { V value = null; cleanStaleEntries(); - CacheEntry entry = _map.get(key); + CacheEntry entry = map.get(key); if (entry != null) { value = entry.get(); } @@ -63,11 +64,11 @@ public abstract class LocaleObjectCache { return null; } - CacheEntry newEntry = new CacheEntry(key, newVal, _queue); + CacheEntry newEntry = new CacheEntry<>(key, newVal, queue); while (value == null) { cleanStaleEntries(); - entry = _map.putIfAbsent(key, newEntry); + entry = map.putIfAbsent(key, newEntry); if (entry == null) { value = newVal; break; @@ -79,11 +80,17 @@ public abstract class LocaleObjectCache { return value; } + protected V put(K key, V value) { + CacheEntry entry = new CacheEntry<>(key, value, queue); + CacheEntry oldEntry = map.put(key, entry); + return (oldEntry == null) ? null : oldEntry.get(); + } + @SuppressWarnings("unchecked") private void cleanStaleEntries() { CacheEntry entry; - while ((entry = (CacheEntry)_queue.poll()) != null) { - _map.remove(entry.getKey()); + while ((entry = (CacheEntry)queue.poll()) != null) { + map.remove(entry.getKey()); } } @@ -94,15 +101,15 @@ public abstract class LocaleObjectCache { } private static class CacheEntry extends SoftReference { - private K _key; + private K key; CacheEntry(K key, V value, ReferenceQueue queue) { super(value, queue); - _key = key; + this.key = key; } K getKey() { - return _key; + return key; } } } diff --git a/jdk/src/share/classes/sun/util/locale/LocaleSyntaxException.java b/jdk/src/share/classes/sun/util/locale/LocaleSyntaxException.java index 3c0004e8b57..07c0ed3fcab 100644 --- a/jdk/src/share/classes/sun/util/locale/LocaleSyntaxException.java +++ b/jdk/src/share/classes/sun/util/locale/LocaleSyntaxException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 @@ -35,7 +35,7 @@ public class LocaleSyntaxException extends Exception { private static final long serialVersionUID = 1L; - private int _index = -1; + private int index = -1; public LocaleSyntaxException(String msg) { this(msg, 0); @@ -43,10 +43,10 @@ public class LocaleSyntaxException extends Exception { public LocaleSyntaxException(String msg, int errorIndex) { super(msg); - _index = errorIndex; + index = errorIndex; } public int getErrorIndex() { - return _index; + return index; } } diff --git a/jdk/src/share/classes/sun/util/locale/LocaleUtils.java b/jdk/src/share/classes/sun/util/locale/LocaleUtils.java new file mode 100644 index 00000000000..0258e5a1935 --- /dev/null +++ b/jdk/src/share/classes/sun/util/locale/LocaleUtils.java @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + ******************************************************************************* + * Copyright (C) 2009, International Business Machines Corporation and * + * others. All Rights Reserved. * + ******************************************************************************* + */ +package sun.util.locale; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Collection of static utility methods for Locale support. The + * methods which manipulate characters or strings support ASCII only. + */ +public final class LocaleUtils { + + private LocaleUtils() { + } + + /** + * Compares two ASCII Strings s1 and s2, ignoring case. + */ + public static boolean caseIgnoreMatch(String s1, String s2) { + if (s1 == s2) { + return true; + } + + int len = s1.length(); + if (len != s2.length()) { + return false; + } + + for (int i = 0; i < len; i++) { + char c1 = s1.charAt(i); + char c2 = s2.charAt(i); + if (c1 != c2 && toLower(c1) != toLower(c2)) { + return false; + } + } + return true; + } + + static int caseIgnoreCompare(String s1, String s2) { + if (s1 == s2) { + return 0; + } + return toLowerString(s1).compareTo(toLowerString(s2)); + } + + static char toUpper(char c) { + return isLower(c) ? (char)(c - 0x20) : c; + } + + static char toLower(char c) { + return isUpper(c) ? (char)(c + 0x20) : c; + } + + /** + * Converts the given ASCII String to lower-case. + */ + public static String toLowerString(String s) { + int len = s.length(); + int idx = 0; + for (; idx < len; idx++) { + if (isUpper(s.charAt(idx))) { + break; + } + } + if (idx == len) { + return s; + } + + char[] buf = new char[len]; + for (int i = 0; i < len; i++) { + char c = s.charAt(i); + buf[i] = (i < idx) ? c : toLower(c); + } + return new String(buf); + } + + static String toUpperString(String s) { + int len = s.length(); + int idx = 0; + for (; idx < len; idx++) { + if (isLower(s.charAt(idx))) { + break; + } + } + if (idx == len) { + return s; + } + + char[] buf = new char[len]; + for (int i = 0; i < len; i++) { + char c = s.charAt(i); + buf[i] = (i < idx) ? c : toUpper(c); + } + return new String(buf); + } + + static String toTitleString(String s) { + int len; + if ((len = s.length()) == 0) { + return s; + } + int idx = 0; + if (!isLower(s.charAt(idx))) { + for (idx = 1; idx < len; idx++) { + if (isUpper(s.charAt(idx))) { + break; + } + } + } + if (idx == len) { + return s; + } + + char[] buf = new char[len]; + for (int i = 0; i < len; i++) { + char c = s.charAt(i); + if (i == 0 && idx == 0) { + buf[i] = toUpper(c); + } else if (i < idx) { + buf[i] = c; + } else { + buf[i] = toLower(c); + } + } + return new String(buf); + } + + private static boolean isUpper(char c) { + return c >= 'A' && c <= 'Z'; + } + + private static boolean isLower(char c) { + return c >= 'a' && c <= 'z'; + } + + static boolean isAlpha(char c) { + return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); + } + + static boolean isAlphaString(String s) { + int len = s.length(); + for (int i = 0; i < len; i++) { + if (!isAlpha(s.charAt(i))) { + return false; + } + } + return true; + } + + static boolean isNumeric(char c) { + return (c >= '0' && c <= '9'); + } + + static boolean isNumericString(String s) { + int len = s.length(); + for (int i = 0; i < len; i++) { + if (!isNumeric(s.charAt(i))) { + return false; + } + } + return true; + } + + static boolean isAlphaNumeric(char c) { + return isAlpha(c) || isNumeric(c); + } + + static boolean isAlphaNumericString(String s) { + int len = s.length(); + for (int i = 0; i < len; i++) { + if (!isAlphaNumeric(s.charAt(i))) { + return false; + } + } + return true; + } + + static boolean isEmpty(String str) { + return str == null || str.length() == 0; + } + + static boolean isEmpty(Set set) { + return set == null || set.isEmpty(); + } + + static boolean isEmpty(Map map) { + return map == null || map.isEmpty(); + } + + static boolean isEmpty(List list) { + return list == null || list.isEmpty(); + } +} diff --git a/jdk/src/share/classes/sun/util/locale/ParseStatus.java b/jdk/src/share/classes/sun/util/locale/ParseStatus.java index a717930960f..91da6bf0f18 100644 --- a/jdk/src/share/classes/sun/util/locale/ParseStatus.java +++ b/jdk/src/share/classes/sun/util/locale/ParseStatus.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 @@ -32,29 +32,33 @@ package sun.util.locale; public class ParseStatus { - int _parseLength = 0; - int _errorIndex = -1; - String _errorMsg = null; + int parseLength; + int errorIndex; + String errorMsg; + + public ParseStatus() { + reset(); + } public void reset() { - _parseLength = 0; - _errorIndex = -1; - _errorMsg = null; + parseLength = 0; + errorIndex = -1; + errorMsg = null; } public boolean isError() { - return (_errorIndex >= 0); + return (errorIndex >= 0); } public int getErrorIndex() { - return _errorIndex; + return errorIndex; } public int getParseLength() { - return _parseLength; + return parseLength; } public String getErrorMessage() { - return _errorMsg; + return errorMsg; } } diff --git a/jdk/src/share/classes/sun/util/locale/StringTokenIterator.java b/jdk/src/share/classes/sun/util/locale/StringTokenIterator.java index 6fc674383fa..f66bfd53752 100644 --- a/jdk/src/share/classes/sun/util/locale/StringTokenIterator.java +++ b/jdk/src/share/classes/sun/util/locale/StringTokenIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 @@ -31,87 +31,99 @@ package sun.util.locale; public class StringTokenIterator { - private String _text; - private String _dlms; + private String text; + private String dlms; // null if a single char delimiter + private char delimiterChar; // delimiter if a single char delimiter - private String _token; - private int _start; - private int _end; - private boolean _done; + private String token; + private int start; + private int end; + private boolean done; public StringTokenIterator(String text, String dlms) { - _text = text; - _dlms = dlms; + this.text = text; + if (dlms.length() == 1) { + delimiterChar = dlms.charAt(0); + } else { + this.dlms = dlms; + } setStart(0); } public String first() { setStart(0); - return _token; + return token; } public String current() { - return _token; + return token; } public int currentStart() { - return _start; + return start; } public int currentEnd() { - return _end; + return end; } public boolean isDone() { - return _done; + return done; } public String next() { if (hasNext()) { - _start = _end + 1; - _end = nextDelimiter(_start); - _token = _text.substring(_start, _end); + start = end + 1; + end = nextDelimiter(start); + token = text.substring(start, end); } else { - _start = _end; - _token = null; - _done = true; + start = end; + token = null; + done = true; } - return _token; + return token; } public boolean hasNext() { - return (_end < _text.length()); + return (end < text.length()); } public StringTokenIterator setStart(int offset) { - if (offset > _text.length()) { + if (offset > text.length()) { throw new IndexOutOfBoundsException(); } - _start = offset; - _end = nextDelimiter(_start); - _token = _text.substring(_start, _end); - _done = false; + start = offset; + end = nextDelimiter(start); + token = text.substring(start, end); + done = false; return this; } public StringTokenIterator setText(String text) { - _text = text; + this.text = text; setStart(0); return this; } private int nextDelimiter(int start) { - int idx = start; - outer: while (idx < _text.length()) { - char c = _text.charAt(idx); - for (int i = 0; i < _dlms.length(); i++) { - if (c == _dlms.charAt(i)) { - break outer; + int textlen = this.text.length(); + if (dlms == null) { + for (int idx = start; idx < textlen; idx++) { + if (text.charAt(idx) == delimiterChar) { + return idx; + } + } + } else { + int dlmslen = dlms.length(); + for (int idx = start; idx < textlen; idx++) { + char c = text.charAt(idx); + for (int i = 0; i < dlmslen; i++) { + if (c == dlms.charAt(i)) { + return idx; + } } } - idx++; } - return idx; + return textlen; } } - diff --git a/jdk/src/share/classes/sun/util/locale/UnicodeLocaleExtension.java b/jdk/src/share/classes/sun/util/locale/UnicodeLocaleExtension.java index 4db66796733..cc5a5685cd0 100644 --- a/jdk/src/share/classes/sun/util/locale/UnicodeLocaleExtension.java +++ b/jdk/src/share/classes/sun/util/locale/UnicodeLocaleExtension.java @@ -1,5 +1,6 @@ + /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 @@ -32,56 +33,48 @@ package sun.util.locale; import java.util.Collections; +import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; -import java.util.TreeMap; -import java.util.TreeSet; public class UnicodeLocaleExtension extends Extension { public static final char SINGLETON = 'u'; - private static final SortedSet EMPTY_SORTED_SET = new TreeSet(); - private static final SortedMap EMPTY_SORTED_MAP = new TreeMap(); + private final Set attributes; + private final Map keywords; - private SortedSet _attributes = EMPTY_SORTED_SET; - private SortedMap _keywords = EMPTY_SORTED_MAP; + public static final UnicodeLocaleExtension CA_JAPANESE + = new UnicodeLocaleExtension("ca", "japanese"); + public static final UnicodeLocaleExtension NU_THAI + = new UnicodeLocaleExtension("nu", "thai"); - public static final UnicodeLocaleExtension CA_JAPANESE; - public static final UnicodeLocaleExtension NU_THAI; - - static { - CA_JAPANESE = new UnicodeLocaleExtension(); - CA_JAPANESE._keywords = new TreeMap(); - CA_JAPANESE._keywords.put("ca", "japanese"); - CA_JAPANESE._value = "ca-japanese"; - - NU_THAI = new UnicodeLocaleExtension(); - NU_THAI._keywords = new TreeMap(); - NU_THAI._keywords.put("nu", "thai"); - NU_THAI._value = "nu-thai"; - } - - private UnicodeLocaleExtension() { - super(SINGLETON); + private UnicodeLocaleExtension(String key, String value) { + super(SINGLETON, key + "-" + value); + attributes = Collections.emptySet(); + keywords = Collections.singletonMap(key, value); } UnicodeLocaleExtension(SortedSet attributes, SortedMap keywords) { - this(); - if (attributes != null && attributes.size() > 0) { - _attributes = attributes; + super(SINGLETON); + if (attributes != null) { + this.attributes = attributes; + } else { + this.attributes = Collections.emptySet(); } - if (keywords != null && keywords.size() > 0) { - _keywords = keywords; + if (keywords != null) { + this.keywords = keywords; + } else { + this.keywords = Collections.emptyMap(); } - if (_attributes.size() > 0 || _keywords.size() > 0) { + if (!this.attributes.isEmpty() || !this.keywords.isEmpty()) { StringBuilder sb = new StringBuilder(); - for (String attribute : _attributes) { + for (String attribute : this.attributes) { sb.append(LanguageTag.SEP).append(attribute); } - for (Entry keyword : _keywords.entrySet()) { + for (Entry keyword : this.keywords.entrySet()) { String key = keyword.getKey(); String value = keyword.getValue(); @@ -90,38 +83,46 @@ public class UnicodeLocaleExtension extends Extension { sb.append(LanguageTag.SEP).append(value); } } - _value = sb.substring(1); // skip leading '-' + setValue(sb.substring(1)); // skip leading '-' } } public Set getUnicodeLocaleAttributes() { - return Collections.unmodifiableSet(_attributes); + if (attributes == Collections.EMPTY_SET) { + return attributes; + } + return Collections.unmodifiableSet(attributes); } public Set getUnicodeLocaleKeys() { - return Collections.unmodifiableSet(_keywords.keySet()); + if (keywords == Collections.EMPTY_MAP) { + return Collections.emptySet(); + } + return Collections.unmodifiableSet(keywords.keySet()); } public String getUnicodeLocaleType(String unicodeLocaleKey) { - return _keywords.get(unicodeLocaleKey); + return keywords.get(unicodeLocaleKey); } public static boolean isSingletonChar(char c) { - return (SINGLETON == AsciiUtil.toLower(c)); + return (SINGLETON == LocaleUtils.toLower(c)); } public static boolean isAttribute(String s) { // 3*8alphanum - return (s.length() >= 3) && (s.length() <= 8) && AsciiUtil.isAlphaNumericString(s); + int len = s.length(); + return (len >= 3) && (len <= 8) && LocaleUtils.isAlphaNumericString(s); } public static boolean isKey(String s) { // 2alphanum - return (s.length() == 2) && AsciiUtil.isAlphaNumericString(s); + return (s.length() == 2) && LocaleUtils.isAlphaNumericString(s); } public static boolean isTypeSubtag(String s) { // 3*8alphanum - return (s.length() >= 3) && (s.length() <= 8) && AsciiUtil.isAlphaNumericString(s); + int len = s.length(); + return (len >= 3) && (len <= 8) && LocaleUtils.isAlphaNumericString(s); } } diff --git a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java index aa7ce694713..d7b485b2951 100644 --- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java +++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java @@ -43,822 +43,824 @@ package sun.util.resources; public final class TimeZoneNames_pt_BR extends TimeZoneNamesBundle { protected final Object[][] getContents() { - String ACT[] = new String[] {"Fuso hor\u00e1rio do Acre", "ACT", - "Fuso hor\u00e1rio de ver\u00e3o do Acre", "ACST"}; - String ADELAIDE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Austr\u00e1lia do Sul)", "CST", - "Fuso hor\u00e1rio de ver\u00e3o central (Austr\u00e1lia do Sul)", "CST"}; - String AGT[] = new String[] {"Fuso hor\u00e1rio da Argentina", "ART", - "Fuso hor\u00e1rio de ver\u00e3o da Argentina", "ARST"}; - String AKST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Alaska", "AKST", - "Hor\u00e1rio de luz natural do Alaska", "AKDT"}; - String AMT[] = new String[] {"Fuso hor\u00e1rio do Amazonas", "AMT", - "Fuso hor\u00e1rio de ver\u00e3o do Amazonas", "AMST"}; - String ARAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Ar\u00e1bia", "AST", - "Hor\u00e1rio de luz natural da Ar\u00e1bia", "ADT"}; - String ARMT[] = new String[] {"Fuso hor\u00e1rio da Arm\u00eania", "AMT", - "Fuso hor\u00e1rio de ver\u00e3o da Arm\u00eania", "AMST"}; - String AST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Atl\u00e2ntico", "AST", - "Hor\u00e1rio de luz natural do Atl\u00e2ntico", "ADT"}; - String BDT[] = new String[] {"Fuso hor\u00e1rio de Bangladesh", "BDT", - "Fuso hor\u00e1rio de ver\u00e3o de Bangladesh", "BDST"}; - String BRISBANE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Queensland)", "EST", - "Fuso hor\u00e1rio de ver\u00e3o oriental (Queensland)", "EST"}; - String BROKEN_HILL[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Austr\u00e1lia do Sul/Nova Gales do Sul)", "CST", - "Fuso hor\u00e1rio de ver\u00e3o central (Austr\u00e1lia do Sul/Nova Gales do Sul)", "CST"}; - String BRT[] = new String[] {"Fuso hor\u00e1rio de Bras\u00edlia", "BRT", - "Fuso hor\u00e1rio de ver\u00e3o de Bras\u00edlia", "BRST"}; - String BTT[] = new String[] {"Fuso hor\u00e1rio de But\u00e3o", "BTT", - "Fuso hor\u00e1rio de ver\u00e3o de But\u00e3o", "BTST"}; - String CAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Central", "CAT", - "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica Central", "CAST"}; - String CET[] = new String[] {"Fuso hor\u00e1rio da Europa Central", "CET", - "Fuso hor\u00e1rio de ver\u00e3o da Europa Central", "CEST"}; - String CHAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chatham", "CHAST", - "Hor\u00e1rio de luz natural de Chatham", "CHADT"}; - String CIT[] = new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Central", "CIT", - "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Central", "CIST"}; - String CLT[] = new String[] {"Fuso hor\u00e1rio do Chile", "CLT", - "Fuso hor\u00e1rio de ver\u00e3o do Chile", "CLST"}; - String CST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central", "CST", - "Hor\u00e1rio de luz natural central", "CDT"}; - String CTT[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da China", "CST", - "Hor\u00e1rio de luz natural da China", "CDT"}; - String CUBA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Cuba", "CST", - "Hor\u00e1rio de luz natural de Cuba", "CDT"}; - String DARWIN[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Territ\u00f3rio do Norte)", "CST", - "Fuso hor\u00e1rio de ver\u00e3o central (Territ\u00f3rio do Norte)", "CST"}; - String DUBLIN[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", - "Fuso hor\u00e1rio de ver\u00e3o da Irlanda", "IST"}; - String EAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Oriental", "EAT", - "Fuso hor\u00e1rio padr\u00e3o da \u00c1frica Oriental", "EAST"}; - String EASTER[] = new String[] {"Fuso hor\u00e1rio da Ilha de P\u00e1scoa", "EAST", - "Fuso hor\u00e1rio de ver\u00e3o da Ilha de P\u00e1scoa", "EASST"}; - String EET[] = new String[] {"Fuso hor\u00e1rio da Europa Oriental", "EET", - "Fuso hor\u00e1rio de ver\u00e3o da Europa Oriental", "EEST"}; - String EGT[] = new String[] {"Fuso hor\u00e1rio da Groenl\u00e2ndia Oriental", "EGT", - "Fuso hor\u00e1rio de ver\u00e3o da Groenl\u00e2ndia Oriental", "EGST"}; - String EST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental", "EST", - "Hor\u00e1rio de luz natural oriental", "EDT"}; - String EST_NSW[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Nova Gales do Sul)", "EST", - "Fuso hor\u00e1rio de ver\u00e3o oriental (Nova Gales do Sul)", "EST"}; - String GHMT[] = new String[] {"Fuso hor\u00e1rio do meridiano de Gana", "GMT", - "Fuso hor\u00e1rio de ver\u00e3o de Gana", "GHST"}; - String GAMBIER[] = new String[] {"Fuso hor\u00e1rio de Gambier", "GAMT", - "Fuso hor\u00e1rio de ver\u00e3o de Gambier", "GAMST"}; - String GMT[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", - "Fuso hor\u00e1rio do meridiano de Greenwich", "GMT"}; - String GMTBST[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", - "Fuso hor\u00e1rio de ver\u00e3o da Gr\u00e3-Bretanha", "BST"}; - String GST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do golfo", "GST", - "Hor\u00e1rio de luz natural do golfo", "GDT"}; - String HAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Hava\u00ed-Aleutian", "HAST", - "Hor\u00e1rio de luz natural do Hava\u00ed-Aleutian", "HADT"}; - String HKT[] = new String[] {"Fuso hor\u00e1rio de Hong Kong", "HKT", - "Fuso hor\u00e1rio de ver\u00e3o de Hong Kong", "HKST"}; - String HST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Hava\u00ed", "HST", - "Hor\u00e1rio de luz natural do Hava\u00ed", "HDT"}; - String ICT[] = new String[] {"Fuso hor\u00e1rio da Indochina", "ICT", - "Fuso hor\u00e1rio de ver\u00e3o da Indochina", "ICST"}; - String IRT[] = new String[] {"Fuso hor\u00e1rio do Ir\u00e3", "IRST", - "Hor\u00e1rio de luz natural do Ir\u00e3", "IRDT"}; - String ISRAEL[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Israel", "IST", - "Hor\u00e1rio de luz natural de Israel", "IDT"}; - String IST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da \u00cdndia", "IST", - "Hor\u00e1rio de luz natural da \u00cdndia", "IDT"}; - String JST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Jap\u00e3o", "JST", - "Hor\u00e1rio de luz natural do Jap\u00e3o", "JDT"}; - String KST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Coreia", "KST", - "Hor\u00e1rio de luz natural da Coreia", "KDT"}; - String LORD_HOWE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Lord Howe", "LHST", - "Fuso hor\u00e1rio de ver\u00e3o de Lord Howe", "LHST"}; - String MHT[] = new String[] {"Fuso hor\u00e1rio das Ilhas Marshall", "MHT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Marshall", "MHST"}; - String MSK[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Moscou", "MSK", - "Hor\u00e1rio de luz natural de Moscou", "MSD"}; - String MST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o das montanhas", "MST", - "Hor\u00e1rio de luz natural das montanhas", "MDT"}; - String MYT[] = new String[] {"Fuso hor\u00e1rio da Mal\u00e1sia", "MYT", - "Fuso hor\u00e1rio de ver\u00e3o da Mal\u00e1sia", "MYST"}; - String NORONHA[] = new String[] {"Fuso hor\u00e1rio de Fernando de Noronha", "FNT", - "Fuso hor\u00e1rio de ver\u00e3o de Fernando de Noronha", "FNST"}; - String NOVT[] = new String[] {"Fuso hor\u00e1rio de Novosibirsk", "NOVT", - "Fuso hor\u00e1rio de ver\u00e3o de Novosibirsk", "NOVST"}; + String ACT[] = new String[] {"Fuso hor\u00e1rio do Acre", "ACT", + "Fuso hor\u00e1rio de ver\u00e3o do Acre", "ACST"}; + String ADELAIDE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Austr\u00e1lia do Sul)", "CST", + "Fuso hor\u00e1rio de ver\u00e3o central (Austr\u00e1lia do Sul)", "CST"}; + String AGT[] = new String[] {"Fuso hor\u00e1rio da Argentina", "ART", + "Fuso hor\u00e1rio de ver\u00e3o da Argentina", "ARST"}; + String AKST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Alaska", "AKST", + "Hor\u00e1rio de luz natural do Alaska", "AKDT"}; + String AMT[] = new String[] {"Fuso hor\u00e1rio do Amazonas", "AMT", + "Fuso hor\u00e1rio de ver\u00e3o do Amazonas", "AMST"}; + String ARAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Ar\u00e1bia", "AST", + "Hor\u00e1rio de luz natural da Ar\u00e1bia", "ADT"}; + String ARMT[] = new String[] {"Fuso hor\u00e1rio da Arm\u00eania", "AMT", + "Fuso hor\u00e1rio de ver\u00e3o da Arm\u00eania", "AMST"}; + String AST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Atl\u00e2ntico", "AST", + "Hor\u00e1rio de luz natural do Atl\u00e2ntico", "ADT"}; + String BDT[] = new String[] {"Fuso hor\u00e1rio de Bangladesh", "BDT", + "Fuso hor\u00e1rio de ver\u00e3o de Bangladesh", "BDST"}; + String BRISBANE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Queensland)", "EST", + "Fuso hor\u00e1rio de ver\u00e3o oriental (Queensland)", "EST"}; + String BROKEN_HILL[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Austr\u00e1lia do Sul/Nova Gales do Sul)", "CST", + "Fuso hor\u00e1rio de ver\u00e3o central (Austr\u00e1lia do Sul/Nova Gales do Sul)", "CST"}; + String BRT[] = new String[] {"Fuso hor\u00e1rio de Bras\u00edlia", "BRT", + "Fuso hor\u00e1rio de ver\u00e3o de Bras\u00edlia", "BRST"}; + String BTT[] = new String[] {"Fuso hor\u00e1rio de But\u00e3o", "BTT", + "Fuso hor\u00e1rio de ver\u00e3o de But\u00e3o", "BTST"}; + String CAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Central", "CAT", + "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica Central", "CAST"}; + String CET[] = new String[] {"Fuso hor\u00e1rio da Europa Central", "CET", + "Fuso hor\u00e1rio de ver\u00e3o da Europa Central", "CEST"}; + String CHAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chatham", "CHAST", + "Hor\u00e1rio de luz natural de Chatham", "CHADT"}; + String CIT[] = new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Central", "CIT", + "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Central", "CIST"}; + String CLT[] = new String[] {"Fuso hor\u00e1rio do Chile", "CLT", + "Fuso hor\u00e1rio de ver\u00e3o do Chile", "CLST"}; + String CST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central", "CST", + "Hor\u00e1rio de luz natural central", "CDT"}; + String CTT[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da China", "CST", + "Hor\u00e1rio de luz natural da China", "CDT"}; + String CUBA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Cuba", "CST", + "Hor\u00e1rio de luz natural de Cuba", "CDT"}; + String DARWIN[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o central (Territ\u00f3rio do Norte)", "CST", + "Fuso hor\u00e1rio de ver\u00e3o central (Territ\u00f3rio do Norte)", "CST"}; + String DUBLIN[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", + "Fuso hor\u00e1rio de ver\u00e3o da Irlanda", "IST"}; + String EAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Oriental", "EAT", + "Fuso hor\u00e1rio padr\u00e3o da \u00c1frica Oriental", "EAST"}; + String EASTER[] = new String[] {"Fuso hor\u00e1rio da Ilha de P\u00e1scoa", "EAST", + "Fuso hor\u00e1rio de ver\u00e3o da Ilha de P\u00e1scoa", "EASST"}; + String EET[] = new String[] {"Fuso hor\u00e1rio da Europa Oriental", "EET", + "Fuso hor\u00e1rio de ver\u00e3o da Europa Oriental", "EEST"}; + String EGT[] = new String[] {"Fuso hor\u00e1rio da Groenl\u00e2ndia Oriental", "EGT", + "Fuso hor\u00e1rio de ver\u00e3o da Groenl\u00e2ndia Oriental", "EGST"}; + String EST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental", "EST", + "Hor\u00e1rio de luz natural oriental", "EDT"}; + String EST_NSW[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Nova Gales do Sul)", "EST", + "Fuso hor\u00e1rio de ver\u00e3o oriental (Nova Gales do Sul)", "EST"}; + String GHMT[] = new String[] {"Fuso hor\u00e1rio do meridiano de Gana", "GMT", + "Fuso hor\u00e1rio de ver\u00e3o de Gana", "GHST"}; + String GAMBIER[] = new String[] {"Fuso hor\u00e1rio de Gambier", "GAMT", + "Fuso hor\u00e1rio de ver\u00e3o de Gambier", "GAMST"}; + String GMT[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", + "Fuso hor\u00e1rio do meridiano de Greenwich", "GMT"}; + String GMTBST[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", + "Fuso hor\u00e1rio de ver\u00e3o da Gr\u00e3-Bretanha", "BST"}; + String GST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do golfo", "GST", + "Hor\u00e1rio de luz natural do golfo", "GDT"}; + String HAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Hava\u00ed-Aleutian", "HAST", + "Hor\u00e1rio de luz natural do Hava\u00ed-Aleutian", "HADT"}; + String HKT[] = new String[] {"Fuso hor\u00e1rio de Hong Kong", "HKT", + "Fuso hor\u00e1rio de ver\u00e3o de Hong Kong", "HKST"}; + String HST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Hava\u00ed", "HST", + "Hor\u00e1rio de luz natural do Hava\u00ed", "HDT"}; + String ICT[] = new String[] {"Fuso hor\u00e1rio da Indochina", "ICT", + "Fuso hor\u00e1rio de ver\u00e3o da Indochina", "ICST"}; + String IRT[] = new String[] {"Fuso hor\u00e1rio do Ir\u00e3", "IRST", + "Hor\u00e1rio de luz natural do Ir\u00e3", "IRDT"}; + String ISRAEL[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Israel", "IST", + "Hor\u00e1rio de luz natural de Israel", "IDT"}; + String IST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da \u00cdndia", "IST", + "Hor\u00e1rio de luz natural da \u00cdndia", "IDT"}; + String JST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Jap\u00e3o", "JST", + "Hor\u00e1rio de luz natural do Jap\u00e3o", "JDT"}; + String KST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Coreia", "KST", + "Hor\u00e1rio de luz natural da Coreia", "KDT"}; + String LORD_HOWE[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Lord Howe", "LHST", + "Fuso hor\u00e1rio de ver\u00e3o de Lord Howe", "LHST"}; + String MHT[] = new String[] {"Fuso hor\u00e1rio das Ilhas Marshall", "MHT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Marshall", "MHST"}; + String MSK[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Moscou", "MSK", + "Hor\u00e1rio de luz natural de Moscou", "MSD"}; + String MST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o das montanhas", "MST", + "Hor\u00e1rio de luz natural das montanhas", "MDT"}; + String MYT[] = new String[] {"Fuso hor\u00e1rio da Mal\u00e1sia", "MYT", + "Fuso hor\u00e1rio de ver\u00e3o da Mal\u00e1sia", "MYST"}; + String NORONHA[] = new String[] {"Fuso hor\u00e1rio de Fernando de Noronha", "FNT", + "Fuso hor\u00e1rio de ver\u00e3o de Fernando de Noronha", "FNST"}; + String NOVT[] = new String[] {"Fuso hor\u00e1rio de Novosibirsk", "NOVT", + "Fuso hor\u00e1rio de ver\u00e3o de Novosibirsk", "NOVST"}; String NPT[] = new String[] {"Fuso hor\u00e1rio do Nepal", "NPT", "Fuso hor\u00e1rio de ver\u00e3o do Nepal", "NPST"}; - String NST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Terra Nova", "NST", - "Hor\u00e1rio de luz natural de Terra Nova", "NDT"}; - String NZST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Nova Zel\u00e2ndia", "NZST", - "Hor\u00e1rio de luz natural da Nova Zel\u00e2ndia", "NZDT"}; + String NST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Terra Nova", "NST", + "Hor\u00e1rio de luz natural de Terra Nova", "NDT"}; + String NZST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da Nova Zel\u00e2ndia", "NZST", + "Hor\u00e1rio de luz natural da Nova Zel\u00e2ndia", "NZDT"}; String PITCAIRN[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Pitcairn", "PST", - "Hor\u00e1rio de luz natural de Pitcairn", "PDT"}; - String PKT[] = new String[] {"Fuso hor\u00e1rio do Paquist\u00e3o", "PKT", - "Fuso hor\u00e1rio de ver\u00e3o do Paquist\u00e3o", "PKST"}; - String PONT[] = new String[] {"Fuso hor\u00e1rio de Pohnpei", "PONT", - "Fuso hor\u00e1rio de ver\u00e3o de Pohnpei", "PONST"}; - String PST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Pac\u00edfico", "PST", - "Hor\u00e1rio de luz natural do Pac\u00edfico", "PDT"}; + "Hor\u00e1rio de luz natural de Pitcairn", "PDT"}; + String PKT[] = new String[] {"Fuso hor\u00e1rio do Paquist\u00e3o", "PKT", + "Fuso hor\u00e1rio de ver\u00e3o do Paquist\u00e3o", "PKST"}; + String PONT[] = new String[] {"Fuso hor\u00e1rio de Pohnpei", "PONT", + "Fuso hor\u00e1rio de ver\u00e3o de Pohnpei", "PONST"}; + String PST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o do Pac\u00edfico", "PST", + "Hor\u00e1rio de luz natural do Pac\u00edfico", "PDT"}; String RST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental", "EST", "Hor\u00e1rio de luz natural central", "CDT"}; - String SAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da \u00c1frica do Sul", "SAST", - "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica do Sul", "SAST"}; - String SBT[] = new String[] {"Fuso hor\u00e1rio das Ilhas Salom\u00e3o", "SBT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Salom\u00e3o", "SBST"}; - String SGT[] = new String[] {"Fuso hor\u00e1rio de Cingapura", "SGT", - "Fuso hor\u00e1rio de ver\u00e1 de Cingapura", "SGST"}; - String SLST[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", - "Fuso hor\u00e1rio de ver\u00e3o de Serra Leoa", "SLST"}; - String TASMANIA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Tasm\u00e2nia)", "EST", - "Fuso hor\u00e1rio de ver\u00e3o oriental (Tasm\u00e2nia)", "EST"}; - String TMT[] = new String[] {"Fuso hor\u00e1rio do Turcomenist\u00e3o", "TMT", - "Fuso hor\u00e1rio de ver\u00e3o do Turcomenist\u00e3o", "TMST"}; - String TRUT[] = new String[] {"Fuso hor\u00e1rio de Chuuk", "CHUT", - "Fuso hor\u00e1rio de ver\u00e3o de Chuuk", "CHUST"}; - String ULAT[]= new String[] {"Fuso hor\u00e1rio de Ulan Bator", "ULAT", - "Fuso hor\u00e1rio de ver\u00e3o de Ulan Bator", "ULAST"}; - String WAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Ocidental", "WAT", - "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica Ocidental", "WAST"}; - String WET[] = new String[] {"Fuso hor\u00e1rio da Europa Ocidental", "WET", - "Fuso hor\u00e1rio de ver\u00e3o da Europa Ocidental", "WEST"}; - String WIT[] = new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Ocidental", "WIT", - "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Ocidental", "WIST"}; - String WST_AUS[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o ocidental (Austr\u00e1lia)", "WST", - "Fuso hor\u00e1rio de ver\u00e3o ocidental (Austr\u00e1lia)", "WST"}; - String SAMOA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Samoa", "SST", - "Hor\u00e1rio de luz natural de Samoa", "SDT"}; - String WST_SAMOA[] = new String[] {"Fuso hor\u00e1rio de Samoa Ocidental", "WST", - "Fuso hor\u00e1rio de ver\u00e3o de Samoa Ocidental", "WSST"}; - String ChST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chamorro", "ChST", - "Hor\u00e1rio de luz natural de Chamorro", "ChDT"}; - String VICTORIA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Victoria)", "EST", - "Fuso hor\u00e1rio de ver\u00e3o oriental (Victoria)", "EST"}; - String UTC[] = new String[] {"Tempo universal coordenado", "UTC", - "Tempo universal coordenado", "UTC"}; - String UZT[] = new String[] {"Fuso hor\u00e1rio do Uzbequist\u00e3o", "UZT", - "Fuso hor\u00e1rio de ver\u00e3o do Uzbequist\u00e3o", "UZST"}; - String WART[] = new String[] {"Fuso hor\u00e1rio da Argentina Ocidental", "WART", - "Fuso hor\u00e1rio de ver\u00e3o da Argentina Ocidental", "WARST"}; + String SAST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o da \u00c1frica do Sul", "SAST", + "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica do Sul", "SAST"}; + String SBT[] = new String[] {"Fuso hor\u00e1rio das Ilhas Salom\u00e3o", "SBT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Salom\u00e3o", "SBST"}; + String SGT[] = new String[] {"Fuso hor\u00e1rio de Cingapura", "SGT", + "Fuso hor\u00e1rio de ver\u00e1 de Cingapura", "SGST"}; + String SLST[] = new String[] {"Fuso hor\u00e1rio do meridiano de Greenwich", "GMT", + "Fuso hor\u00e1rio de ver\u00e3o de Serra Leoa", "SLST"}; + String TASMANIA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Tasm\u00e2nia)", "EST", + "Fuso hor\u00e1rio de ver\u00e3o oriental (Tasm\u00e2nia)", "EST"}; + String TMT[] = new String[] {"Fuso hor\u00e1rio do Turcomenist\u00e3o", "TMT", + "Fuso hor\u00e1rio de ver\u00e3o do Turcomenist\u00e3o", "TMST"}; + String TRUT[] = new String[] {"Fuso hor\u00e1rio de Chuuk", "CHUT", + "Fuso hor\u00e1rio de ver\u00e3o de Chuuk", "CHUST"}; + String ULAT[]= new String[] {"Fuso hor\u00e1rio de Ulan Bator", "ULAT", + "Fuso hor\u00e1rio de ver\u00e3o de Ulan Bator", "ULAST"}; + String WAT[] = new String[] {"Fuso hor\u00e1rio da \u00c1frica Ocidental", "WAT", + "Fuso hor\u00e1rio de ver\u00e3o da \u00c1frica Ocidental", "WAST"}; + String WET[] = new String[] {"Fuso hor\u00e1rio da Europa Ocidental", "WET", + "Fuso hor\u00e1rio de ver\u00e3o da Europa Ocidental", "WEST"}; + String WIT[] = new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Ocidental", "WIT", + "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Ocidental", "WIST"}; + String WST_AUS[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o ocidental (Austr\u00e1lia)", "WST", + "Fuso hor\u00e1rio de ver\u00e3o ocidental (Austr\u00e1lia)", "WST"}; + String SAMOA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Samoa", "SST", + "Hor\u00e1rio de luz natural de Samoa", "SDT"}; + String WST_SAMOA[] = new String[] {"Fuso hor\u00e1rio de Samoa Ocidental", "WST", + "Fuso hor\u00e1rio de ver\u00e3o de Samoa Ocidental", "WSST"}; + String ChST[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o de Chamorro", "ChST", + "Hor\u00e1rio de luz natural de Chamorro", "ChDT"}; + String VICTORIA[] = new String[] {"Fuso hor\u00e1rio padr\u00e3o oriental (Victoria)", "EST", + "Fuso hor\u00e1rio de ver\u00e3o oriental (Victoria)", "EST"}; + String UTC[] = new String[] {"Tempo universal coordenado", "UTC", + "Tempo universal coordenado", "UTC"}; + String UZT[] = new String[] {"Fuso hor\u00e1rio do Uzbequist\u00e3o", "UZT", + "Fuso hor\u00e1rio de ver\u00e3o do Uzbequist\u00e3o", "UZST"}; + String WART[] = new String[] {"Fuso hor\u00e1rio da Argentina Ocidental", "WART", + "Fuso hor\u00e1rio de ver\u00e3o da Argentina Ocidental", "WARST"}; + return new Object[][] { + {"America/Los_Angeles", PST}, + {"PST", PST}, + {"America/Denver", MST}, + {"MST", MST}, + {"America/Phoenix", MST}, + {"PNT", MST}, + {"America/Chicago", CST}, + {"CST", CST}, + {"America/New_York", EST}, + {"EST", EST}, + {"America/Indianapolis", EST}, + {"IET", EST}, + {"Pacific/Honolulu", HST}, + {"HST", HST}, + {"America/Anchorage", AKST}, + {"AST", AKST}, + {"America/Halifax", AST}, + {"America/Sitka", AKST}, + {"America/St_Johns", NST}, + {"CNT", NST}, + {"Europe/Paris", CET}, + {"ECT", CET}, + {"GMT", GMT}, + {"Africa/Casablanca", WET}, + {"Asia/Jerusalem", ISRAEL}, + {"Asia/Tokyo", JST}, + {"JST", JST}, + {"Europe/Bucharest", EET}, + {"Asia/Shanghai", CTT}, + {"CTT", CTT}, + /* Don't change the order of the above zones + * to keep compatibility with the previous version. + */ - return new Object[][] { - {"America/Los_Angeles", PST}, - {"PST", PST}, - {"America/Denver", MST}, - {"MST", MST}, - {"America/Phoenix", MST}, - {"PNT", MST}, - {"America/Chicago", CST}, - {"CST", CST}, - {"America/New_York", EST}, - {"EST", EST}, - {"America/Indianapolis", EST}, - {"IET", EST}, - {"Pacific/Honolulu", HST}, - {"HST", HST}, - {"America/Anchorage", AKST}, - {"AST", AKST}, - {"America/Halifax", AST}, - {"America/Sitka", AKST}, - {"America/St_Johns", NST}, - {"CNT", NST}, - {"Europe/Paris", CET}, - {"ECT", CET}, - {"GMT", GMT}, - {"Africa/Casablanca", WET}, - {"Asia/Jerusalem", ISRAEL}, - {"Asia/Tokyo", JST}, - {"JST", JST}, - {"Europe/Bucharest", EET}, - {"Asia/Shanghai", CTT}, - {"CTT", CTT}, - /* Don't change the order of the above zones - * to keep compatibility with the previous version. - */ - - {"ACT", DARWIN}, - {"AET", EST_NSW}, - {"AGT", AGT}, - {"ART", EET}, - {"Africa/Abidjan", GMT}, - {"Africa/Accra", GHMT}, - {"Africa/Addis_Ababa", EAT}, - {"Africa/Algiers", CET}, - {"Africa/Asmara", EAT}, - {"Africa/Asmera", EAT}, - {"Africa/Bamako", GMT}, - {"Africa/Bangui", WAT}, - {"Africa/Banjul", GMT}, - {"Africa/Bissau", GMT}, - {"Africa/Blantyre", CAT}, - {"Africa/Brazzaville", WAT}, - {"Africa/Bujumbura", CAT}, - {"Africa/Cairo", EET}, - {"Africa/Ceuta", CET}, - {"Africa/Conakry", GMT}, - {"Africa/Dakar", GMT}, - {"Africa/Dar_es_Salaam", EAT}, - {"Africa/Djibouti", EAT}, - {"Africa/Douala", WAT}, - {"Africa/El_Aaiun", WET}, - {"Africa/Freetown", SLST}, - {"Africa/Gaborone", CAT}, - {"Africa/Harare", CAT}, - {"Africa/Johannesburg", SAST}, - {"Africa/Kampala", EAT}, - {"Africa/Khartoum", EAT}, - {"Africa/Kigali", CAT}, - {"Africa/Kinshasa", WAT}, - {"Africa/Lagos", WAT}, - {"Africa/Libreville", WAT}, - {"Africa/Lome", GMT}, - {"Africa/Luanda", WAT}, - {"Africa/Lubumbashi", CAT}, - {"Africa/Lusaka", CAT}, - {"Africa/Malabo", WAT}, - {"Africa/Maputo", CAT}, - {"Africa/Maseru", SAST}, - {"Africa/Mbabane", SAST}, - {"Africa/Mogadishu", EAT}, - {"Africa/Monrovia", GMT}, - {"Africa/Nairobi", EAT}, - {"Africa/Ndjamena", WAT}, - {"Africa/Niamey", WAT}, - {"Africa/Nouakchott", GMT}, - {"Africa/Ouagadougou", GMT}, - {"Africa/Porto-Novo", WAT}, - {"Africa/Sao_Tome", GMT}, - {"Africa/Timbuktu", GMT}, - {"Africa/Tripoli", EET}, - {"Africa/Tunis", CET}, - {"Africa/Windhoek", WAT}, - {"America/Adak", HAST}, - {"America/Anguilla", AST}, - {"America/Antigua", AST}, - {"America/Araguaina", BRT}, - {"America/Argentina/Buenos_Aires", AGT}, - {"America/Argentina/Catamarca", AGT}, - {"America/Argentina/ComodRivadavia", AGT}, - {"America/Argentina/Cordoba", AGT}, - {"America/Argentina/Jujuy", AGT}, - {"America/Argentina/La_Rioja", AGT}, - {"America/Argentina/Mendoza", AGT}, - {"America/Argentina/Rio_Gallegos", AGT}, - {"America/Argentina/Salta", AGT}, - {"America/Argentina/San_Juan", AGT}, - {"America/Argentina/San_Luis", WART}, - {"America/Argentina/Tucuman", AGT}, - {"America/Argentina/Ushuaia", AGT}, - {"America/Aruba", AST}, - {"America/Asuncion", new String[] {"Fuso hor\u00e1rio do Paraguai", "PYT", - "Fuso hor\u00e1rio de ver\u00e3o do Paraguai", "PYST"}}, + {"ACT", DARWIN}, + {"AET", EST_NSW}, + {"AGT", AGT}, + {"ART", EET}, + {"Africa/Abidjan", GMT}, + {"Africa/Accra", GHMT}, + {"Africa/Addis_Ababa", EAT}, + {"Africa/Algiers", CET}, + {"Africa/Asmara", EAT}, + {"Africa/Asmera", EAT}, + {"Africa/Bamako", GMT}, + {"Africa/Bangui", WAT}, + {"Africa/Banjul", GMT}, + {"Africa/Bissau", GMT}, + {"Africa/Blantyre", CAT}, + {"Africa/Brazzaville", WAT}, + {"Africa/Bujumbura", CAT}, + {"Africa/Cairo", EET}, + {"Africa/Ceuta", CET}, + {"Africa/Conakry", GMT}, + {"Africa/Dakar", GMT}, + {"Africa/Dar_es_Salaam", EAT}, + {"Africa/Djibouti", EAT}, + {"Africa/Douala", WAT}, + {"Africa/El_Aaiun", WET}, + {"Africa/Freetown", SLST}, + {"Africa/Gaborone", CAT}, + {"Africa/Harare", CAT}, + {"Africa/Johannesburg", SAST}, + {"Africa/Kampala", EAT}, + {"Africa/Khartoum", EAT}, + {"Africa/Kigali", CAT}, + {"Africa/Kinshasa", WAT}, + {"Africa/Lagos", WAT}, + {"Africa/Libreville", WAT}, + {"Africa/Lome", GMT}, + {"Africa/Luanda", WAT}, + {"Africa/Lubumbashi", CAT}, + {"Africa/Lusaka", CAT}, + {"Africa/Malabo", WAT}, + {"Africa/Maputo", CAT}, + {"Africa/Maseru", SAST}, + {"Africa/Mbabane", SAST}, + {"Africa/Mogadishu", EAT}, + {"Africa/Monrovia", GMT}, + {"Africa/Nairobi", EAT}, + {"Africa/Ndjamena", WAT}, + {"Africa/Niamey", WAT}, + {"Africa/Nouakchott", GMT}, + {"Africa/Ouagadougou", GMT}, + {"Africa/Porto-Novo", WAT}, + {"Africa/Sao_Tome", GMT}, + {"Africa/Timbuktu", GMT}, + {"Africa/Tripoli", EET}, + {"Africa/Tunis", CET}, + {"Africa/Windhoek", WAT}, + {"America/Adak", HAST}, + {"America/Anguilla", AST}, + {"America/Antigua", AST}, + {"America/Araguaina", BRT}, + {"America/Argentina/Buenos_Aires", AGT}, + {"America/Argentina/Catamarca", AGT}, + {"America/Argentina/ComodRivadavia", AGT}, + {"America/Argentina/Cordoba", AGT}, + {"America/Argentina/Jujuy", AGT}, + {"America/Argentina/La_Rioja", AGT}, + {"America/Argentina/Mendoza", AGT}, + {"America/Argentina/Rio_Gallegos", AGT}, + {"America/Argentina/Salta", AGT}, + {"America/Argentina/San_Juan", AGT}, + {"America/Argentina/San_Luis", WART}, + {"America/Argentina/Tucuman", AGT}, + {"America/Argentina/Ushuaia", AGT}, + {"America/Aruba", AST}, + {"America/Asuncion", new String[] {"Fuso hor\u00e1rio do Paraguai", "PYT", + "Fuso hor\u00e1rio de ver\u00e3o do Paraguai", "PYST"}}, {"America/Atikokan", EST}, - {"America/Atka", HAST}, - {"America/Bahia", BRT}, - {"America/Bahia_Banderas", CST}, - {"America/Barbados", AST}, - {"America/Belem", BRT}, - {"America/Belize", CST}, + {"America/Atka", HAST}, + {"America/Bahia", BRT}, + {"America/Bahia_Banderas", CST}, + {"America/Barbados", AST}, + {"America/Belem", BRT}, + {"America/Belize", CST}, {"America/Blanc-Sablon", AST}, - {"America/Boa_Vista", AMT}, - {"America/Bogota", new String[] {"Fuso hor\u00e1rio da Col\u00f4mbia", "COT", - "Fuso hor\u00e1rio de ver\u00e3o da Col\u00f4mbia", "COST"}}, - {"America/Boise", MST}, - {"America/Buenos_Aires", AGT}, - {"America/Cambridge_Bay", MST}, - {"America/Campo_Grande", AMT}, - {"America/Cancun", CST}, - {"America/Caracas", new String[] {"Fuso hor\u00e1rio da Venezuela", "VET", - "Fuso hor\u00e1rio de ver\u00e3o da Venezuela", "VEST"}}, - {"America/Catamarca", AGT}, - {"America/Cayenne", new String[] {"Fuso hor\u00e1rio da Guiana Francesa", "GFT", - "Fuso hor\u00e1rio de ver\u00e3o da Guiana Francesa", "GFST"}}, - {"America/Cayman", EST}, - {"America/Chihuahua", MST}, - {"America/Coral_Harbour", EST}, - {"America/Cordoba", AGT}, - {"America/Costa_Rica", CST}, - {"America/Cuiaba", AMT}, - {"America/Curacao", AST}, - {"America/Danmarkshavn", GMT}, - {"America/Dawson", PST}, - {"America/Dawson_Creek", MST}, - {"America/Detroit", EST}, - {"America/Dominica", AST}, - {"America/Edmonton", MST}, - {"America/Eirunepe", AMT}, - {"America/El_Salvador", CST}, - {"America/Ensenada", PST}, - {"America/Fort_Wayne", EST}, - {"America/Fortaleza", BRT}, - {"America/Glace_Bay", AST}, - {"America/Godthab", new String[] {"Fuso hor\u00e1rio da Groenl\u00e2ndia Ocidental", "WGT", - "Fuso hor\u00e1rio de ver\u00e3o da Groenl\u00e2ndia Ocidental", "WGST"}}, - {"America/Goose_Bay", AST}, - {"America/Grand_Turk", EST}, - {"America/Grenada", AST}, - {"America/Guadeloupe", AST}, - {"America/Guatemala", CST}, - {"America/Guayaquil", new String[] {"Fuso hor\u00e1rio do Equador", "ECT", - "Fuso hor\u00e1rio de ver\u00e3o do Equador", "ECST"}}, - {"America/Guyana", new String[] {"Fuso hor\u00e1rio da Guiana", "GYT", - "Fuso hor\u00e1rio de ver\u00e3o da Guiana", "GYST"}}, - {"America/Havana", CUBA}, - {"America/Hermosillo", MST}, - {"America/Indiana/Indianapolis", EST}, - {"America/Indiana/Knox", CST}, - {"America/Indiana/Marengo", EST}, - {"America/Indiana/Petersburg", EST}, - {"America/Indiana/Tell_City", CST}, - {"America/Indiana/Vevay", EST}, - {"America/Indiana/Vincennes", EST}, - {"America/Indiana/Winamac", EST}, - {"America/Inuvik", MST}, - {"America/Iqaluit", EST}, - {"America/Jamaica", EST}, - {"America/Jujuy", AGT}, - {"America/Juneau", AKST}, - {"America/Kentucky/Louisville", EST}, - {"America/Kentucky/Monticello", EST}, - {"America/Knox_IN", CST}, - {"America/La_Paz", new String[] {"Fuso hor\u00e1rio da Bol\u00edvia", "BOT", - "Fuso hor\u00e1rio de ver\u00e3o da Bol\u00edvia", "BOST"}}, - {"America/Lima", new String[] {"Fuso hor\u00e1rio do Peru", "PET", - "Fuso hor\u00e1rio de ver\u00e3o do Peru", "PEST"}}, - {"America/Louisville", EST}, - {"America/Maceio", BRT}, - {"America/Managua", CST}, - {"America/Manaus", AMT}, - {"America/Marigot", AST}, - {"America/Martinique", AST}, - {"America/Mazatlan", MST}, - {"America/Mendoza", AGT}, - {"America/Menominee", CST}, - {"America/Merida", CST}, - {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST", - "Metlakatla Daylight Time", "MeDT"}}, - {"America/Mexico_City", CST}, - {"America/Miquelon", new String[] {"Fuso hor\u00e1rio padr\u00e3o de S\u00e3o Pedro e Miquelon", "PMST", - "Hor\u00e1rio de luz natural de S\u00e3o Pedro e Miquelon", "PMDT"}}, - {"America/Moncton", AST}, - {"America/Montevideo", new String[] {"Fuso hor\u00e1rio do Uruguai", "UYT", - "Fuso hor\u00e1rio de ver\u00e3o do Uruguai", "UYST"}}, - {"America/Monterrey", CST}, - {"America/Montreal", EST}, - {"America/Montserrat", AST}, - {"America/Nassau", EST}, - {"America/Nipigon", EST}, - {"America/Nome", AKST}, - {"America/Noronha", NORONHA}, + {"America/Boa_Vista", AMT}, + {"America/Bogota", new String[] {"Fuso hor\u00e1rio da Col\u00f4mbia", "COT", + "Fuso hor\u00e1rio de ver\u00e3o da Col\u00f4mbia", "COST"}}, + {"America/Boise", MST}, + {"America/Buenos_Aires", AGT}, + {"America/Cambridge_Bay", MST}, + {"America/Campo_Grande", AMT}, + {"America/Cancun", CST}, + {"America/Caracas", new String[] {"Fuso hor\u00e1rio da Venezuela", "VET", + "Fuso hor\u00e1rio de ver\u00e3o da Venezuela", "VEST"}}, + {"America/Catamarca", AGT}, + {"America/Cayenne", new String[] {"Fuso hor\u00e1rio da Guiana Francesa", "GFT", + "Fuso hor\u00e1rio de ver\u00e3o da Guiana Francesa", "GFST"}}, + {"America/Cayman", EST}, + {"America/Chihuahua", MST}, + {"America/Coral_Harbour", EST}, + {"America/Cordoba", AGT}, + {"America/Costa_Rica", CST}, + {"America/Cuiaba", AMT}, + {"America/Curacao", AST}, + {"America/Danmarkshavn", GMT}, + {"America/Dawson", PST}, + {"America/Dawson_Creek", MST}, + {"America/Detroit", EST}, + {"America/Dominica", AST}, + {"America/Edmonton", MST}, + {"America/Eirunepe", AMT}, + {"America/El_Salvador", CST}, + {"America/Ensenada", PST}, + {"America/Fort_Wayne", EST}, + {"America/Fortaleza", BRT}, + {"America/Glace_Bay", AST}, + {"America/Godthab", new String[] {"Fuso hor\u00e1rio da Groenl\u00e2ndia Ocidental", "WGT", + "Fuso hor\u00e1rio de ver\u00e3o da Groenl\u00e2ndia Ocidental", "WGST"}}, + {"America/Goose_Bay", AST}, + {"America/Grand_Turk", EST}, + {"America/Grenada", AST}, + {"America/Guadeloupe", AST}, + {"America/Guatemala", CST}, + {"America/Guayaquil", new String[] {"Fuso hor\u00e1rio do Equador", "ECT", + "Fuso hor\u00e1rio de ver\u00e3o do Equador", "ECST"}}, + {"America/Guyana", new String[] {"Fuso hor\u00e1rio da Guiana", "GYT", + "Fuso hor\u00e1rio de ver\u00e3o da Guiana", "GYST"}}, + {"America/Havana", CUBA}, + {"America/Hermosillo", MST}, + {"America/Indiana/Indianapolis", EST}, + {"America/Indiana/Knox", CST}, + {"America/Indiana/Marengo", EST}, + {"America/Indiana/Petersburg", EST}, + {"America/Indiana/Tell_City", CST}, + {"America/Indiana/Vevay", EST}, + {"America/Indiana/Vincennes", EST}, + {"America/Indiana/Winamac", EST}, + {"America/Inuvik", MST}, + {"America/Iqaluit", EST}, + {"America/Jamaica", EST}, + {"America/Jujuy", AGT}, + {"America/Juneau", AKST}, + {"America/Kentucky/Louisville", EST}, + {"America/Kentucky/Monticello", EST}, + {"America/Knox_IN", CST}, + {"America/La_Paz", new String[] {"Fuso hor\u00e1rio da Bol\u00edvia", "BOT", + "Fuso hor\u00e1rio de ver\u00e3o da Bol\u00edvia", "BOST"}}, + {"America/Lima", new String[] {"Fuso hor\u00e1rio do Peru", "PET", + "Fuso hor\u00e1rio de ver\u00e3o do Peru", "PEST"}}, + {"America/Louisville", EST}, + {"America/Maceio", BRT}, + {"America/Managua", CST}, + {"America/Manaus", AMT}, + {"America/Marigot", AST}, + {"America/Martinique", AST}, + {"America/Matamoros", CST}, + {"America/Mazatlan", MST}, + {"America/Mendoza", AGT}, + {"America/Menominee", CST}, + {"America/Merida", CST}, + {"America/Metlakatla", new String[] {"Metlakatla Standard Time", "MeST", + "Metlakatla Daylight Time", "MeDT"}}, + {"America/Mexico_City", CST}, + {"America/Miquelon", new String[] {"Fuso hor\u00e1rio padr\u00e3o de S\u00e3o Pedro e Miquelon", "PMST", + "Hor\u00e1rio de luz natural de S\u00e3o Pedro e Miquelon", "PMDT"}}, + {"America/Moncton", AST}, + {"America/Montevideo", new String[] {"Fuso hor\u00e1rio do Uruguai", "UYT", + "Fuso hor\u00e1rio de ver\u00e3o do Uruguai", "UYST"}}, + {"America/Monterrey", CST}, + {"America/Montreal", EST}, + {"America/Montserrat", AST}, + {"America/Nassau", EST}, + {"America/Nipigon", EST}, + {"America/Nome", AKST}, + {"America/Noronha", NORONHA}, {"America/North_Dakota/Beulah", CST}, - {"America/North_Dakota/Center", CST}, + {"America/North_Dakota/Center", CST}, {"America/North_Dakota/New_Salem", CST}, - {"America/Panama", EST}, - {"America/Pangnirtung", EST}, - {"America/Paramaribo", new String[] {"Fuso hor\u00e1rio do Suriname", "SRT", - "Fuso hor\u00e1rio de ver\u00e3o do Suriname", "SRST"}}, - {"America/Port-au-Prince", EST}, - {"America/Port_of_Spain", AST}, - {"America/Porto_Acre", AMT}, - {"America/Porto_Velho", AMT}, - {"America/Puerto_Rico", AST}, - {"America/Rainy_River", CST}, - {"America/Rankin_Inlet", CST}, - {"America/Recife", BRT}, - {"America/Regina", CST}, - {"America/Resolute", RST}, - {"America/Rio_Branco", AMT}, - {"America/Rosario", AGT}, - {"America/Santarem", BRT}, - {"America/Santiago", CLT}, - {"America/Santo_Domingo", AST}, - {"America/Sao_Paulo", BRT}, - {"America/Scoresbysund", EGT}, - {"America/Shiprock", MST}, - {"America/St_Barthelemy", AST}, - {"America/St_Kitts", AST}, - {"America/St_Lucia", AST}, - {"America/St_Thomas", AST}, - {"America/St_Vincent", AST}, - {"America/Swift_Current", CST}, - {"America/Tegucigalpa", CST}, - {"America/Thule", AST}, - {"America/Thunder_Bay", EST}, - {"America/Tijuana", PST}, - {"America/Toronto", EST}, - {"America/Tortola", AST}, - {"America/Vancouver", PST}, - {"America/Virgin", AST}, - {"America/Whitehorse", PST}, - {"America/Winnipeg", CST}, - {"America/Yakutat", AKST}, - {"America/Yellowknife", MST}, - {"Antarctica/Casey", WST_AUS}, - {"Antarctica/Davis", new String[] {"Fuso hor\u00e1rio de Davis", "DAVT", - "Fuso hor\u00e1rio de ver\u00e3o de Davis", "DAVST"}}, - {"Antarctica/DumontDUrville", new String[] {"Fuso hor\u00e1rio de Dumont-d'Urville", "DDUT", - "Fuso hor\u00e1rio de ver\u00e3o de Dumont-d'Urville", "DDUST"}}, - {"Antarctica/Mawson", new String[] {"Fuso hor\u00e1rio de Mawson", "MAWT", - "Fuso hor\u00e1rio de ver\u00e3o de Mawson", "MAWST"}}, - {"Antarctica/McMurdo", NZST}, - {"Antarctica/Palmer", CLT}, - {"Antarctica/Rothera", new String[] {"Fuso hor\u00e1rio de Rothera", "ROTT", - "Fuso hor\u00e1rio de ver\u00e3o de Rothera", "ROTST"}}, - {"Antarctica/South_Pole", NZST}, - {"Antarctica/Syowa", new String[] {"Fuso hor\u00e1rio de Syowa", "SYOT", - "Fuso hor\u00e1rio de ver\u00e3o de Syowa", "SYOST"}}, - {"Antarctica/Vostok", new String[] {"Fuso hor\u00e1rio de Vostok", "VOST", - "Fuso hor\u00e1rio de ver\u00e3o de Vostok", "VOSST"}}, - {"Arctic/Longyearbyen", CET}, - {"Asia/Aden", ARAST}, - {"Asia/Almaty", new String[] {"Fuso hor\u00e1rio de Alma-Ata", "ALMT", - "Fuso hor\u00e1rio de ver\u00e3o de Alma-Ata", "ALMST"}}, - {"Asia/Amman", EET}, - {"Asia/Anadyr", new String[] {"Fuso hor\u00e1rio de Anadyr", "ANAT", - "Fuso hor\u00e1rio de ver\u00e3o de Anadyr", "ANAST"}}, - {"Asia/Aqtau", new String[] {"Fuso hor\u00e1rio de Aqtau", "AQTT", - "Fuso hor\u00e1rio de ver\u00e3o de Aqtau", "AQTST"}}, - {"Asia/Aqtobe", new String[] {"Fuso hor\u00e1rio de Aqtobe", "AQTT", - "Fuso hor\u00e1rio de ver\u00e3o de Aqtobe", "AQTST"}}, - {"Asia/Ashgabat", TMT}, - {"Asia/Ashkhabad", TMT}, - {"Asia/Baghdad", ARAST}, - {"Asia/Bahrain", ARAST}, - {"Asia/Baku", new String[] {"Fuso hor\u00e1rio do Azerbaij\u00e3o", "AZT", - "Fuso hor\u00e1rio de ver\u00e3o do Azerbaij\u00e3o", "AZST"}}, - {"Asia/Bangkok", ICT}, - {"Asia/Beirut", EET}, - {"Asia/Bishkek", new String[] {"Fuso hor\u00e1rio do Quirguist\u00e3o", "KGT", - "Fuso hor\u00e1rio de ver\u00e3o do Quirguist\u00e3o", "KGST"}}, - {"Asia/Brunei", new String[] {"Fuso hor\u00e1rio de Brunei", "BNT", - "Fuso hor\u00e1rio de ver\u00e3o de Brunei", "BNST"}}, - {"Asia/Calcutta", IST}, - {"Asia/Choibalsan", new String[] {"Fuso hor\u00e1rio de Choibalsan", "CHOT", - "Fuso hor\u00e1rio de ver\u00e3o de Choibalsan", "CHOST"}}, - {"Asia/Chongqing", CTT}, - {"Asia/Chungking", CTT}, - {"Asia/Colombo", IST}, - {"Asia/Dacca", BDT}, - {"Asia/Dhaka", BDT}, - {"Asia/Dili", new String[] {"Fuso hor\u00e1rio do Timor-Leste", "TLT", - "Fuso hor\u00e1rio de ver\u00e3o do Timor-Leste", "TLST"}}, - {"Asia/Damascus", EET}, - {"Asia/Dubai", GST}, - {"Asia/Dushanbe", new String[] {"Fuso hor\u00e1rio do Tadjiquist\u00e3o", "TJT", - "Fuso hor\u00e1rio de ver\u00e3o do Tadjiquist\u00e3o", "TJST"}}, - {"Asia/Gaza", EET}, - {"Asia/Harbin", CTT}, - {"Asia/Ho_Chi_Minh", ICT}, - {"Asia/Hong_Kong", HKT}, - {"Asia/Hovd", new String[] {"Fuso hor\u00e1rio de Hovd", "HOVT", - "Fuso hor\u00e1rio de ver\u00e3o de Hovd", "HOVST"}}, - {"Asia/Irkutsk", new String[] {"Fuso hor\u00e1rio de Irkutsk", "IRKT", - "Fuso hor\u00e1rio de ver\u00e3o de Irkutsk", "IRKST"}}, - {"Asia/Istanbul", EET}, - {"Asia/Jakarta", WIT}, - {"Asia/Jayapura", new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Oriental", "EIT", - "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Oriental", "EIST"}}, - {"Asia/Kabul", new String[] {"Fuso hor\u00e1rio do Afeganist\u00e3o", "AFT", - "Fuso hor\u00e1rio de ver\u00e3o do Afeganist\u00e3o", "AFST"}}, - {"Asia/Kamchatka", new String[] {"Fuso hor\u00e1rio de Petropavlovsk-Kamchatski", "PETT", - "Fuso hor\u00e1rio de ver\u00e3o de Petropavlovsk-Kamchatski", "PETST"}}, - {"Asia/Karachi", PKT}, - {"Asia/Kashgar", CTT}, - {"Asia/Kathmandu", NPT}, - {"Asia/Katmandu", NPT}, - {"Asia/Kolkata", IST}, - {"Asia/Krasnoyarsk", new String[] {"Fuso hor\u00e1rio de Krasnoyarsk", "KRAT", - "Fuso hor\u00e1rio de ver\u00e3o de Krasnoyarsk", "KRAST"}}, - {"Asia/Kuala_Lumpur", MYT}, - {"Asia/Kuching", MYT}, - {"Asia/Kuwait", ARAST}, - {"Asia/Macao", CTT}, - {"Asia/Macau", CTT}, - {"Asia/Magadan", new String[] {"Fuso hor\u00e1rio de Magadan", "MAGT", - "Fuso hor\u00e1rio de ver\u00e3o de Magadan", "MAGST"}}, - {"Asia/Makassar", CIT}, - {"Asia/Manila", new String[] {"Fuso hor\u00e1rio das Filipinas", "PHT", - "Fuso hor\u00e1rio de ver\u00e3o das Filipinas", "PHST"}}, - {"Asia/Muscat", GST}, - {"Asia/Nicosia", EET}, - {"Asia/Novokuznetsk", NOVT}, - {"Asia/Novosibirsk", NOVT}, - {"Asia/Oral", new String[] {"Fuso hor\u00e1rio de Uralsk", "ORAT", - "Fuso hor\u00e1rio de ver\u00e3o de Uralsk", "ORAST"}}, - {"Asia/Omsk", new String[] {"Fuso hor\u00e1rio de Omsk", "OMST", - "Fuso hor\u00e1rio de ver\u00e3o de Omsk", "OMSST"}}, - {"Asia/Phnom_Penh", ICT}, - {"Asia/Pontianak", WIT}, - {"Asia/Pyongyang", KST}, - {"Asia/Qatar", ARAST}, - {"Asia/Qyzylorda", new String[] {"Fuso hor\u00e1rio de Kizil-Orda", "QYZT", - "Fuso hor\u00e1rio de ver\u00e3o de Kizil-Orda", "QYZST"}}, - {"Asia/Rangoon", new String[] {"Fuso hor\u00e1rio de Mianmar", "MMT", - "Fuso hor\u00e1rio de ver\u00e3o de Mianmar", "MMST"}}, - {"Asia/Riyadh", ARAST}, - {"Asia/Saigon", ICT}, - {"Asia/Sakhalin", new String[] {"Fuso hor\u00e1rio de Sakhalina", "SAKT", - "Fuso hor\u00e1rio de ver\u00e3o de Sakhalina", "SAKST"}}, - {"Asia/Samarkand", UZT}, - {"Asia/Seoul", KST}, - {"Asia/Singapore", SGT}, - {"Asia/Taipei", CTT}, - {"Asia/Tel_Aviv", ISRAEL}, - {"Asia/Tashkent", UZT}, - {"Asia/Tbilisi", new String[] {"Fuso hor\u00e1rio da Ge\u00f3rgia", "GET", - "Fuso hor\u00e1rio de ver\u00e3o da Ge\u00f3rgia", "GEST"}}, - {"Asia/Tehran", IRT}, - {"Asia/Thimbu", BTT}, - {"Asia/Thimphu", BTT}, - {"Asia/Ujung_Pandang", CIT}, - {"Asia/Ulaanbaatar", ULAT}, - {"Asia/Ulan_Bator", ULAT}, - {"Asia/Urumqi", CTT}, - {"Asia/Vientiane", ICT}, - {"Asia/Vladivostok", new String[] {"Fuso hor\u00e1rio de Vladivostok", "VLAT", - "Fuso hor\u00e1rio de ver\u00e3o de Vladivostok", "VLAST"}}, - {"Asia/Yakutsk", new String[] {"Fuso hor\u00e1rio de Yakutsk", "YAKT", - "Fuso hor\u00e1rio de ver\u00e3o de Yakutsk", "YAKST"}}, - {"Asia/Yekaterinburg", new String[] {"Fuso hor\u00e1rio de Yekaterinburgo", "YEKT", - "Fuso hor\u00e1rio de ver\u00e3o de Yekaterinburgo", "YEKST"}}, - {"Asia/Yerevan", ARMT}, - {"Atlantic/Azores", new String[] {"Fuso hor\u00e1rio das A\u00e7ores", "AZOT", - "Fuso hor\u00e1rio de ver\u00e3o das A\u00e7ores", "AZOST"}}, - {"Atlantic/Bermuda", AST}, - {"Atlantic/Canary", WET}, - {"Atlantic/Cape_Verde", new String[] {"Fuso hor\u00e1rio de Cabo Verde", "CVT", - "Fuso hor\u00e1rio de ver\u00e3o de Cabo Verde", "CVST"}}, - {"Atlantic/Faeroe", WET}, - {"Atlantic/Faroe", WET}, - {"Atlantic/Jan_Mayen", CET}, - {"Atlantic/Madeira", WET}, - {"Atlantic/Reykjavik", GMT}, - {"Atlantic/South_Georgia", new String[] {"Fuso hor\u00e1rio padr\u00e3o da Ge\u00f3rgia do Sul", "GST", - "Hor\u00e1rio de luz natural da Ge\u00f3rgia do Sul", "GDT"}}, - {"Atlantic/St_Helena", GMT}, - {"Atlantic/Stanley", new String[] {"Fuso hor\u00e1rio das Ilhas Falkland", "FKT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Falkland", "FKST"}}, - {"Australia/ACT", EST_NSW}, - {"Australia/Adelaide", ADELAIDE}, - {"Australia/Brisbane", BRISBANE}, - {"Australia/Broken_Hill", BROKEN_HILL}, - {"Australia/Canberra", EST_NSW}, - {"Australia/Currie", EST_NSW}, - {"Australia/Darwin", DARWIN}, - {"Australia/Eucla", new String[] {"Fuso hor\u00e1rio ocidental central (Austr\u00e1lia)", "CWST", - "Fuso hor\u00e1rio de ver\u00e3o ocidental central (Austr\u00e1lia)", "CWST"}}, - {"Australia/Hobart", TASMANIA}, - {"Australia/LHI", LORD_HOWE}, - {"Australia/Lindeman", BRISBANE}, - {"Australia/Lord_Howe", LORD_HOWE}, - {"Australia/Melbourne", VICTORIA}, - {"Australia/North", DARWIN}, - {"Australia/NSW", EST_NSW}, - {"Australia/Perth", WST_AUS}, - {"Australia/Queensland", BRISBANE}, - {"Australia/South", ADELAIDE}, - {"Australia/Sydney", EST_NSW}, - {"Australia/Tasmania", TASMANIA}, - {"Australia/Victoria", VICTORIA}, - {"Australia/West", WST_AUS}, - {"Australia/Yancowinna", BROKEN_HILL}, - {"BET", BRT}, - {"BST", BDT}, - {"Brazil/Acre", AMT}, - {"Brazil/DeNoronha", NORONHA}, - {"Brazil/East", BRT}, - {"Brazil/West", AMT}, - {"Canada/Atlantic", AST}, - {"Canada/Central", CST}, - {"Canada/East-Saskatchewan", CST}, - {"Canada/Eastern", EST}, - {"Canada/Mountain", MST}, - {"Canada/Newfoundland", NST}, - {"Canada/Pacific", PST}, - {"Canada/Yukon", PST}, - {"Canada/Saskatchewan", CST}, - {"CAT", CAT}, - {"CET", CET}, - {"Chile/Continental", CLT}, - {"Chile/EasterIsland", EASTER}, - {"CST6CDT", CST}, - {"Cuba", CUBA}, - {"EAT", EAT}, - {"EET", EET}, - {"Egypt", EET}, - {"Eire", DUBLIN}, - {"EST5EDT", EST}, - {"Etc/Greenwich", GMT}, - {"Etc/UCT", UTC}, - {"Etc/Universal", UTC}, - {"Etc/UTC", UTC}, - {"Etc/Zulu", UTC}, - {"Europe/Amsterdam", CET}, - {"Europe/Andorra", CET}, - {"Europe/Athens", EET}, - {"Europe/Belfast", GMTBST}, - {"Europe/Belgrade", CET}, - {"Europe/Berlin", CET}, - {"Europe/Bratislava", CET}, - {"Europe/Brussels", CET}, - {"Europe/Budapest", CET}, - {"Europe/Chisinau", EET}, - {"Europe/Copenhagen", CET}, - {"Europe/Dublin", DUBLIN}, - {"Europe/Gibraltar", CET}, + {"America/Ojinaga", MST}, + {"America/Panama", EST}, + {"America/Pangnirtung", EST}, + {"America/Paramaribo", new String[] {"Fuso hor\u00e1rio do Suriname", "SRT", + "Fuso hor\u00e1rio de ver\u00e3o do Suriname", "SRST"}}, + {"America/Port-au-Prince", EST}, + {"America/Port_of_Spain", AST}, + {"America/Porto_Acre", AMT}, + {"America/Porto_Velho", AMT}, + {"America/Puerto_Rico", AST}, + {"America/Rainy_River", CST}, + {"America/Rankin_Inlet", CST}, + {"America/Recife", BRT}, + {"America/Regina", CST}, + {"America/Resolute", RST}, + {"America/Rio_Branco", AMT}, + {"America/Rosario", AGT}, + {"America/Santa_Isabel", PST}, + {"America/Santarem", BRT}, + {"America/Santiago", CLT}, + {"America/Santo_Domingo", AST}, + {"America/Sao_Paulo", BRT}, + {"America/Scoresbysund", EGT}, + {"America/Shiprock", MST}, + {"America/St_Barthelemy", AST}, + {"America/St_Kitts", AST}, + {"America/St_Lucia", AST}, + {"America/St_Thomas", AST}, + {"America/St_Vincent", AST}, + {"America/Swift_Current", CST}, + {"America/Tegucigalpa", CST}, + {"America/Thule", AST}, + {"America/Thunder_Bay", EST}, + {"America/Tijuana", PST}, + {"America/Toronto", EST}, + {"America/Tortola", AST}, + {"America/Vancouver", PST}, + {"America/Virgin", AST}, + {"America/Whitehorse", PST}, + {"America/Winnipeg", CST}, + {"America/Yakutat", AKST}, + {"America/Yellowknife", MST}, + {"Antarctica/Casey", WST_AUS}, + {"Antarctica/Davis", new String[] {"Fuso hor\u00e1rio de Davis", "DAVT", + "Fuso hor\u00e1rio de ver\u00e3o de Davis", "DAVST"}}, + {"Antarctica/DumontDUrville", new String[] {"Fuso hor\u00e1rio de Dumont-d'Urville", "DDUT", + "Fuso hor\u00e1rio de ver\u00e3o de Dumont-d'Urville", "DDUST"}}, + {"Antarctica/Macquarie", new String[] {"Macquarie Island Time", "MIST", + "Macquarie Island Summer Time", "MIST"}}, + {"Antarctica/Mawson", new String[] {"Fuso hor\u00e1rio de Mawson", "MAWT", + "Fuso hor\u00e1rio de ver\u00e3o de Mawson", "MAWST"}}, + {"Antarctica/McMurdo", NZST}, + {"Antarctica/Palmer", CLT}, + {"Antarctica/Rothera", new String[] {"Fuso hor\u00e1rio de Rothera", "ROTT", + "Fuso hor\u00e1rio de ver\u00e3o de Rothera", "ROTST"}}, + {"Antarctica/South_Pole", NZST}, + {"Antarctica/Syowa", new String[] {"Fuso hor\u00e1rio de Syowa", "SYOT", + "Fuso hor\u00e1rio de ver\u00e3o de Syowa", "SYOST"}}, + {"Antarctica/Vostok", new String[] {"Fuso hor\u00e1rio de Vostok", "VOST", + "Fuso hor\u00e1rio de ver\u00e3o de Vostok", "VOSST"}}, + {"Arctic/Longyearbyen", CET}, + {"Asia/Aden", ARAST}, + {"Asia/Almaty", new String[] {"Fuso hor\u00e1rio de Alma-Ata", "ALMT", + "Fuso hor\u00e1rio de ver\u00e3o de Alma-Ata", "ALMST"}}, + {"Asia/Amman", EET}, + {"Asia/Anadyr", new String[] {"Fuso hor\u00e1rio de Anadyr", "ANAT", + "Fuso hor\u00e1rio de ver\u00e3o de Anadyr", "ANAST"}}, + {"Asia/Aqtau", new String[] {"Fuso hor\u00e1rio de Aqtau", "AQTT", + "Fuso hor\u00e1rio de ver\u00e3o de Aqtau", "AQTST"}}, + {"Asia/Aqtobe", new String[] {"Fuso hor\u00e1rio de Aqtobe", "AQTT", + "Fuso hor\u00e1rio de ver\u00e3o de Aqtobe", "AQTST"}}, + {"Asia/Ashgabat", TMT}, + {"Asia/Ashkhabad", TMT}, + {"Asia/Baghdad", ARAST}, + {"Asia/Bahrain", ARAST}, + {"Asia/Baku", new String[] {"Fuso hor\u00e1rio do Azerbaij\u00e3o", "AZT", + "Fuso hor\u00e1rio de ver\u00e3o do Azerbaij\u00e3o", "AZST"}}, + {"Asia/Bangkok", ICT}, + {"Asia/Beirut", EET}, + {"Asia/Bishkek", new String[] {"Fuso hor\u00e1rio do Quirguist\u00e3o", "KGT", + "Fuso hor\u00e1rio de ver\u00e3o do Quirguist\u00e3o", "KGST"}}, + {"Asia/Brunei", new String[] {"Fuso hor\u00e1rio de Brunei", "BNT", + "Fuso hor\u00e1rio de ver\u00e3o de Brunei", "BNST"}}, + {"Asia/Calcutta", IST}, + {"Asia/Choibalsan", new String[] {"Fuso hor\u00e1rio de Choibalsan", "CHOT", + "Fuso hor\u00e1rio de ver\u00e3o de Choibalsan", "CHOST"}}, + {"Asia/Chongqing", CTT}, + {"Asia/Chungking", CTT}, + {"Asia/Colombo", IST}, + {"Asia/Dacca", BDT}, + {"Asia/Dhaka", BDT}, + {"Asia/Dili", new String[] {"Fuso hor\u00e1rio do Timor-Leste", "TLT", + "Fuso hor\u00e1rio de ver\u00e3o do Timor-Leste", "TLST"}}, + {"Asia/Damascus", EET}, + {"Asia/Dubai", GST}, + {"Asia/Dushanbe", new String[] {"Fuso hor\u00e1rio do Tadjiquist\u00e3o", "TJT", + "Fuso hor\u00e1rio de ver\u00e3o do Tadjiquist\u00e3o", "TJST"}}, + {"Asia/Gaza", EET}, + {"Asia/Harbin", CTT}, + {"Asia/Ho_Chi_Minh", ICT}, + {"Asia/Hong_Kong", HKT}, + {"Asia/Hovd", new String[] {"Fuso hor\u00e1rio de Hovd", "HOVT", + "Fuso hor\u00e1rio de ver\u00e3o de Hovd", "HOVST"}}, + {"Asia/Irkutsk", new String[] {"Fuso hor\u00e1rio de Irkutsk", "IRKT", + "Fuso hor\u00e1rio de ver\u00e3o de Irkutsk", "IRKST"}}, + {"Asia/Istanbul", EET}, + {"Asia/Jakarta", WIT}, + {"Asia/Jayapura", new String[] {"Fuso hor\u00e1rio da Indon\u00e9sia Oriental", "EIT", + "Fuso hor\u00e1rio de ver\u00e3o da Indon\u00e9sia Oriental", "EIST"}}, + {"Asia/Kabul", new String[] {"Fuso hor\u00e1rio do Afeganist\u00e3o", "AFT", + "Fuso hor\u00e1rio de ver\u00e3o do Afeganist\u00e3o", "AFST"}}, + {"Asia/Kamchatka", new String[] {"Fuso hor\u00e1rio de Petropavlovsk-Kamchatski", "PETT", + "Fuso hor\u00e1rio de ver\u00e3o de Petropavlovsk-Kamchatski", "PETST"}}, + {"Asia/Karachi", PKT}, + {"Asia/Kashgar", CTT}, + {"Asia/Kathmandu", NPT}, + {"Asia/Katmandu", NPT}, + {"Asia/Kolkata", IST}, + {"Asia/Krasnoyarsk", new String[] {"Fuso hor\u00e1rio de Krasnoyarsk", "KRAT", + "Fuso hor\u00e1rio de ver\u00e3o de Krasnoyarsk", "KRAST"}}, + {"Asia/Kuala_Lumpur", MYT}, + {"Asia/Kuching", MYT}, + {"Asia/Kuwait", ARAST}, + {"Asia/Macao", CTT}, + {"Asia/Macau", CTT}, + {"Asia/Magadan", new String[] {"Fuso hor\u00e1rio de Magadan", "MAGT", + "Fuso hor\u00e1rio de ver\u00e3o de Magadan", "MAGST"}}, + {"Asia/Makassar", CIT}, + {"Asia/Manila", new String[] {"Fuso hor\u00e1rio das Filipinas", "PHT", + "Fuso hor\u00e1rio de ver\u00e3o das Filipinas", "PHST"}}, + {"Asia/Muscat", GST}, + {"Asia/Nicosia", EET}, + {"Asia/Novokuznetsk", NOVT}, + {"Asia/Novosibirsk", NOVT}, + {"Asia/Oral", new String[] {"Fuso hor\u00e1rio de Uralsk", "ORAT", + "Fuso hor\u00e1rio de ver\u00e3o de Uralsk", "ORAST"}}, + {"Asia/Omsk", new String[] {"Fuso hor\u00e1rio de Omsk", "OMST", + "Fuso hor\u00e1rio de ver\u00e3o de Omsk", "OMSST"}}, + {"Asia/Phnom_Penh", ICT}, + {"Asia/Pontianak", WIT}, + {"Asia/Pyongyang", KST}, + {"Asia/Qatar", ARAST}, + {"Asia/Qyzylorda", new String[] {"Fuso hor\u00e1rio de Kizil-Orda", "QYZT", + "Fuso hor\u00e1rio de ver\u00e3o de Kizil-Orda", "QYZST"}}, + {"Asia/Rangoon", new String[] {"Fuso hor\u00e1rio de Mianmar", "MMT", + "Fuso hor\u00e1rio de ver\u00e3o de Mianmar", "MMST"}}, + {"Asia/Riyadh", ARAST}, + {"Asia/Saigon", ICT}, + {"Asia/Sakhalin", new String[] {"Fuso hor\u00e1rio de Sakhalina", "SAKT", + "Fuso hor\u00e1rio de ver\u00e3o de Sakhalina", "SAKST"}}, + {"Asia/Samarkand", UZT}, + {"Asia/Seoul", KST}, + {"Asia/Singapore", SGT}, + {"Asia/Taipei", CTT}, + {"Asia/Tel_Aviv", ISRAEL}, + {"Asia/Tashkent", UZT}, + {"Asia/Tbilisi", new String[] {"Fuso hor\u00e1rio da Ge\u00f3rgia", "GET", + "Fuso hor\u00e1rio de ver\u00e3o da Ge\u00f3rgia", "GEST"}}, + {"Asia/Tehran", IRT}, + {"Asia/Thimbu", BTT}, + {"Asia/Thimphu", BTT}, + {"Asia/Ujung_Pandang", CIT}, + {"Asia/Ulaanbaatar", ULAT}, + {"Asia/Ulan_Bator", ULAT}, + {"Asia/Urumqi", CTT}, + {"Asia/Vientiane", ICT}, + {"Asia/Vladivostok", new String[] {"Fuso hor\u00e1rio de Vladivostok", "VLAT", + "Fuso hor\u00e1rio de ver\u00e3o de Vladivostok", "VLAST"}}, + {"Asia/Yakutsk", new String[] {"Fuso hor\u00e1rio de Yakutsk", "YAKT", + "Fuso hor\u00e1rio de ver\u00e3o de Yakutsk", "YAKST"}}, + {"Asia/Yekaterinburg", new String[] {"Fuso hor\u00e1rio de Yekaterinburgo", "YEKT", + "Fuso hor\u00e1rio de ver\u00e3o de Yekaterinburgo", "YEKST"}}, + {"Asia/Yerevan", ARMT}, + {"Atlantic/Azores", new String[] {"Fuso hor\u00e1rio das A\u00e7ores", "AZOT", + "Fuso hor\u00e1rio de ver\u00e3o das A\u00e7ores", "AZOST"}}, + {"Atlantic/Bermuda", AST}, + {"Atlantic/Canary", WET}, + {"Atlantic/Cape_Verde", new String[] {"Fuso hor\u00e1rio de Cabo Verde", "CVT", + "Fuso hor\u00e1rio de ver\u00e3o de Cabo Verde", "CVST"}}, + {"Atlantic/Faeroe", WET}, + {"Atlantic/Faroe", WET}, + {"Atlantic/Jan_Mayen", CET}, + {"Atlantic/Madeira", WET}, + {"Atlantic/Reykjavik", GMT}, + {"Atlantic/South_Georgia", new String[] {"Fuso hor\u00e1rio padr\u00e3o da Ge\u00f3rgia do Sul", "GST", + "Hor\u00e1rio de luz natural da Ge\u00f3rgia do Sul", "GDT"}}, + {"Atlantic/St_Helena", GMT}, + {"Atlantic/Stanley", new String[] {"Fuso hor\u00e1rio das Ilhas Falkland", "FKT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Falkland", "FKST"}}, + {"Australia/ACT", EST_NSW}, + {"Australia/Adelaide", ADELAIDE}, + {"Australia/Brisbane", BRISBANE}, + {"Australia/Broken_Hill", BROKEN_HILL}, + {"Australia/Canberra", EST_NSW}, + {"Australia/Currie", EST_NSW}, + {"Australia/Darwin", DARWIN}, + {"Australia/Eucla", new String[] {"Fuso hor\u00e1rio ocidental central (Austr\u00e1lia)", "CWST", + "Fuso hor\u00e1rio de ver\u00e3o ocidental central (Austr\u00e1lia)", "CWST"}}, + {"Australia/Hobart", TASMANIA}, + {"Australia/LHI", LORD_HOWE}, + {"Australia/Lindeman", BRISBANE}, + {"Australia/Lord_Howe", LORD_HOWE}, + {"Australia/Melbourne", VICTORIA}, + {"Australia/North", DARWIN}, + {"Australia/NSW", EST_NSW}, + {"Australia/Perth", WST_AUS}, + {"Australia/Queensland", BRISBANE}, + {"Australia/South", ADELAIDE}, + {"Australia/Sydney", EST_NSW}, + {"Australia/Tasmania", TASMANIA}, + {"Australia/Victoria", VICTORIA}, + {"Australia/West", WST_AUS}, + {"Australia/Yancowinna", BROKEN_HILL}, + {"BET", BRT}, + {"BST", BDT}, + {"Brazil/Acre", AMT}, + {"Brazil/DeNoronha", NORONHA}, + {"Brazil/East", BRT}, + {"Brazil/West", AMT}, + {"Canada/Atlantic", AST}, + {"Canada/Central", CST}, + {"Canada/East-Saskatchewan", CST}, + {"Canada/Eastern", EST}, + {"Canada/Mountain", MST}, + {"Canada/Newfoundland", NST}, + {"Canada/Pacific", PST}, + {"Canada/Yukon", PST}, + {"Canada/Saskatchewan", CST}, + {"CAT", CAT}, + {"CET", CET}, + {"Chile/Continental", CLT}, + {"Chile/EasterIsland", EASTER}, + {"CST6CDT", CST}, + {"Cuba", CUBA}, + {"EAT", EAT}, + {"EET", EET}, + {"Egypt", EET}, + {"Eire", DUBLIN}, + {"EST5EDT", EST}, + {"Etc/Greenwich", GMT}, + {"Etc/UCT", UTC}, + {"Etc/Universal", UTC}, + {"Etc/UTC", UTC}, + {"Etc/Zulu", UTC}, + {"Europe/Amsterdam", CET}, + {"Europe/Andorra", CET}, + {"Europe/Athens", EET}, + {"Europe/Belfast", GMTBST}, + {"Europe/Belgrade", CET}, + {"Europe/Berlin", CET}, + {"Europe/Bratislava", CET}, + {"Europe/Brussels", CET}, + {"Europe/Budapest", CET}, + {"Europe/Chisinau", EET}, + {"Europe/Copenhagen", CET}, + {"Europe/Dublin", DUBLIN}, + {"Europe/Gibraltar", CET}, {"Europe/Guernsey", GMTBST}, - {"Europe/Helsinki", EET}, + {"Europe/Helsinki", EET}, {"Europe/Isle_of_Man", GMTBST}, - {"Europe/Istanbul", EET}, + {"Europe/Istanbul", EET}, {"Europe/Jersey", GMTBST}, - {"Europe/Kaliningrad", EET}, - {"Europe/Kiev", EET}, - {"Europe/Lisbon", WET}, - {"Europe/Ljubljana", CET}, - {"Europe/London", GMTBST}, - {"Europe/Luxembourg", CET}, - {"Europe/Madrid", CET}, - {"Europe/Malta", CET}, - {"Europe/Mariehamn", EET}, - {"Europe/Minsk", EET}, - {"Europe/Monaco", CET}, - {"Europe/Moscow", MSK}, - {"Europe/Nicosia", EET}, - {"Europe/Oslo", CET}, - {"Europe/Podgorica", CET}, - {"Europe/Prague", CET}, - {"Europe/Riga", EET}, - {"Europe/Rome", CET}, - {"Europe/Samara", new String[] {"Fuso hor\u00e1rio de Samara", "SAMT", - "Fuso hor\u00e1rio de ver\u00e3o de Samara", "SAMST"}}, - {"Europe/San_Marino", CET}, - {"Europe/Sarajevo", CET}, - {"Europe/Simferopol", EET}, - {"Europe/Skopje", CET}, - {"Europe/Sofia", EET}, - {"Europe/Stockholm", CET}, - {"Europe/Tallinn", EET}, - {"Europe/Tirane", CET}, - {"Europe/Tiraspol", EET}, - {"Europe/Uzhgorod", EET}, - {"Europe/Vaduz", CET}, - {"Europe/Vatican", CET}, - {"Europe/Vienna", CET}, - {"Europe/Vilnius", EET}, + {"Europe/Kaliningrad", EET}, + {"Europe/Kiev", EET}, + {"Europe/Lisbon", WET}, + {"Europe/Ljubljana", CET}, + {"Europe/London", GMTBST}, + {"Europe/Luxembourg", CET}, + {"Europe/Madrid", CET}, + {"Europe/Malta", CET}, + {"Europe/Mariehamn", EET}, + {"Europe/Minsk", EET}, + {"Europe/Monaco", CET}, + {"Europe/Moscow", MSK}, + {"Europe/Nicosia", EET}, + {"Europe/Oslo", CET}, + {"Europe/Podgorica", CET}, + {"Europe/Prague", CET}, + {"Europe/Riga", EET}, + {"Europe/Rome", CET}, + {"Europe/Samara", new String[] {"Fuso hor\u00e1rio de Samara", "SAMT", + "Fuso hor\u00e1rio de ver\u00e3o de Samara", "SAMST"}}, + {"Europe/San_Marino", CET}, + {"Europe/Sarajevo", CET}, + {"Europe/Simferopol", EET}, + {"Europe/Skopje", CET}, + {"Europe/Sofia", EET}, + {"Europe/Stockholm", CET}, + {"Europe/Tallinn", EET}, + {"Europe/Tirane", CET}, + {"Europe/Tiraspol", EET}, + {"Europe/Uzhgorod", EET}, + {"Europe/Vaduz", CET}, + {"Europe/Vatican", CET}, + {"Europe/Vienna", CET}, + {"Europe/Vilnius", EET}, {"Europe/Volgograd", new String[] {"Fuso hor\u00e1rio de Volgogrado", "VOLT", "Fuso hor\u00e1rio de ver\u00e3o de Volgogrado", "VOLST"}}, - {"Europe/Warsaw", CET}, - {"Europe/Zagreb", CET}, - {"Europe/Zaporozhye", EET}, - {"Europe/Zurich", CET}, - {"GB", GMTBST}, - {"GB-Eire", GMTBST}, - {"Greenwich", GMT}, - {"Hongkong", HKT}, - {"Iceland", GMT}, - {"Iran", IRT}, - {"IST", IST}, - {"Indian/Antananarivo", EAT}, - {"Indian/Chagos", new String[] {"Fuso hor\u00e1rio dos territ\u00f3rios do Oceano \u00cdndico", "IOT", - "Fuso hor\u00e1rio de ver\u00e3o dos territ\u00f3rios do Oceano \u00cdndico", "IOST"}}, - {"Indian/Christmas", new String[] {"Fuso hor\u00e1rio das Ilhas Christmas", "CXT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Christmas", "CXST"}}, - {"Indian/Cocos", new String[] {"Fuso hor\u00e1rio das Ilhas Cocos", "CCT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Cocos", "CCST"}}, - {"Indian/Comoro", EAT}, - {"Indian/Kerguelen", new String[] {"Fuso hor\u00e1rio das Terras Austrais e Ant\u00e1rticas Francesas", "TFT", - "Fuso hor\u00e1rio de ver\u00e3o das Terras Austrais e Ant\u00e1rticas Francesas", "TFST"}}, - {"Indian/Mahe", new String[] {"Fuso hor\u00e1rio das Seychelles", "SCT", - "Fuso hor\u00e1rio de ver\u00e3o das Seychelles", "SCST"}}, - {"Indian/Maldives", new String[] {"Fuso hor\u00e1rio das Maldivas", "MVT", - "Fuso hor\u00e1rio de ver\u00e3o das Maldivas", "MVST"}}, - {"Indian/Mauritius", new String[] {"Fuso hor\u00e1rio das Ilhas Maur\u00edcio", "MUT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Maur\u00edcio", "MUST"}}, - {"Indian/Mayotte", EAT}, - {"Indian/Reunion", new String[] {"Fuso hor\u00e1rio de Reuni\u00e3o", "RET", - "Fuso hor\u00e1rio de ver\u00e3o de Reuni\u00e3o", "REST"}}, - {"Israel", ISRAEL}, - {"Jamaica", EST}, - {"Japan", JST}, - {"Kwajalein", MHT}, - {"Libya", EET}, - {"MET", new String[] {"Fuso hor\u00e1rio da Europa M\u00e9dia", "MET", - "Fuso hor\u00e1rio de ver\u00e3o da Europa M\u00e9dia", "MEST"}}, - {"Mexico/BajaNorte", PST}, - {"Mexico/BajaSur", MST}, - {"Mexico/General", CST}, - {"MIT", WST_SAMOA}, - {"MST7MDT", MST}, - {"Navajo", MST}, - {"NET", ARMT}, - {"NST", NZST}, - {"NZ", NZST}, - {"NZ-CHAT", CHAST}, - {"PLT", PKT}, - {"Portugal", WET}, - {"PRT", AST}, - {"Pacific/Apia", WST_SAMOA}, - {"Pacific/Auckland", NZST}, - {"Pacific/Chatham", CHAST}, - {"Pacific/Chuuk", TRUT}, - {"Pacific/Easter", EASTER}, - {"Pacific/Efate", new String[] {"Fuso hor\u00e1rio de Vanuatu", "VUT", - "Fuso hor\u00e1rio de ver\u00e3o de Vanuatu", "VUST"}}, - {"Pacific/Enderbury", new String[] {"Fuso hor\u00e1rio das Ilhas F\u00e9nix", "PHOT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas F\u00e9nix", "PHOST"}}, - {"Pacific/Fakaofo", new String[] {"Fuso hor\u00e1rio de Tokelau", "TKT", - "Fuso hor\u00e1rio de ver\u00e3o de Tokelau", "TKST"}}, - {"Pacific/Fiji", new String[] {"Fuso hor\u00e1rio de Fiji", "FJT", - "Fuso hor\u00e1rio de ver\u00e3o de Fiji", "FJST"}}, - {"Pacific/Funafuti", new String[] {"Fuso hor\u00e1rio de Tuvalu", "TVT", - "Fuso hor\u00e1rio de ver\u00e3o de Tuvalu", "TVST"}}, - {"Pacific/Galapagos", new String[] {"Fuso hor\u00e1rio das Ilhas Gal\u00e1pagos", "GALT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Gal\u00e1pagos", "GALST"}}, - {"Pacific/Gambier", GAMBIER}, - {"Pacific/Guadalcanal", SBT}, - {"Pacific/Guam", ChST}, - {"Pacific/Johnston", HST}, - {"Pacific/Kiritimati", new String[] {"Fuso hor\u00e1rio das Esp\u00f3rades Equatoriais", "LINT", - "Fuso hor\u00e1rio de ver\u00e3o das Esp\u00f3rades Equatoriais", "LINST"}}, - {"Pacific/Kosrae", new String[] {"Fuso hor\u00e1rio de Kosrae", "KOST", - "Fuso hor\u00e1rio de ver\u00e3o de Kosrae", "KOSST"}}, - {"Pacific/Kwajalein", MHT}, - {"Pacific/Majuro", MHT}, - {"Pacific/Marquesas", new String[] {"Fuso hor\u00e1rio das Ilhas Marquesas", "MART", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Marquesas", "MARST"}}, - {"Pacific/Midway", SAMOA}, - {"Pacific/Nauru", new String[] {"Fuso hor\u00e1rio de Nauru", "NRT", - "Fuso hor\u00e1rio de ver\u00e3o de Nauru", "NRST"}}, - {"Pacific/Niue", new String[] {"Fuso hor\u00e1rio de Niue", "NUT", - "Fuso hor\u00e1rio de ver\u00e3o de Niue", "NUST"}}, - {"Pacific/Norfolk", new String[] {"Fuso hor\u00e1rio da Ilha de Norfolk", "NFT", - "Fuso hor\u00e1rio de ver\u00e3o da Ilha de Norfolk", "NFST"}}, - {"Pacific/Noumea", new String[] {"Fuso hor\u00e1rio da Nova Caled\u00f4nia", "NCT", - "Fuso hor\u00e1rio de ver\u00e3o da Nova Caled\u00f4nia", "NCST"}}, - {"Pacific/Pago_Pago", SAMOA}, - {"Pacific/Palau", new String[] {"Fuso hor\u00e1rio de Palau", "PWT", - "Fuso hor\u00e1rio de ver\u00e3o de Palau", "PWST"}}, - {"Pacific/Pitcairn", PITCAIRN}, - {"Pacific/Pohnpei", PONT}, - {"Pacific/Ponape", PONT}, - {"Pacific/Port_Moresby", new String[] {"Fuso hor\u00e1rio de Papua-Nova Guin\u00e9", "PGT", - "Fuso hor\u00e1rio de ver\u00e3o de Papua-Nova Guin\u00e9", "PGST"}}, - {"Pacific/Rarotonga", new String[] {"Fuso hor\u00e1rio das Ilhas Cook", "CKT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Cook", "CKHST"}}, - {"Pacific/Saipan", ChST}, - {"Pacific/Samoa", SAMOA}, - {"Pacific/Tahiti", new String[] {"Fuso hor\u00e1rio do Taiti", "TAHT", - "Fuso hor\u00e1rio de ver\u00e3o do Taiti", "TAHST"}}, - {"Pacific/Tarawa", new String[] {"Fuso hor\u00e1rio das Ilhas Gilbert", "GILT", - "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Gilbert", "GILST"}}, - {"Pacific/Tongatapu", new String[] {"Fuso hor\u00e1rio de Tonga", "TOT", - "Fuso hor\u00e1rio de ver\u00e3o de Tonga", "TOST"}}, - {"Pacific/Truk", TRUT}, - {"Pacific/Wake", new String[] {"Fuso hor\u00e1rio de Wake", "WAKT", - "Fuso hor\u00e1rio de ver\u00e3o de Wake", "WAKST"}}, - {"Pacific/Wallis", new String[] {"Fuso hor\u00e1rio de Wallis e Futuna", "WFT", - "Fuso hor\u00e1rio de ver\u00e3o de Wallis e Futuna", "WFST"}}, - {"Pacific/Yap", TRUT}, - {"Poland", CET}, - {"PRC", CTT}, - {"PST8PDT", PST}, - {"ROK", KST}, - {"Singapore", SGT}, - {"SST", SBT}, - {"SystemV/AST4", AST}, - {"SystemV/AST4ADT", AST}, - {"SystemV/CST6", CST}, - {"SystemV/CST6CDT", CST}, - {"SystemV/EST5", EST}, - {"SystemV/EST5EDT", EST}, - {"SystemV/HST10", HST}, - {"SystemV/MST7", MST}, - {"SystemV/MST7MDT", MST}, - {"SystemV/PST8", PST}, - {"SystemV/PST8PDT", PST}, - {"SystemV/YST9", AKST}, - {"SystemV/YST9YDT", AKST}, - {"Turkey", EET}, - {"UCT", UTC}, - {"Universal", UTC}, - {"US/Alaska", AKST}, - {"US/Aleutian", HAST}, - {"US/Arizona", MST}, - {"US/Central", CST}, - {"US/Eastern", EST}, - {"US/Hawaii", HST}, - {"US/Indiana-Starke", CST}, - {"US/East-Indiana", EST}, - {"US/Michigan", EST}, - {"US/Mountain", MST}, - {"US/Pacific", PST}, - {"US/Pacific-New", PST}, - {"US/Samoa", SAMOA}, - {"UTC", UTC}, - {"VST", ICT}, - {"W-SU", MSK}, - {"WET", WET}, - {"Zulu", UTC}, + {"Europe/Warsaw", CET}, + {"Europe/Zagreb", CET}, + {"Europe/Zaporozhye", EET}, + {"Europe/Zurich", CET}, + {"GB", GMTBST}, + {"GB-Eire", GMTBST}, + {"Greenwich", GMT}, + {"Hongkong", HKT}, + {"Iceland", GMT}, + {"Iran", IRT}, + {"IST", IST}, + {"Indian/Antananarivo", EAT}, + {"Indian/Chagos", new String[] {"Fuso hor\u00e1rio dos territ\u00f3rios do Oceano \u00cdndico", "IOT", + "Fuso hor\u00e1rio de ver\u00e3o dos territ\u00f3rios do Oceano \u00cdndico", "IOST"}}, + {"Indian/Christmas", new String[] {"Fuso hor\u00e1rio das Ilhas Christmas", "CXT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Christmas", "CXST"}}, + {"Indian/Cocos", new String[] {"Fuso hor\u00e1rio das Ilhas Cocos", "CCT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Cocos", "CCST"}}, + {"Indian/Comoro", EAT}, + {"Indian/Kerguelen", new String[] {"Fuso hor\u00e1rio das Terras Austrais e Ant\u00e1rticas Francesas", "TFT", + "Fuso hor\u00e1rio de ver\u00e3o das Terras Austrais e Ant\u00e1rticas Francesas", "TFST"}}, + {"Indian/Mahe", new String[] {"Fuso hor\u00e1rio das Seychelles", "SCT", + "Fuso hor\u00e1rio de ver\u00e3o das Seychelles", "SCST"}}, + {"Indian/Maldives", new String[] {"Fuso hor\u00e1rio das Maldivas", "MVT", + "Fuso hor\u00e1rio de ver\u00e3o das Maldivas", "MVST"}}, + {"Indian/Mauritius", new String[] {"Fuso hor\u00e1rio das Ilhas Maur\u00edcio", "MUT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Maur\u00edcio", "MUST"}}, + {"Indian/Mayotte", EAT}, + {"Indian/Reunion", new String[] {"Fuso hor\u00e1rio de Reuni\u00e3o", "RET", + "Fuso hor\u00e1rio de ver\u00e3o de Reuni\u00e3o", "REST"}}, + {"Israel", ISRAEL}, + {"Jamaica", EST}, + {"Japan", JST}, + {"Kwajalein", MHT}, + {"Libya", EET}, + {"MET", new String[] {"Fuso hor\u00e1rio da Europa M\u00e9dia", "MET", + "Fuso hor\u00e1rio de ver\u00e3o da Europa M\u00e9dia", "MEST"}}, + {"Mexico/BajaNorte", PST}, + {"Mexico/BajaSur", MST}, + {"Mexico/General", CST}, + {"MIT", WST_SAMOA}, + {"MST7MDT", MST}, + {"Navajo", MST}, + {"NET", ARMT}, + {"NST", NZST}, + {"NZ", NZST}, + {"NZ-CHAT", CHAST}, + {"PLT", PKT}, + {"Portugal", WET}, + {"PRT", AST}, + {"Pacific/Apia", WST_SAMOA}, + {"Pacific/Auckland", NZST}, + {"Pacific/Chatham", CHAST}, + {"Pacific/Chuuk", TRUT}, + {"Pacific/Easter", EASTER}, + {"Pacific/Efate", new String[] {"Fuso hor\u00e1rio de Vanuatu", "VUT", + "Fuso hor\u00e1rio de ver\u00e3o de Vanuatu", "VUST"}}, + {"Pacific/Enderbury", new String[] {"Fuso hor\u00e1rio das Ilhas F\u00e9nix", "PHOT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas F\u00e9nix", "PHOST"}}, + {"Pacific/Fakaofo", new String[] {"Fuso hor\u00e1rio de Tokelau", "TKT", + "Fuso hor\u00e1rio de ver\u00e3o de Tokelau", "TKST"}}, + {"Pacific/Fiji", new String[] {"Fuso hor\u00e1rio de Fiji", "FJT", + "Fuso hor\u00e1rio de ver\u00e3o de Fiji", "FJST"}}, + {"Pacific/Funafuti", new String[] {"Fuso hor\u00e1rio de Tuvalu", "TVT", + "Fuso hor\u00e1rio de ver\u00e3o de Tuvalu", "TVST"}}, + {"Pacific/Galapagos", new String[] {"Fuso hor\u00e1rio das Ilhas Gal\u00e1pagos", "GALT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Gal\u00e1pagos", "GALST"}}, + {"Pacific/Gambier", GAMBIER}, + {"Pacific/Guadalcanal", SBT}, + {"Pacific/Guam", ChST}, + {"Pacific/Johnston", HST}, + {"Pacific/Kiritimati", new String[] {"Fuso hor\u00e1rio das Esp\u00f3rades Equatoriais", "LINT", + "Fuso hor\u00e1rio de ver\u00e3o das Esp\u00f3rades Equatoriais", "LINST"}}, + {"Pacific/Kosrae", new String[] {"Fuso hor\u00e1rio de Kosrae", "KOST", + "Fuso hor\u00e1rio de ver\u00e3o de Kosrae", "KOSST"}}, + {"Pacific/Kwajalein", MHT}, + {"Pacific/Majuro", MHT}, + {"Pacific/Marquesas", new String[] {"Fuso hor\u00e1rio das Ilhas Marquesas", "MART", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Marquesas", "MARST"}}, + {"Pacific/Midway", SAMOA}, + {"Pacific/Nauru", new String[] {"Fuso hor\u00e1rio de Nauru", "NRT", + "Fuso hor\u00e1rio de ver\u00e3o de Nauru", "NRST"}}, + {"Pacific/Niue", new String[] {"Fuso hor\u00e1rio de Niue", "NUT", + "Fuso hor\u00e1rio de ver\u00e3o de Niue", "NUST"}}, + {"Pacific/Norfolk", new String[] {"Fuso hor\u00e1rio da Ilha de Norfolk", "NFT", + "Fuso hor\u00e1rio de ver\u00e3o da Ilha de Norfolk", "NFST"}}, + {"Pacific/Noumea", new String[] {"Fuso hor\u00e1rio da Nova Caled\u00f4nia", "NCT", + "Fuso hor\u00e1rio de ver\u00e3o da Nova Caled\u00f4nia", "NCST"}}, + {"Pacific/Pago_Pago", SAMOA}, + {"Pacific/Palau", new String[] {"Fuso hor\u00e1rio de Palau", "PWT", + "Fuso hor\u00e1rio de ver\u00e3o de Palau", "PWST"}}, + {"Pacific/Pitcairn", PITCAIRN}, + {"Pacific/Pohnpei", PONT}, + {"Pacific/Ponape", PONT}, + {"Pacific/Port_Moresby", new String[] {"Fuso hor\u00e1rio de Papua-Nova Guin\u00e9", "PGT", + "Fuso hor\u00e1rio de ver\u00e3o de Papua-Nova Guin\u00e9", "PGST"}}, + {"Pacific/Rarotonga", new String[] {"Fuso hor\u00e1rio das Ilhas Cook", "CKT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Cook", "CKHST"}}, + {"Pacific/Saipan", ChST}, + {"Pacific/Samoa", SAMOA}, + {"Pacific/Tahiti", new String[] {"Fuso hor\u00e1rio do Taiti", "TAHT", + "Fuso hor\u00e1rio de ver\u00e3o do Taiti", "TAHST"}}, + {"Pacific/Tarawa", new String[] {"Fuso hor\u00e1rio das Ilhas Gilbert", "GILT", + "Fuso hor\u00e1rio de ver\u00e3o das Ilhas Gilbert", "GILST"}}, + {"Pacific/Tongatapu", new String[] {"Fuso hor\u00e1rio de Tonga", "TOT", + "Fuso hor\u00e1rio de ver\u00e3o de Tonga", "TOST"}}, + {"Pacific/Truk", TRUT}, + {"Pacific/Wake", new String[] {"Fuso hor\u00e1rio de Wake", "WAKT", + "Fuso hor\u00e1rio de ver\u00e3o de Wake", "WAKST"}}, + {"Pacific/Wallis", new String[] {"Fuso hor\u00e1rio de Wallis e Futuna", "WFT", + "Fuso hor\u00e1rio de ver\u00e3o de Wallis e Futuna", "WFST"}}, + {"Pacific/Yap", TRUT}, + {"Poland", CET}, + {"PRC", CTT}, + {"PST8PDT", PST}, + {"ROK", KST}, + {"Singapore", SGT}, + {"SST", SBT}, + {"SystemV/AST4", AST}, + {"SystemV/AST4ADT", AST}, + {"SystemV/CST6", CST}, + {"SystemV/CST6CDT", CST}, + {"SystemV/EST5", EST}, + {"SystemV/EST5EDT", EST}, + {"SystemV/HST10", HST}, + {"SystemV/MST7", MST}, + {"SystemV/MST7MDT", MST}, + {"SystemV/PST8", PST}, + {"SystemV/PST8PDT", PST}, + {"SystemV/YST9", AKST}, + {"SystemV/YST9YDT", AKST}, + {"Turkey", EET}, + {"UCT", UTC}, + {"Universal", UTC}, + {"US/Alaska", AKST}, + {"US/Aleutian", HAST}, + {"US/Arizona", MST}, + {"US/Central", CST}, + {"US/Eastern", EST}, + {"US/Hawaii", HST}, + {"US/Indiana-Starke", CST}, + {"US/East-Indiana", EST}, + {"US/Michigan", EST}, + {"US/Mountain", MST}, + {"US/Pacific", PST}, + {"US/Pacific-New", PST}, + {"US/Samoa", SAMOA}, + {"UTC", UTC}, + {"VST", ICT}, + {"W-SU", MSK}, + {"WET", WET}, + {"Zulu", UTC}, }; } } - - diff --git a/jdk/src/windows/classes/sun/awt/Win32FontManager.java b/jdk/src/windows/classes/sun/awt/Win32FontManager.java index c7315c21eb6..5e925f3ce45 100644 --- a/jdk/src/windows/classes/sun/awt/Win32FontManager.java +++ b/jdk/src/windows/classes/sun/awt/Win32FontManager.java @@ -103,6 +103,14 @@ public class Win32FontManager extends SunFontManager { }); } + /** + * Whether registerFontFile expects absolute or relative + * font file names. + */ + protected boolean useAbsoluteFontFileNames() { + return false; + } + /* Unlike the shared code version, this expects a base file name - * not a full path name. * The font configuration file has base file names and the FontConfiguration diff --git a/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java b/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java index 52746c39fb9..a3a48e2d7b4 100644 --- a/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java +++ b/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java @@ -202,14 +202,6 @@ public class Win32GraphicsEnvironment * ----END DISPLAY CHANGE SUPPORT---- */ - /** - * Whether registerFontFile expects absolute or relative - * font file names. - */ - protected boolean useAbsoluteFontFileNames() { - return false; - } - protected GraphicsDevice makeScreenDevice(int screennum) { GraphicsDevice device = null; if (WindowsFlags.isD3DEnabled()) { diff --git a/jdk/test/java/text/Bidi/Bug6665028.java b/jdk/test/java/text/Bidi/Bug6665028.java index 3089337036b..ffd1044ee18 100644 --- a/jdk/test/java/text/Bidi/Bug6665028.java +++ b/jdk/test/java/text/Bidi/Bug6665028.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. 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 @@ -28,7 +28,7 @@ * that this test case fails without the fix in some different ways, * including timeout, due to the memory corruption. * @build Bug6665028 - * @run main/othervm/timeout=60 -Xmx16m Bug6665028 + * @run main/othervm -Xmx16m Bug6665028 10 */ import java.awt.font.TextAttribute; @@ -36,6 +36,7 @@ import java.text.AttributedString; import java.text.Bidi; // test1() and test2() were derived from BidiEmbeddingTest. +// Usage: java Bug6665028 [duration] public class Bug6665028 { private static boolean runrun = true; @@ -50,6 +51,11 @@ public class Bug6665028 { } public static void main(String[] args) { + int duration = 45; + if (args.length == 1) { + duration = Math.max(1, Math.min(Integer.parseInt(args[0]), 45)); + } + Test[] tests = new Test[4]; for (int i = 0; i < tests.length; i++) { Test t = new Test(); @@ -58,7 +64,7 @@ public class Bug6665028 { } try { - Thread.sleep(45000); + Thread.sleep(duration * 1000); } catch (InterruptedException e) { } diff --git a/jdk/test/java/util/Locale/Bug4518797.java b/jdk/test/java/util/Locale/Bug4518797.java index fbbb2f5bf00..f25b64fbedb 100644 --- a/jdk/test/java/util/Locale/Bug4518797.java +++ b/jdk/test/java/util/Locale/Bug4518797.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. 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 @@ -24,17 +24,22 @@ * @test * @bug 4518797 * @summary Make sure that hashCode() and read/writeObject() are thread-safe. - * @run main/timeout=200 Bug4518797 + * @run main Bug4518797 10 */ import java.util.*; import java.io.*; +// Usage: java Bug4518797 [duration] public class Bug4518797 { static volatile boolean runrun = true; static volatile String message = null; public static void main(String[] args) { + int duration = 180; + if (args.length == 1) { + duration = Math.max(5, Integer.parseInt(args[0])); + } final Locale loc = new Locale("ja", "US"); final int hashcode = loc.hashCode(); @@ -84,7 +89,7 @@ public class Bug4518797 { t1.start(); t2.start(); try { - for (int i = 0; runrun && i < 180; i++) { + for (int i = 0; runrun && i < duration; i++) { Thread.sleep(1000); } runrun = false; diff --git a/jdk/test/java/util/Locale/LocaleEnhanceTest.java b/jdk/test/java/util/Locale/LocaleEnhanceTest.java index d2d997b78b6..5cbcf2c9dc5 100644 --- a/jdk/test/java/util/Locale/LocaleEnhanceTest.java +++ b/jdk/test/java/util/Locale/LocaleEnhanceTest.java @@ -33,8 +33,10 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.URISyntaxException; import java.net.URL; +import java.text.DecimalFormatSymbols; import java.util.ArrayList; import java.util.Arrays; +import java.util.Calendar; import java.util.IllformedLocaleException; import java.util.List; import java.util.Locale; @@ -43,8 +45,10 @@ import java.util.Set; /** * @test - * @bug 6875847 6992272 7002320 7015500 7023613 + * @bug 6875847 6992272 7002320 7015500 7023613 7032820 7033504 * @summary test API changes to Locale + * @compile LocaleEnhanceTest.java + * @run main/othervm -esa LocaleEnhanceTest */ public class LocaleEnhanceTest extends LocaleTestFmwk { @@ -593,6 +597,9 @@ public class LocaleEnhanceTest extends LocaleTestFmwk { assertEquals("extension", "aa-00-bb-01", locale.getExtension('d')); assertEquals("extension c", "1234", locale.getExtension('c')); + locale = Locale.forLanguageTag("und-U-ca-gregory-u-ca-japanese"); + assertEquals("Unicode extension", "ca-gregory", locale.getExtension(Locale.UNICODE_LOCALE_EXTENSION)); + // redundant Unicode locale keys in an extension are ignored locale = Locale.forLanguageTag("und-u-aa-000-bb-001-bB-002-cc-003-c-1234"); assertEquals("Unicode keywords", "aa-000-bb-001-cc-003", locale.getExtension(Locale.UNICODE_LOCALE_EXTENSION)); @@ -1275,6 +1282,35 @@ public class LocaleEnhanceTest extends LocaleTestFmwk { } } + /* + * 7033504: (lc) incompatible behavior change for ja_JP_JP and th_TH_TH locales + */ + public void testBug7033504() { + checkCalendar(new Locale("ja", "JP", "jp"), "java.util.GregorianCalendar"); + checkCalendar(new Locale("ja", "jp", "jp"), "java.util.GregorianCalendar"); + checkCalendar(new Locale("ja", "JP", "JP"), "java.util.JapaneseImperialCalendar"); + checkCalendar(new Locale("ja", "jp", "JP"), "java.util.JapaneseImperialCalendar"); + checkCalendar(Locale.forLanguageTag("en-u-ca-japanese"), + "java.util.JapaneseImperialCalendar"); + + checkDigit(new Locale("th", "TH", "th"), '0'); + checkDigit(new Locale("th", "th", "th"), '0'); + checkDigit(new Locale("th", "TH", "TH"), '\u0e50'); + checkDigit(new Locale("th", "TH", "TH"), '\u0e50'); + checkDigit(Locale.forLanguageTag("en-u-nu-thai"), '\u0e50'); + } + + private void checkCalendar(Locale loc, String expected) { + Calendar cal = Calendar.getInstance(loc); + assertEquals("Wrong calendar", expected, cal.getClass().getName()); + } + + private void checkDigit(Locale loc, Character expected) { + DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(loc); + Character zero = dfs.getZeroDigit(); + assertEquals("Wrong digit zero char", expected, zero); + } + /// /// utility asserts /// diff --git a/jdk/test/java/util/ResourceBundle/Control/StressTest.java b/jdk/test/java/util/ResourceBundle/Control/StressTest.java index d37c60a62ec..401f6b43091 100644 --- a/jdk/test/java/util/ResourceBundle/Control/StressTest.java +++ b/jdk/test/java/util/ResourceBundle/Control/StressTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. 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 @@ -24,12 +24,13 @@ * @test * @bug 5102289 * @summary Stress test for ResourceBundle.getBundle with ResourceBundle.Control. - * @run main/timeout=300/othervm -esa StressTest + * @run main/othervm -esa StressTest 2 15 */ import java.util.*; import java.util.concurrent.atomic.*; +// Usage: java StressTest [threadsFactor [duration]] public class StressTest { static final Locale ROOT_LOCALE = new Locale(""); static final Random rand = new Random(); @@ -60,16 +61,16 @@ public class StressTest { static volatile boolean runrun = true; public static void main(String[] args) { - int nThreads = 2; + int threadsFactor = 2; if (args.length > 0) { - nThreads = Math.max(Integer.parseInt(args[0]), 2); + threadsFactor = Math.max(2, Integer.parseInt(args[0])); } - int nSeconds = 180; + int duration = 180; if (args.length > 1) { - nSeconds = Integer.parseInt(args[1]); + duration = Math.max(5, Integer.parseInt(args[1])); } Locale.setDefault(Locale.US); - Thread[] tasks = new Thread[locales.length * nThreads]; + Thread[] tasks = new Thread[locales.length * threadsFactor]; counters = new AtomicIntegerArray(tasks.length); for (int i = 0; i < tasks.length; i++) { @@ -84,8 +85,8 @@ public class StressTest { System.out.printf("%d processors, intervalForCounterCheck = %d [sec]%n", nProcessors, intervalForCounterCheck); try { - for (int i = 0; runrun && i < nSeconds; i++) { - Thread.sleep(1000); // 1 seconds + for (int i = 0; runrun && i < duration; i++) { + Thread.sleep(1000); // 1 second if ((i % intervalForCounterCheck) == 0) { checkCounters(); } diff --git a/jdk/test/javax/swing/JComponent/6989617/bug6989617.java b/jdk/test/javax/swing/JComponent/6989617/bug6989617.java index 7c85e255f72..23f3754b78a 100644 --- a/jdk/test/javax/swing/JComponent/6989617/bug6989617.java +++ b/jdk/test/javax/swing/JComponent/6989617/bug6989617.java @@ -59,9 +59,7 @@ public class bug6989617 { toolkit.realSync(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { - if (panel.getPaintRectangle() != null) { - throw new RuntimeException("paint rectangle is not null"); - } + panel.resetPaintRectangle(); button.repaint(); } }); diff --git a/jdk/test/javax/swing/JLabel/6596966/bug6596966.java b/jdk/test/javax/swing/JLabel/6596966/bug6596966.java new file mode 100644 index 00000000000..5cf0110f700 --- /dev/null +++ b/jdk/test/javax/swing/JLabel/6596966/bug6596966.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + @bug 6596966 + @summary Some JFileChooser mnemonics do not work with sticky keys + * @library ../../regtesthelpers + * @build Util + @run main bug6596966 + @author Pavel Porvatov +*/ + + +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; + +public class bug6596966 { + private static JFrame frame; + + private static JLabel label; + private static JButton button; + private static JComboBox comboBox; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + button = new JButton("Button"); + comboBox = new JComboBox(); + + label = new JLabel("Label"); + label.setDisplayedMnemonic('L'); + label.setLabelFor(comboBox); + + JPanel pnContent = new JPanel(); + + pnContent.add(button); + pnContent.add(label); + pnContent.add(comboBox); + + frame = new JFrame(); + + frame.add(pnContent); + frame.pack(); + frame.setVisible(true); + } + }); + + Util.blockTillDisplayed(frame); + + robot.keyPress(KeyEvent.VK_ALT); + robot.keyPress(KeyEvent.VK_L); + + robot.waitForIdle(); + + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new KeyEvent(label, KeyEvent.KEY_RELEASED, + EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_L, 'L')); + + robot.waitForIdle(); + + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + if (!comboBox.isFocusOwner()) { + throw new RuntimeException("comboBox isn't focus owner"); + } + } + }); + } finally { + robot.keyRelease(KeyEvent.VK_ALT); + } + } +} diff --git a/jdk/test/javax/swing/JLabel/7004134/bug7004134.java b/jdk/test/javax/swing/JLabel/7004134/bug7004134.java index 2768263e458..63464b2738a 100644 --- a/jdk/test/javax/swing/JLabel/7004134/bug7004134.java +++ b/jdk/test/javax/swing/JLabel/7004134/bug7004134.java @@ -52,7 +52,13 @@ public class bug7004134 { frame.add(label); frame.pack(); frame.setVisible(true); + } + }); + ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { ToolTipManager toolTipManager = ToolTipManager.sharedInstance(); toolTipManager.setInitialDelay(0); @@ -83,7 +89,13 @@ public class bug7004134 { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); + } + }); + ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { ToolTipManager toolTipManager = ToolTipManager.sharedInstance(); toolTipManager.setInitialDelay(0); diff --git a/jdk/test/javax/swing/JMenuItem/7036148/bug7036148.java b/jdk/test/javax/swing/JMenuItem/7036148/bug7036148.java new file mode 100644 index 00000000000..32199de8ecb --- /dev/null +++ b/jdk/test/javax/swing/JMenuItem/7036148/bug7036148.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + /* + * @test + * @bug 7036148 + * @summary NullPointerException with null JMenu name + * @author Alexander Potochkin + * @run main bug7036148 + */ + + +import javax.swing.*; +import java.awt.event.ActionEvent; + +public class bug7036148 extends JFrame { + public bug7036148() { + JMenuBar bar = new JMenuBar(); + Action menuAction = new AbstractAction(null, null){ + public void actionPerformed(ActionEvent e) { + } + }; + JMenu menu = new JMenu(menuAction); + menu.add(new JMenuItem("test")); + bar.add(menu); + setJMenuBar(bar); + pack(); + } + + public static void main(String[] args) { + new bug7036148(); + } +} diff --git a/jdk/test/javax/swing/border/Test7034614.java b/jdk/test/javax/swing/border/Test7034614.java new file mode 100644 index 00000000000..bb256a7d517 --- /dev/null +++ b/jdk/test/javax/swing/border/Test7034614.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7034614 + * @summary Tests that TitledBorder does not modify Insets + * @author Sergey Malenkov + */ + +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.image.BufferedImage; +import javax.swing.border.Border; +import javax.swing.border.TitledBorder; + +public class Test7034614 { + + public static void main(String[] args) { + Graphics g = new BufferedImage(9, 9, 9).getGraphics(); + + BrokenBorder broken = new BrokenBorder(); + TitledBorder titled = new TitledBorder(broken, broken.getClass().getName()); + + Insets insets = (Insets) broken.getBorderInsets(broken).clone(); + titled.getBorderInsets(broken); + broken.validate(insets); + for (int i = 0; i < 10; i++) { + titled.paintBorder(broken, g, 0, 0, i, i); + broken.validate(insets); + titled.getBaseline(broken, i, i); + broken.validate(insets); + } + } + + private static class BrokenBorder extends Component implements Border { + private Insets insets = new Insets(1, 2, 3, 4); + + private void validate(Insets insets) { + if (!this.insets.equals(insets)) { + throw new Error("unexpected change"); + } + } + + public Insets getBorderInsets(Component c) { + return this.insets; + } + + public boolean isBorderOpaque() { + return false; + } + + public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { + } + } +} diff --git a/jdk/test/javax/swing/plaf/synth/7032791/bug7032791.java b/jdk/test/javax/swing/plaf/synth/7032791/bug7032791.java new file mode 100644 index 00000000000..f956a316388 --- /dev/null +++ b/jdk/test/javax/swing/plaf/synth/7032791/bug7032791.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 7032791 + * @author Alexander Potochkin + * @summary TableCellRenderer.getTableCellRendererComponent() doesn't accept null JTable with GTK+ L&F + */ + +import javax.swing.*; +import javax.swing.plaf.synth.SynthLookAndFeel; +import javax.swing.table.TableCellRenderer; + +public class bug7032791 { + + public static void main(String[] args) throws Exception { + + UIManager.setLookAndFeel(new SynthLookAndFeel()); + + Object value = "Test value"; + JTable table = new JTable(1, 1); + TableCellRenderer renderer = table.getDefaultRenderer(Object.class); + renderer.getTableCellRendererComponent(null, value, true, true, 0, 0); + System.out.println("OK"); + } +} + diff --git a/jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java b/jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java index 1ff87aad4d1..b59ba9fd9bb 100644 --- a/jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java +++ b/jdk/test/javax/swing/text/CSSBorder/6796710/bug6796710.java @@ -31,6 +31,8 @@ @run main bug6796710 */ +import sun.awt.SunToolkit; + import javax.swing.*; import java.awt.*; import java.awt.image.BufferedImage; @@ -91,7 +93,7 @@ public class bug6796710 { } }); - robot.waitForIdle(); + ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync(); BufferedImage bufferedImage = getPnBottomImage(); @@ -101,7 +103,10 @@ public class bug6796710 { } }); - robot.waitForIdle(); + ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync(); + + // On Linux platforms realSync doesn't guaranties setSize completion + Thread.sleep(1000); if (!Util.compareBufferedImages(bufferedImage, getPnBottomImage())) { throw new RuntimeException("The test failed"); diff --git a/jdk/test/javax/swing/text/GlyphView/6539700/bug6539700.java b/jdk/test/javax/swing/text/GlyphView/6539700/bug6539700.java deleted file mode 100644 index 4f26b65374c..00000000000 --- a/jdk/test/javax/swing/text/GlyphView/6539700/bug6539700.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6539700 - * @summary test that the long space-less lines are correctly soft-wrapped - * @author Sergey Groznyh - * @run main bug6539700 - */ - -import javax.swing.JEditorPane; -import javax.swing.JFrame; -import javax.swing.SwingUtilities; -import javax.swing.text.ParagraphView; -import javax.swing.text.View; - -public class bug6539700 { - static JFrame f; - static JEditorPane ep; - static String text = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + - "AAAAAAAAAAAAAA"; - static int size = 100; - static Class rowClass = null; - - static void createContentPane() { - ep = new JEditorPane(); - ep.setContentType("text/html"); - ep.setEditable(false); - ep.setText(text); - f = new JFrame(); - f.setSize(size, 2 * size); - f.add(ep); - f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - f.setVisible(true); - } - - static void checkRows(View v, boolean last) { - int width = (int) v.getPreferredSpan(View.X_AXIS); - - if (v.getClass() == rowClass) { - // Row width shouldn't exceed the container width - if (width > size) { - throw new RuntimeException("too long row: " + width); - } - - // Row shouldn't be too short (except for the last one) - if (!last) { - if (width < size * 2 / 3) { - throw new RuntimeException("too short row: " + width); - } - } - } - - int n = v.getViewCount(); - if (n > 0) { - for (int i = 0; i < n; i++) { - View c = v.getView(i); - checkRows(c, i == n - 1); - } - } - } - - public static void main(String[] argv) { - try { - SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - createContentPane(); - } - }); - } catch (Exception ex) { - throw new RuntimeException(ex); - } - - Class[] pvchildren = ParagraphView.class.getDeclaredClasses(); - for (Class c : pvchildren) { - if (c.getName().equals("javax.swing.text.ParagraphView$Row")) { - rowClass = c; - break; - } - } - if (rowClass == null) { - throw new RuntimeException("can't find ParagraphView.Row class"); - } - - SwingUtilities.invokeLater(new Runnable() { - public void run() { - checkRows(ep.getUI().getRootView(ep), true); - } - }); - - System.out.println("OK"); - } -} diff --git a/jdk/test/javax/swing/text/html/parser/Parser/7003777/bug7003777.java b/jdk/test/javax/swing/text/html/parser/Parser/7003777/bug7003777.java new file mode 100644 index 00000000000..93b6b56facf --- /dev/null +++ b/jdk/test/javax/swing/text/html/parser/Parser/7003777/bug7003777.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2010, Oracle and/or its affiliates. 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + @bug 7003777 + @summary Nonexistent html entities not parsed properly. + @author Pavel Porvatov +*/ + +import javax.swing.*; +import javax.swing.text.BadLocationException; + +public class bug7003777 { + private static final String[] TEST_STRINGS = { + "&a", + "&aa", + "&a;", + "&aa;", + }; + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + JTextPane pane = new JTextPane(); + + pane.setContentType("text/html"); + + for (String testString : TEST_STRINGS) { + pane.setText(testString); + + String parsedText; + + try { + parsedText = pane.getDocument().getText(0, pane.getDocument().getLength()); + } catch (BadLocationException e) { + throw new RuntimeException("The test failed.", e); + } + + if (parsedText.charAt(0) != '\n') { + throw new RuntimeException("The first char should be \\n"); + } + + parsedText = parsedText.substring(1); + + if (!testString.equals(parsedText)) { + throw new RuntimeException("The '" + testString + + "' string wasn't parsed correctly. Parsed value is '" + parsedText + "'"); + } + } + } + }); + } +}