8028197: tools/launcher/DiacriticTest.java failed on MacOSX: Input length = 1
authorkizune
Mon, 18 Nov 2013 20:22:49 +0400
changeset 21804 07b686da11c4
parent 21803 791d8485f6ed
child 21805 c7d7946239de
8028197: tools/launcher/DiacriticTest.java failed on MacOSX: Input length = 1 Reviewed-by: ksrini
jdk/test/tools/launcher/DiacriticTest.java
--- a/jdk/test/tools/launcher/DiacriticTest.java	Mon Nov 18 16:20:40 2013 +0100
+++ b/jdk/test/tools/launcher/DiacriticTest.java	Mon Nov 18 20:22:49 2013 +0400
@@ -30,6 +30,8 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.InvalidPathException;
+import java.nio.charset.UnmappableCharacterException;
 import java.util.ArrayList;
 import java.util.HashMap;
 
@@ -46,6 +48,13 @@
             return;
         }
 
+        String lang = System.getenv("LANG");
+        if (lang != null && !lang.contains("UTF-8")) {
+            System.out.println("LANG variable set to the language that " +
+                               "does not support unicode, test passes vacuously");
+            return;
+        }
+
         File sourceFile = new File(NAME_NFC + ".java");
         String source = "public class " + NAME_NFC + " { " +
                 "    public static void main(String args[]) {\n" +
@@ -56,7 +65,7 @@
         content.add(source);
         try {
             createFile(sourceFile, content);
-        } catch (java.nio.file.InvalidPathException ipe) {
+        } catch (UnmappableCharacterException | InvalidPathException ipe) {
             System.out.println("The locale or file system is configured in a way " +
                                "that prevents file creation. Real testing impossible.");
             return;