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

java/awt/Desktop/MailTest.java fails in platforms where Action.MAIL is not supported

XMLWordPrintable

    • b15
    • generic

      OS: Linux

      Environments: OEL 9/8 Any Kernel aarch64

      Failed on Release/Build: JDK_24 - 24.0. 1 7
      Is it a Regression in JDK 24 release: N/A
      Is it a platform-specific issue: No

      General description of the problem:
      Test "java/awt/Desktop/MailTest.java": Test case auto fails


      Steps to reproduce:
      - Run test cases: java/awt/Desktop/MailTest.java

      Expected behavior:
      The test case should be executed correctly

      Actual behavior:
      Test case failed automatically

      Any non-default VM flags

      java.lang.reflect.InvocationTargetException
      at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1371)
      at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1346)
      at java.desktop/javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1480)
      at PassFailJFrame.invokeOnEDT(PassFailJFrame.java:595)
      at PassFailJFrame.<init>(PassFailJFrame.java:532)
      at PassFailJFrame$Builder.build(PassFailJFrame.java:1831)
      at MailTest.main(MailTest.java:113)
      at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
      at java.base/java.lang.reflect.Method.invoke(Method.java:572)
      at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
      at java.base/java.lang.Thread.run(Thread.java:1491)
      Caused by: java.lang.UnsupportedOperationException: The MAIL action is not supported on the current platform!
      at java.desktop/java.awt.Desktop.checkActionSupport(Desktop.java:378)
      at java.desktop/java.awt.Desktop.mail(Desktop.java:517)
      at MailTest.<init>(MailTest.java:67)
      at PassFailJFrame.createUI(PassFailJFrame.java:649)

      JavaTest Message: Test threw exception: java.lang.reflect.InvocationTargetException
      JavaTest Message: shutting down test

      Issue
      java/awt/Desktop/MailTest.java fails in platforms where Action.MAIL is not supported

      Reason
      In MailTest.java, there is a condition check(if (!desktop.isSupported(Desktop.Action.MAIL))) which will force pass the test if the corresponding 'Action' is not supported by the platform. But, apparently, this is not working good and the code flow went past this and fails in desktop.mail() method with an UnsupportedOperationException.

      Fix
      Even though we are calling PassFailJFrame.forcePass() if the 'Action.MAIL' is unsupported, the PassFailJFrame just count downs a latch and the actual action will be taken later only(in awaitAndCheck()). But at the meantime, the desktop.mail() call gets executed in the constructor of MailTest() and it will result in an UnsupportedOperationException. So, the fix is to return from the constructor immediately if the operation is 'unsupported'.

      Testing
      This is a manual test, so it is tested locally and found to be working fine.

            mvs Manukumar V S
            mvs Manukumar V S
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: