8060097: sun/net/idn/TestStringPrep.java failed.
authornaoto
Mon, 21 Mar 2016 08:48:34 -0700
changeset 36645 dd51a5761eec
parent 36644 dae617cceb1b
child 36646 de0663d2d82e
child 36895 083dcdaa0c18
8060097: sun/net/idn/TestStringPrep.java failed. Reviewed-by: michaelm
jdk/test/sun/net/idn/TestStringPrep.java
--- a/jdk/test/sun/net/idn/TestStringPrep.java	Mon Mar 21 10:27:50 2016 +0100
+++ b/jdk/test/sun/net/idn/TestStringPrep.java	Mon Mar 21 08:48:34 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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,7 +24,7 @@
 /*
  * @test
  * @summary Unit test for sun.net.idn.Punycode
- * @bug 4737170
+ * @bug 4737170 8060097
  * @modules java.base/sun.net.idn java.base/sun.text.normalizer
  * @library .
  * @compile -XDignore.symbol.file TestStringPrep.java NFS4StringPrep.java
@@ -41,6 +41,7 @@
 
 import java.text.ParseException;
 import java.io.InputStream;
+import java.util.Locale;
 
 import sun.net.idn.StringPrep;
 import sun.text.normalizer.UCharacterIterator;
@@ -209,7 +210,7 @@
             src = "THISISATEST";
             byte[] dest = NFS4StringPrep.cs_prepare(src.getBytes("UTF-8"), false);
             String destStr = new String(dest, "UTF-8");
-            if(!src.toLowerCase().equals(destStr)){
+            if(!src.toLowerCase(Locale.ROOT).equals(destStr)){
                 fail("Did not get expected output. Expected: "+ prettify(src)+
                       " Got: " + prettify(destStr));
             }
@@ -274,7 +275,7 @@
 
     private static String hex(char ch) {
         StringBuffer result = new StringBuffer();
-        String foo = Integer.toString(ch,16).toUpperCase();
+        String foo = Integer.toString(ch,16).toUpperCase(Locale.ROOT);
         for (int i = foo.length(); i < 4; ++i) {
             result.append('0');
         }