Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8047340

(process) Runtime.exec() fails in Turkish locale

XMLWordPrintable

    • b02
    • x86
    • os_x

        FULL PRODUCT VERSION :
        java version "1.8.0_05"
        Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
        Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Darwin **************************** 13.2.0 Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64

        A DESCRIPTION OF THE PROBLEM :
        Java 8 switched to using posix_spawn by default to launch external processes on OS X (and other BSD-like systems). When java is running on a system with a default locale such as Turkish that uses non-ascii characters, this fails with an exception. The root cause is attempting to convert the lowercase system property to an uppercase enum constant using the default locale (in Turkish, this converts lowercase 'i' to unicode character U+0130) which results in the constant not being found.

        REGRESSION. Last worked in version 7u60

        ADDITIONAL REGRESSION INFORMATION:
        java version "1.8.0_05"
        Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
        Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1. Set the default locale to e.g. Turkish
        2. Use Runtime.exec() to launch an external process


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The call to Runtime.exec() should return normally.
        ACTUAL -
        An exception is thrown.

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        java.lang.Error: posix_spawn is not a supported process launch mechanism on this platform.
        at java.lang.UNIXProcess$1.run(UNIXProcess.java:105)
        at java.lang.UNIXProcess$1.run(UNIXProcess.java:94)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.lang.UNIXProcess.<clinit>(UNIXProcess.java:92)
        at java.lang.ProcessImpl.start(ProcessImpl.java:130)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1023)
        at java.lang.Runtime.exec(Runtime.java:620)
        at java.lang.Runtime.exec(Runtime.java:485)


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        public class Test {

        public static void main(final String[] args) {
        Locale.setDefault(new Locale("tr", ""));
        try {
        Process exec = Runtime.getRuntime().exec("ls");
        }
        catch (IOException e) {
        e.printStackTrace();
        }
        }

        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Use an alternative locale.

              plevart Peter Levart
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: