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

System.getenv("DISPLAY") returns null if default encoding is Cp037

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P2 P2
    • None
    • 8
    • core-libs
    • 7
    • generic
    • solaris_1

      During previous JDK/JCK releases (prior to JDK7 and JDK8), JCK team used 'ebcdic' mode of running conformance tests to prove that tests can be run if default charset is different from ASCII or ISO-8859-1. In order to do this, we used ELauncher.java (attached to this CR), that does the following:
      1) encodes environment variables to Cp037 charset
      2) runs new java process via Runtime.exec with new (recoded) environment and property -Dfile.encoding=Cp037
      3) after running the process, ELauncher decodes process output back to a human readable ASCII to be able to analyze results of testing

      It worked well for JDK1.4, JDK1.5, JDK6. Since JDK7 System.getenv("DISPLAY") returns null if default charset is set to Cp037. Thus, all JCK tests that require DISPLAY variable cannot run in this mode.

      So, this example if being run as "$JDK7/bin/java -Dfile.encoding=Cp037 Test"
      --------------- Test.java --------------------------------------------------
      import java.awt.Dialog;
      import java.awt.Frame;
      public class Test {
          public static void main(String[] args) {
              Dialog d = new Dialog((Frame) null, "");
          }
      }
      -------------------------------------------------------------------------

      now results in the following stack trace:

      -------------------------------------------------------------------
      Exception in thread "main" java.awt.HeadlessException:
      No X11 DISPLAY variable was set, but this program performed an operation which requires it.
              at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:197)
              at java.awt.Window.init(Window.java:475)
              at java.awt.Window.<init>(Window.java:437)
              at java.awt.Window.<init>(Window.java:593)
              at java.awt.Dialog.<init>(Dialog.java:662)
              at java.awt.Dialog.<init>(Dialog.java:406)
              at java.awt.Dialog.<init>(Dialog.java:376)
      -------------------------------------------------------------------

      The same result when ELauncher is used to recode all env. variables to Cp037.

            Unassigned Unassigned
            aposledo Alexander Posledov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: