JDK-6927425 : (process) Decode system error messages (win)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 6
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: windows
  • CPU: generic
  • Submitted: 2010-02-17
  • Updated: 2013-07-15
  • Resolved: 2013-07-15
Related Reports
Blocks :  
Relates :  
Description
OPERATING SYSTEM(S)
-------------------
Testcase for non-English Windows Vista/2008.
May occur on earlier Windows releases as well (with a suitable testcase).

FULL JDK VERSION(S)
-------------------
All Java 6 releases.

DESCRIPTION:
------------
Only ASCII characters are getting stored and printed by Java 6 for an error text message returned by the Windows 2008 operating system even though double-byte language systems are being used.

Steps to reproduce:
------------------
1. Login  using a regular Administrator group user account (but not the
   built-in Administrator account).
2. Run the GarbledText Java program to hit the expected Windows 740
   error.
3. Note the missing characters in the error message.

============================================================
import java.io.*;
class GarbledText {
    public static void main (String args[]) {
        try {
            Process process = Runtime.getRuntime().exec("mmc.exe");
        } catch (Exception e) {
            System.err.println(e);
            System.err.println("\n2");

            System.err.println(e.getMessage());
            System.err.println("\n3");
            System.err.println(e.getLocalizedMessage());
            System.err.println("\n4");
            System.err.println(e.getCause());
            System.err.println("\n5");
            e.printStackTrace();
        }
    }
}
============================================================

Observed result (on a Polish system):

740: ??dana operacja wymaga podniesienia uprawni

Expected result: Characters should be displayed correctly.

This issue seems to share some symptoms with the Unix CR 6600199. It may or may not be related to that issue.

Comments
duplicate for JDK-8016579
15-07-2013

The cause known. The fix is blocked by JDK-8011105 (Locale Issue in the Native Function GetLastErrorString()), that suggests essential changes in API: switching from Western Europe to UTF-8 default code page.
29-04-2013

It was my old comment to JDK-8001334: "I start the investigation of [JDK-8001334 - Remove use of JVM_* functions from java.io code] bug. That is the old pain of localized Non-Western Windows: Output: IOException: Cannot run program ".\Programi\\": CreateProcess error=2, ���� �������������� ���������� ������������������ �������� or Output: IOException: Cannot run program ".\Programi\\": CreateProcess error=2, ?? ??????? ..... depends from you default locale for non-Unicode characters. The solution is to switch to Unicode API and use UTF-16 to UTF-8 conversion for each [char *] Java API output parameters."
29-04-2013

EVALUATION Would it be possible to get the complete output from running the given testcase? So, we can see exactly which exception is thrown and where. Marking incomplete for now.
26-07-2010

EVALUATION This looks very much like 6600199, as submitter mentioned. In fact, 6600199 attached test is still failing when tested with 6u18 or Java 7 on Windows 2008 Japanese. Forwarding to classes_lang. To clarify, the problem reported here is IOException held localized system message being corrupted. The IOException is thrown by ProcessBuilder#start() and Runtime#exec(). No problem seen in Process's input and error streams on Windows.
18-02-2010