diff options
Diffstat (limited to 'src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java deleted file mode 100644 index 4e3ec236..00000000 --- a/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java +++ /dev/null @@ -1,46 +0,0 @@ -package eu.siacs.conversations.utils; - -import android.content.Context; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.io.Writer; -import java.lang.Thread.UncaughtExceptionHandler; - -public class ExceptionHandler implements UncaughtExceptionHandler { - - private UncaughtExceptionHandler defaultHandler; - private Context context; - - public ExceptionHandler(Context context) { - this.context = context; - this.defaultHandler = Thread.getDefaultUncaughtExceptionHandler(); - } - - @Override - public void uncaughtException(Thread thread, Throwable ex) { - Writer result = new StringWriter(); - PrintWriter printWriter = new PrintWriter(result); - ex.printStackTrace(printWriter); - String stacktrace = result.toString(); - printWriter.close(); - try { - OutputStream os = context.openFileOutput("stacktrace.txt", - Context.MODE_PRIVATE); - os.write(stacktrace.getBytes()); - os.flush(); - os.close(); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - this.defaultHandler.uncaughtException(thread, ex); - } - -} |