mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-29 09:01:30 +01:00
use try-with-resources
This commit is contained in:
@@ -129,21 +129,11 @@ public class ApplicationEx extends Application {
|
||||
File file = new File(context.getCacheDir(), "crash.log");
|
||||
Log.w("Writing exception to " + file);
|
||||
|
||||
FileWriter out = null;
|
||||
try {
|
||||
out = new FileWriter(file, true);
|
||||
try (FileWriter out = new FileWriter(file, true)) {
|
||||
out.write(BuildConfig.VERSION_NAME + " " + new Date() + "\r\n");
|
||||
out.write(ex + "\r\n" + android.util.Log.getStackTraceString(ex) + "\r\n");
|
||||
} catch (IOException e) {
|
||||
Log.e(e);
|
||||
} finally {
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user