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

(process) System.getenv() throws ExceptionInInitializerError in Netscape 4.x

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • core-libs
    • None
    • sparc
    • solaris_8

      Name: atR10251 Date: 04/06/2004


      The problem comes up when System.getenv() is called from an applet inside Netscape 4.x on Solaris.

      Run this applet to reproduce it:

      -----------------------------------
      import java.applet.Applet;

      public class MyApp extends Applet {
          public void start() {
              System.getenv("DISPLAY");
          }
      }
      -----------------------------------

      The following exception will be thrown:

      java.lang.ExceptionInInitializerError
              at java.lang.System.getenv(System.java:795)
              at MyApp.start(MyApp.java:5)
              at sun.applet.AppletPanel.run(AppletPanel.java:394)
              at java.lang.Thread.run(Thread.java:570)
      Caused by: java.lang.NullPointerException
              at java.lang.String.<init>(String.java:486)
              at java.lang.ProcessEnvironment$Variable.valueOf(ProcessEnvironment.java:157)
              at java.lang.ProcessEnvironment.<clinit>(ProcessEnvironment.java:58)
              ... 4 more

      Despite the fact that this method is deprecated we use it in AWT code because of the absence
      of any alternative. You may look at the bug 4979996 to see this necessity.
      Regarding this problem, we found a workaround so that we avoid calling System.getenv() in applets,
      but still need it in applications.

      So, I file this bug just to show the problem.
      ======================================================================

            martin Martin Buchholz
            ant Anton Tarasov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: