JDK-7186224 : Desktop.mail throws an exception
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux_ubuntu
  • CPU: x86
  • Submitted: 2012-07-23
  • Updated: 2014-03-17
  • Resolved: 2014-03-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8-poolResolved
Related Reports
Duplicate :  
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