[Schmitzm-commits] r1547 - trunk/schmitzm-core/src/main/java/de/schmitzm/net/mail

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Apr 1 23:00:33 CEST 2011


Author: alfonx
Date: 2011-04-01 23:00:31 +0200 (Fri, 01 Apr 2011)
New Revision: 1547

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/net/mail/MailUtil.java
Log:
Respect headless when sending a Desktop Mail failed.

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/net/mail/MailUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/net/mail/MailUtil.java	2011-03-31 15:55:01 UTC (rev 1546)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/net/mail/MailUtil.java	2011-04-01 21:00:31 UTC (rev 1547)
@@ -1,6 +1,8 @@
 package de.schmitzm.net.mail;
 
 import java.awt.Desktop;
+import java.awt.GraphicsEnvironment;
+import java.awt.Toolkit;
 import java.net.URI;
 import java.util.Date;
 import java.util.Locale;
@@ -135,8 +137,14 @@
 			String mailBody) {
 		if (!Desktop.isDesktopSupported()
 				|| !Desktop.getDesktop().isSupported(Desktop.Action.MAIL)) {
-			JOptionPane.showMessageDialog(null,
-					RESOURCE.getString("MailUtil.DesktopMail.NotSupported"));
+
+			if (!GraphicsEnvironment.isHeadless()) {
+				JOptionPane
+						.showMessageDialog(null, RESOURCE
+								.getString("MailUtil.DesktopMail.NotSupported"));
+			} else {
+				log.info("java.awt.Desktop noch available on this system to send a mail.");
+			}
 			return;
 		}
 



More information about the Schmitzm-commits mailing list