8015459: Octane test run fails on Turkish locale
authorsundar
Tue, 28 May 2013 16:37:11 +0530
changeset 17778 991ccffbeb13
parent 17777 3f0a680149b9
child 17779 7ae33ea741e7
8015459: Octane test run fails on Turkish locale Reviewed-by: lagergren, attila
nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
nashorn/src/jdk/nashorn/internal/objects/DateParser.java
nashorn/src/jdk/nashorn/internal/parser/TokenType.java
nashorn/src/jdk/nashorn/internal/runtime/GlobalFunctions.java
nashorn/src/jdk/nashorn/internal/runtime/JSType.java
nashorn/src/jdk/nashorn/internal/runtime/Logging.java
nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java
nashorn/src/jdk/nashorn/internal/runtime/options/OptionTemplate.java
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Mon May 27 17:57:07 2013 +0200
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Tue May 28 16:37:11 2013 +0530
@@ -58,6 +58,7 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Locale;
 import java.util.TreeMap;
 
 import jdk.nashorn.internal.codegen.ClassEmitter.Flag;
@@ -2220,7 +2221,7 @@
                 }
                 method.convert(Type.OBJECT);
             } else if (value instanceof Boolean) {
-                method.getField(staticField(Boolean.class, value.toString().toUpperCase(), Boolean.class));
+                method.getField(staticField(Boolean.class, value.toString().toUpperCase(Locale.ENGLISH), Boolean.class));
             } else {
                 load(rhs);
                 method.convert(unaryNode.getType());
--- a/nashorn/src/jdk/nashorn/internal/objects/DateParser.java	Mon May 27 17:57:07 2013 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/DateParser.java	Tue May 28 16:37:11 2013 +0530
@@ -32,6 +32,7 @@
 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
@@ -486,7 +487,7 @@
         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))) {
@@ -683,7 +684,7 @@
 
         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
--- a/nashorn/src/jdk/nashorn/internal/parser/TokenType.java	Mon May 27 17:57:07 2013 +0200
+++ b/nashorn/src/jdk/nashorn/internal/parser/TokenType.java	Tue May 28 16:37:11 2013 +0530
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.parser;
 
+import java.util.Locale;
 import static jdk.nashorn.internal.parser.TokenKind.BINARY;
 import static jdk.nashorn.internal.parser.TokenKind.BRACKET;
 import static jdk.nashorn.internal.parser.TokenKind.FUTURE;
@@ -249,7 +250,7 @@
     }
 
     public String getNameOrType() {
-        return name == null ? super.name().toLowerCase() : name;
+        return name == null ? super.name().toLowerCase(Locale.ENGLISH) : name;
     }
 
     public TokenType getNext() {
--- a/nashorn/src/jdk/nashorn/internal/runtime/GlobalFunctions.java	Mon May 27 17:57:07 2013 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/GlobalFunctions.java	Tue May 28 16:37:11 2013 +0530
@@ -30,6 +30,7 @@
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
+import java.util.Locale;
 
 /**
  * Utilities used by Global class.
@@ -373,10 +374,10 @@
             } else if (ch < 256) {
                 sb.append('%');
                 final byte b = (byte)ch;
-                sb.append(Integer.toHexString(b & 0xFF).toUpperCase());
+                sb.append(Integer.toHexString(b & 0xFF).toUpperCase(Locale.ENGLISH));
             } else {
                 sb.append("%u");
-                sb.append(Integer.toHexString(ch & 0xFFFF).toUpperCase());
+                sb.append(Integer.toHexString(ch & 0xFFFF).toUpperCase(Locale.ENGLISH));
             }
         }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/JSType.java	Mon May 27 17:57:07 2013 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSType.java	Tue May 28 16:37:11 2013 +0530
@@ -28,6 +28,7 @@
 import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 
+import java.util.Locale;
 import jdk.internal.dynalink.beans.StaticClass;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
 import jdk.nashorn.internal.parser.Lexer;
@@ -111,7 +112,7 @@
      */
     public final String typeName() {
         // For NULL, "object" has to be returned!
-        return ((this == NULL) ? OBJECT : this).name().toLowerCase();
+        return ((this == NULL) ? OBJECT : this).name().toLowerCase(Locale.ENGLISH);
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/Logging.java	Mon May 27 17:57:07 2013 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Logging.java	Tue May 28 16:37:11 2013 +0530
@@ -26,6 +26,7 @@
 package jdk.nashorn.internal.runtime;
 
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.logging.ConsoleHandler;
@@ -117,7 +118,7 @@
                 if ("".equals(value)) {
                     level = Level.INFO;
                 } else {
-                    level = Level.parse(value.toUpperCase());
+                    level = Level.parse(value.toUpperCase(Locale.ENGLISH));
                 }
 
                 final String name = Logging.lastPart(key);
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Mon May 27 17:57:07 2013 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Tue May 28 16:37:11 2013 +0530
@@ -36,6 +36,7 @@
 import java.lang.reflect.Array;
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.Locale;
 import java.util.NoSuchElementException;
 import java.util.Objects;
 import jdk.internal.dynalink.beans.StaticClass;
@@ -788,7 +789,7 @@
             return false;
         }
 
-        throw typeError("in.with.non.object", rvalType.toString().toLowerCase());
+        throw typeError("in.with.non.object", rvalType.toString().toLowerCase(Locale.ENGLISH));
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/options/OptionTemplate.java	Mon May 27 17:57:07 2013 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/options/OptionTemplate.java	Tue May 28 16:37:11 2013 +0530
@@ -267,7 +267,7 @@
                     this.params = arg;
                     break;
                 case "type":
-                    this.type = arg.toLowerCase(Locale.ROOT);
+                    this.type = arg.toLowerCase(Locale.ENGLISH);
                     break;
                 case "default":
                     this.defaultValue = arg;