aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/utils
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2016-05-22 19:42:43 +0200
committerChristian Schneppe <christian@pix-art.de>2016-05-22 19:42:43 +0200
commitca34be385e8c1e414dab4b49080087dffa85f876 (patch)
tree97a0ceeeca0b2512919492317db8412becbef8fa /src/main/java/eu/siacs/conversations/utils
parent73a02abfd73da1ca5f5f9ed6c0c7c287371d0d25 (diff)
parentabbdf232c6f27a00edaa9af5937f9d022ad15f65 (diff)
Merge remote-tracking branch 'refs/remotes/siacs/master'
Diffstat (limited to 'src/main/java/eu/siacs/conversations/utils')
-rw-r--r--src/main/java/eu/siacs/conversations/utils/DNSHelper.java3
-rw-r--r--src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java14
-rw-r--r--src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java12
3 files changed, 16 insertions, 13 deletions
diff --git a/src/main/java/eu/siacs/conversations/utils/DNSHelper.java b/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
index 2f588f492..ac64cf2e8 100644
--- a/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
@@ -47,7 +47,10 @@ public class DNSHelper {
protected static Client client = new Client();
+ protected static Context context;
+
public static Bundle getSRVRecord(final Jid jid, Context context) throws IOException {
+ DNSHelper.context = context;
final String host = jid.getDomainpart();
final List<InetAddress> servers = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? getDnsServers(context) : getDnsServersPreLollipop();
Bundle b = new Bundle();
diff --git a/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java
index 4e3ec2366..efc83bcb2 100644
--- a/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java
+++ b/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java
@@ -27,19 +27,7 @@ public class ExceptionHandler implements UncaughtExceptionHandler {
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();
- }
+ ExceptionHelper.writeToStacktraceFile(context, stacktrace);
this.defaultHandler.uncaughtException(thread, ex);
}
diff --git a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java
index e9f67cf0b..12140bde3 100644
--- a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java
@@ -14,8 +14,10 @@ import android.util.Log;
import java.io.BufferedReader;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.util.List;
import eu.siacs.conversations.Config;
@@ -119,4 +121,14 @@ public class ExceptionHelper {
return false;
}
}
+
+ public static void writeToStacktraceFile(Context context, String msg) {
+ try {
+ OutputStream os = context.openFileOutput("stacktrace.txt", Context.MODE_PRIVATE);
+ os.write(msg.getBytes());
+ os.flush();
+ os.close();
+ } catch (IOException ignored) {
+ }
+ }
}