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

Desktop.mail throws an exception

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • 8-pool
    • 7
    • client-libs
    • x86
    • linux_ubuntu

    Description

      FULL PRODUCT VERSION :
      java version "1.7.0_05"
      Java(TM) SE Runtime Environment (build 1.7.0_05-b06)
      Java HotSpot(TM) Server VM (build 23.1-b03, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux epi 3.2.0-27-generic-pae #43-Ubuntu SMP Fri Jul 6 15:06:05 UTC 2012 i686 athlon i386 GNU/Linux


      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Gnome Desktop or Unity Desktop


      A DESCRIPTION OF THE PROBLEM :
      the following code fails with Oracle 1.7.0_05

      if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.MAIL))
      {
          try
          {
              Desktop.getDesktop().mail(new URI("mailto:###@###.###"));
          }
          catch (IOException ex)
          {
              ex.printStackTrace();
          }
      }

      it throws an exception

      java.io.IOException: Failed to show URI:mailto:###@###.###
      at sun.awt.X11.XDesktopPeer.launch(XDesktopPeer.java:114)
      at sun.awt.X11.XDesktopPeer.mail(XDesktopPeer.java:94)
      at java.awt.Desktop.mail(Desktop.java:474)
      at test.DesktopTest.main(DesktopTest.java:28)

      but if you use IcedTea7 1.7.0_03, from ubuntu packages, it works ok.

      I think it doesn't look ".local/share/applications/mimeapps.list" and "/usr/share/applications/MAILAPP.desktop" files for the configuration

      If I change ".local/share/applications/mimeapps.list" to launch firefox as browser IcedTea launch firefox, but Oracle Java still lauch chromium-browser, so I think it isn't look into those files to get the right application.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      java version "1.7.0_03"
      OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7~u3-2.1.1~pre1-1ubuntu3)
      OpenJDK Server VM (build 22.0-b10, mixed mode)


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      open the mail aplication
      ACTUAL -
      an exception


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.io.IOException: Failed to show URI:mailto:###@###.###
      at sun.awt.X11.XDesktopPeer.launch(XDesktopPeer.java:114)
      at sun.awt.X11.XDesktopPeer.mail(XDesktopPeer.java:94)
      at java.awt.Desktop.mail(Desktop.java:474)
      at test.DesktopTest.main(DesktopTest.java:28)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.MAIL))
      {
          try
          {
              Desktop.getDesktop().mail(new URI("mailto:###@###.###"));
          }
          catch (IOException ex)
          {
              ex.printStackTrace();
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Do not use Oracle java, and use IcedTea instead.

      SUPPORT :
      YES

      Attachments

        Issue Links

          Activity

            People

              azvegint Alexander Zvegintsev
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: