src/jdk/nashorn/internal/objects/DateParser.java

Print this page

        

@@ -30,10 +30,11 @@
 import static java.lang.Character.OTHER_PUNCTUATION;
 import static java.lang.Character.SPACE_SEPARATOR;
 import static java.lang.Character.UPPERCASE_LETTER;
 
 import java.util.HashMap;
+import java.util.Locale;
 
 /**
  * JavaScript date parser. This class first tries to parse a date string
  * according to the extended ISO 8601 format specified in ES5 15.9.1.15.
  * If that fails, it falls back to legacy mode in which it accepts a range

@@ -484,11 +485,11 @@
 
         // first read up to the key length
         while (pos < limit && isAsciiLetter(string.charAt(pos))) {
             pos++;
         }
-        final String key = string.substring(start, pos).toLowerCase();
+        final String key = string.substring(start, pos).toLowerCase(Locale.ENGLISH);
         final Name name = names.get(key);
         // then advance to end of name
         while (pos < length && isAsciiLetter(string.charAt(pos))) {
             pos++;
         }

@@ -681,11 +682,11 @@
         final static int TIMEZONE_ID    = 2;
         final static int TIME_SEPARATOR = 3;
 
         Name(final String name, final int type, final int value) {
             assert name != null;
-            assert name.equals(name.toLowerCase());
+            assert name.equals(name.toLowerCase(Locale.ENGLISH));
 
             this.name = name;
             // use first three characters as lookup key
             this.key = name.substring(0, Math.min(3, name.length()));
             this.type = type;