package backupBasic.backup;
/*(c)2016, Tobias Hotz
 * Further Information can be found in Info.txt
 */

import backupBasic.util.i18n;

import javax.swing.*;
import java.awt.*;
import java.util.logging.Logger;

/**
 * @author Tobias Hotz
 */
public class Main implements Thread.UncaughtExceptionHandler {

    private static final Logger logger = i18n.getLogger(Main.class);
	/**
	 * Verwaltet das Logging-System und gibt dann an den ArgParser ab
	 */
	public static void main(String[] args) {
		Thread.setDefaultUncaughtExceptionHandler(new Main());
        i18n.initLogging();
        ArgParser.parseArgs(args);
	}

	@Override
	public void uncaughtException(Thread t, Throwable e) {
		logger.severe(i18n.translate("UncaughtException")+ "\t Stacktrace:");
		e.printStackTrace();
		if(!GraphicsEnvironment.isHeadless()) {
			JOptionPane.showMessageDialog(null, i18n.translate("UncaughtException") + "\n" + i18n.translate("Error") + ": "+ e +"\n" +  i18n.translate("Details"), "ERROR", JOptionPane.ERROR_MESSAGE);
		}
		System.exit(-1);
	}
}
@@ -297,17 +297,16 @@
 ndler %7B%0A
-%0A
     priv
@@ -366,16 +366,17 @@
 class);%0A
+%0A
 %09/**%0A%09 *
@@ -678,17 +678,38 @@
 e e) %7B%0A%09
-%09
+    try %7B%0A            
 logger.s
@@ -770,18 +770,28 @@
 ace:%22);%0A
-%09%09
+            
 e.printS
@@ -803,18 +803,28 @@
 race();%0A
-%09%09
+            
 if(!Grap
@@ -856,14 +856,25 @@
 s())
- %7B%0A%09%09%09
+%0A                
 JOpt
@@ -942,16 +942,40 @@
 tion%22) +
+%0A                       
  %22%5Cn%22 + 
@@ -1008,20 +1008,21 @@
 %22: %22
+ 
 + e +
+ 
 %22%5Cn%22 +
- 
  i18
@@ -1082,18 +1082,475 @@
 SSAGE);%0A
-%09%09
+            %7D catch(Exception e2) %7B%0A%09            e.printStackTrace();%0A%09            System.err.println(%22Errors while printing Error:%22);%0A%09            e2.printStackTrace();%0A%09            if(!GraphicsEnvironment.isHeadless())%0A%09            JOptionPane.showMessageDialog(null, %22An fatal error occurred, and the program crashed.%22 +%0A                        %22%5CnIn addition to that, it failed to translate this Message%22, %22ERROR%22, JOptionPane.ERROR_MESSAGE);%0A            
 %7D%0A%09%09Syst

Fix crash when showing crash information