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

Wrong exception is thrown while trying to set a Null or invalid Display mode

XMLWordPrintable

    • 2d
    • tiger
    • x86
    • windows_2000
    • Verified

      Java -version

      java version "1.4.2-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b06)
      Java HotSpot(TM) Client VM (build 1.4.2-beta-b06, mixed mode)


      Try to set a display mode which is not available in the system it should throw IllegalArguementException(according to API doc).Instead,it throws an AWT Error which is as follows

      Exception in thread "main" java.lang.InternalError: Could not set display mode
       at sun.awt.Win32GraphicsDevice.configDisplayMode(Native Method)
       at sun.awt.Win32GraphicsDevice.setDisplayMode(Win32GraphicsDevice.java:300)
       at Test1.main(Test1.java:20)

      Please try running the attached program "Test1.java".

      Similarly ,if we Try to set a "null"display mode,it should throw IllegalArguementException.Instead,it throws Null Pointer Exception which is as follows:

      java.lang.NullPointerException
      at sun.awt.Win32GraphicsDevice.isDisplayModeAvailable(Win32GraphicsDevice.java:345)
      at sun.awt.Win32GraphicsDevice.setDisplayMode(Win32GraphicsDevice.java:296)
      at Test.main(Test.java:20)

      Please try running the attached program "Test.java".

            chaasesunw Chet Haase (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: