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

(process) Decode system error messages using platform encoding (unix)

XMLWordPrintable

    • b81
    • 6
    • b21
    • sparc
    • solaris_10
    • Not verified

        OS : Solaris 9/10 (japanese locale(LOCALE=ja))
             WindowsXP(SP2, Japanese)
        JDK : 6.0u2/JDK7b16

        REPRODUCE :
         1) Compile the attached test program
         2) Invoke "java Command"
         3) Please look at the message when IOException occurs in java.lang.Runtime#exec
            (The test program tests other cases. The licensee focus on the IOException message.)

         This does not occur in 1.3.1, 1.4.2_XX and 5.0ux.

        NOTE :
         The test program checks several cases. The above issues occurs in IOException check.
         

        INVESTIGATION :

        [j2se/src/solaris/native/java.lang/UNIXProcess_md.c]
         .....
          static void
          throwIOException(JNIEnv *env, int errnum, const char *defaultDetail)
          {
              static const char * const format = "error=%d, %s";
              const char *detail = defaultDetail;
              char *errmsg;
              if (errnum != 0) {
        const char *s = strerror(errnum);
        if (strcmp(s, "Unknown error") != 0)
        detail = s;
              }
              /* ASCII Decimal representation uses 2.4 times as many bits as binary. */
              errmsg = NEW(char, strlen(format) + strlen(detail) + 3 * sizeof(errnum));
              sprintf(errmsg, format, errnum, detail);
              JNU_ThrowIOException(env, errmsg);
              free(errmsg);
          }
          .....

        The return value(Japanese EUC encoding ) from strerr() is used in UTF-8.
        That's why the error message can not be displayed correctly.


        OTHERS:
         Please see the strong requests in "comment section".

              martin Martin Buchholz
              tbaba Tadayuki Baba (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: