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

Desktop throws IOException instead of showing URL or sending mail

XMLWordPrintable

    • x86
    • linux

      FULL PRODUCT VERSION :
      java version "1.6.0-rc"
      Java(TM) SE Runtime Environment (build 1.6.0-rc-b101)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b101, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Linux 2.6.16.13-4-default
      SUSE Linux 10.1, SUSE Linux Enterprise Desktop.
      KDE 3.5.1 to 3.5.5

      A DESCRIPTION OF THE PROBLEM :
      When try to invoke any sort of operation from java.awt.Desktop - it throws IOException. tested on about 8 SUSE boxes with KDE enviroment. didnt tested on other desktops.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. create test class with NetBeans
      2. compile.
      3. run.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      invocation of browser, mailer, default application.
      ACTUAL -
      IOException

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.io.IOException: Failed to show URI:mailto:###@###.###
              at sun.awt.X11.XDesktopPeer.launch(XDesktopPeer.java:75)
              at sun.awt.X11.XDesktopPeer.mail(XDesktopPeer.java:60)
              at java.awt.Desktop.mail(Desktop.java:456)
              at DesktopTest$1.actionPerformed(DesktopTest.java:20)
              at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
              at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
              at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
              at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
              at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
              at java.awt.Component.processMouseEvent(Component.java:6038)
              at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
              at java.awt.Component.processEvent(Component.java:5803)
              at java.awt.Container.processEvent(Container.java:2058)
              at java.awt.Component.dispatchEventImpl(Component.java:4410)
              at java.awt.Container.dispatchEventImpl(Container.java:2116)
              at java.awt.Component.dispatchEvent(Component.java:4240)
              at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
              at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
              at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
              at java.awt.Container.dispatchEventImpl(Container.java:2102)
              at java.awt.Window.dispatchEventImpl(Window.java:2429)
              at java.awt.Component.dispatchEvent(Component.java:4240)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Desktop;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import java.net.URI;
      import javax.swing.BorderFactory;
      import javax.swing.JButton;
      import javax.swing.JFrame;
      import javax.swing.JPanel;

      public class DesktopTest {
          
          public DesktopTest() {
              JPanel panel = new JPanel();
              
              if (Desktop.isDesktopSupported()) {
                  JButton reportButton = new JButton("compose mail!");
                  reportButton.addActionListener(new ActionListener() {
                      public void actionPerformed(ActionEvent ev) {
                          try {
                              Desktop.getDesktop().mail(new URI("mailto", "###@###.###", null));
                          } catch (Exception ex) {
                              ex.printStackTrace();
                          }
                      }
                  });
                  panel.add(reportButton);
              }
              panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
              
              
              JFrame frame = new JFrame();
              frame.setContentPane(panel);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.pack();
              frame.setVisible(true);
          }
          
          public static void main(String[] args) {
              new DesktopTest();
          }
          
      }

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

            denis Denis Fokin (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: