diff --git a/pom.xml b/pom.xml index d05d97a..008e683 100644 --- a/pom.xml +++ b/pom.xml @@ -52,6 +52,16 @@ github-api 1.127 + + com.sun.mail + javax.mail + 1.6.2 + + + mysql + mysql-connector-java + 8.0.33 + io.qtjambi qtjambi diff --git a/src/data/DownloadLevels.java b/src/data/DownloadLevels.java index 708ecb8..6ce2634 100644 --- a/src/data/DownloadLevels.java +++ b/src/data/DownloadLevels.java @@ -83,6 +83,7 @@ public class DownloadLevels { fileOutputStream.write(dataBuffer, 0, bytesRead); } + } catch (IOException e) { e.printStackTrace(); } diff --git a/src/errorhandler/ErrorHandler.java b/src/errorhandler/ErrorHandler.java new file mode 100644 index 0000000..025836b --- /dev/null +++ b/src/errorhandler/ErrorHandler.java @@ -0,0 +1,21 @@ +package errorhandler; + +import java.io.PrintWriter; +import java.io.StringWriter; + +import javax.swing.JOptionPane; + +public class ErrorHandler { + + public void newError(Throwable e) { + e.printStackTrace(); + + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + e.printStackTrace(pw); + + JOptionPane.showMessageDialog(null, sw.toString() + "", e.getMessage(), JOptionPane.ERROR_MESSAGE); + System.exit(-1); + } + +} diff --git a/src/errorhandler/ErrorSubmission.java b/src/errorhandler/ErrorSubmission.java new file mode 100644 index 0000000..b559320 --- /dev/null +++ b/src/errorhandler/ErrorSubmission.java @@ -0,0 +1,18 @@ +package errorhandler; + +import java.util.Properties; + +import javax.mail.Authenticator; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.PasswordAuthentication; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; + +public class ErrorSubmission { + + + +} diff --git a/src/main/Main.java b/src/main/Main.java index 273c262..ffd1825 100644 --- a/src/main/Main.java +++ b/src/main/Main.java @@ -3,11 +3,14 @@ package main; import java.io.IOException; import java.util.zip.DataFormatException; +import javax.swing.JOptionPane; + import api.GetApiData; import data.FetchData; import data.ManageFiles; import database.DatabaseManager; import database.Sqlite; +import errorhandler.ErrorHandler; import filestructure.CreateFileStructure; import gui.LoadMenu; import preload.PreChecks; @@ -16,6 +19,16 @@ import settingsfunctions.LoadSettings; public class Main { public static void main(String[] args) throws IOException, DataFormatException { + + Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { + @Override + public void uncaughtException(Thread t, Throwable e) { + ErrorHandler error = new ErrorHandler(); + error.newError(e); + } + }); + + try { LoadMenu load = new LoadMenu(); load.onLoad(); @@ -54,6 +67,10 @@ public class Main { load.updateBar("Ladevorgang abgeschlossen"); load.close(); + + } catch (Exception e) { + System.out.println("fehler"); + } } } diff --git a/src/module-info.java b/src/module-info.java index b6e02a2..8ef6234 100644 --- a/src/module-info.java +++ b/src/module-info.java @@ -10,4 +10,5 @@ requires java.xml; requires org.apache.commons.codec; requires github.api; + requires java.mail; } \ No newline at end of file