[Schmitzm-commits] r1199 - in trunk/src/schmitzm: mail swing

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Nov 2 16:28:31 CET 2010


Author: alfonx
Date: 2010-11-02 16:28:30 +0100 (Tue, 02 Nov 2010)
New Revision: 1199

Modified:
   trunk/src/schmitzm/mail/MailUtil.java
   trunk/src/schmitzm/swing/ExceptionDialog.java
Log:
Exceptions Mails should now coantin the version of Geopublisher and/or AtlasStyler

Modified: trunk/src/schmitzm/mail/MailUtil.java
===================================================================
--- trunk/src/schmitzm/mail/MailUtil.java	2010-11-02 15:27:46 UTC (rev 1198)
+++ trunk/src/schmitzm/mail/MailUtil.java	2010-11-02 15:28:30 UTC (rev 1199)
@@ -102,7 +102,7 @@
 	 *            caller
 	 */
 	public static void sendDesktopExceptionMail(String mailDestAddr,
-			Throwable err, String additionalInfo) {
+			Throwable err, Object additionalInfo) {
 		String exceptionMess = err.getMessage();
 		String exceptionStack = LangUtil.getStackTraceFromException(err);
 
@@ -115,7 +115,7 @@
 
 		// insert optinal additional comment
 		if (additionalInfo != null) {
-			additionalInfo = LangUtil.trimNewlines(additionalInfo);
+			additionalInfo = LangUtil.trimNewlines(additionalInfo.toString());
 
 			mailBody.append(additionalInfo + "\n");
 		}

Modified: trunk/src/schmitzm/swing/ExceptionDialog.java
===================================================================
--- trunk/src/schmitzm/swing/ExceptionDialog.java	2010-11-02 15:27:46 UTC (rev 1198)
+++ trunk/src/schmitzm/swing/ExceptionDialog.java	2010-11-02 15:28:30 UTC (rev 1199)
@@ -67,6 +67,13 @@
      *  {@link #setMailDestinationAddress(String)} in der Applikation
      *  erforderlich. */
     protected static String destMailAddr = null;
+    
+	/**
+	 * If not <code>null</code>, toString will be evaluated to create additional
+	 * information (e.g. program version) when sending exception reports (e.g.
+	 * by mail)
+	 */
+    private static Object additionalAppInfo = null;
    
 	/** Speichert den angezeigten Fehler. */
 	protected Throwable err = null;
@@ -245,10 +252,12 @@
 			}
 		});
         this.mailButton.addActionListener(new ActionListener() {
-          public void actionPerformed(ActionEvent e) {
+
+		public void actionPerformed(ActionEvent e) {
               if (getError() == null)
                 return;
-              MailUtil.sendDesktopExceptionMail(destMailAddr, getError());
+              
+              MailUtil.sendDesktopExceptionMail(destMailAddr, getError(), getAdditionalAppInfo());
           }
       });
 
@@ -467,4 +476,12 @@
 		return throwRuntimeExceptionsBack;
 	}
 
+	public static void setAdditionalAppInfo(Object additionalAppInfo) {
+		ExceptionDialog.additionalAppInfo = additionalAppInfo;
+	}
+
+	public static Object getAdditionalAppInfo() {
+		return additionalAppInfo;
+	}
+
 }



More information about the Schmitzm-commits mailing list