changeset 7721:8f7559387f84

8047340: (process) Runtime.exec() fails in Turkish locale Reviewed-by: martin
author coffeys
date Mon, 17 Nov 2014 10:39:54 +0000
parents 3b6300ae4fe5
children bf3af4e1335c
files src/solaris/classes/java/lang/UNIXProcess.java.bsd src/solaris/classes/java/lang/UNIXProcess.java.linux src/solaris/classes/java/lang/UNIXProcess.java.solaris test/java/lang/ProcessBuilder/Basic.java
diffstat 4 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/classes/java/lang/UNIXProcess.java.bsd	Fri Nov 14 18:12:56 2014 +0400
+++ b/src/solaris/classes/java/lang/UNIXProcess.java.bsd	Mon Nov 17 10:39:54 2014 +0000
@@ -35,6 +35,7 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.Arrays;
+import java.util.Locale;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Executor;
 import java.util.concurrent.ThreadFactory;
@@ -99,7 +100,7 @@
                     "jdk.lang.Process.launchMechanism", "posix_spawn");
 
                 try {
-                    return LaunchMechanism.valueOf(s.toUpperCase());
+                    return LaunchMechanism.valueOf(s.toUpperCase(Locale.ENGLISH));
                 } catch (IllegalArgumentException e) {
                     throw new Error(s + " is not a supported " +
                         "process launch mechanism on this platform.");
--- a/src/solaris/classes/java/lang/UNIXProcess.java.linux	Fri Nov 14 18:12:56 2014 +0400
+++ b/src/solaris/classes/java/lang/UNIXProcess.java.linux	Mon Nov 17 10:39:54 2014 +0000
@@ -35,6 +35,7 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.Arrays;
+import java.util.Locale;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Executor;
 import java.util.concurrent.ThreadFactory;
@@ -100,7 +101,7 @@
                     "jdk.lang.Process.launchMechanism", "vfork");
 
                 try {
-                    return LaunchMechanism.valueOf(s.toUpperCase());
+                    return LaunchMechanism.valueOf(s.toUpperCase(Locale.ENGLISH));
                 } catch (IllegalArgumentException e) {
                     throw new Error(s + " is not a supported " +
                         "process launch mechanism on this platform.");
--- a/src/solaris/classes/java/lang/UNIXProcess.java.solaris	Fri Nov 14 18:12:56 2014 +0400
+++ b/src/solaris/classes/java/lang/UNIXProcess.java.solaris	Mon Nov 17 10:39:54 2014 +0000
@@ -26,6 +26,7 @@
 package java.lang;
 
 import java.io.*;
+import java.util.Locale;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
@@ -89,7 +90,7 @@
                     "jdk.lang.Process.launchMechanism", "fork");
 
                 try {
-                    return LaunchMechanism.valueOf(s.toUpperCase());
+                    return LaunchMechanism.valueOf(s.toUpperCase(Locale.ENGLISH));
                 } catch (IllegalArgumentException e) {
                     throw new Error(s + " is not a supported " +
                         "process launch mechanism on this platform.");
--- a/test/java/lang/ProcessBuilder/Basic.java	Fri Nov 14 18:12:56 2014 +0400
+++ b/test/java/lang/ProcessBuilder/Basic.java	Mon Nov 17 10:39:54 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -26,10 +26,11 @@
  * @bug 4199068 4738465 4937983 4930681 4926230 4931433 4932663 4986689
  *      5026830 5023243 5070673 4052517 4811767 6192449 6397034 6413313
  *      6464154 6523983 6206031 4960438 6631352 6631966 6850957 6850958
- *      4947220 7018606 7034570
+ *      4947220 7018606 7034570 8047340
  * @summary Basic tests for Process and Environment Variable code
  * @run main/othervm/timeout=300 Basic
  * @run main/othervm/timeout=300 -Djdk.lang.Process.launchMechanism=fork Basic
+ * @run main/othervm/timeout=300 -DTurkeyTest Basic
  * @author Martin Buchholz
  */
 
@@ -1083,6 +1084,11 @@
     }
 
     private static void realMain(String[] args) throws Throwable {
+        if (System.getProperty("TurkeyTest") != null) {
+            // static initializer test, set this early.
+            System.out.println("Testing with Turkish locale.");
+            Locale.setDefault(new Locale("tr", ""));
+        }
         if (Windows.is())
             System.out.println("This appears to be a Windows system.");
         if (Unix.is())