1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 18:15:49 +01:00

Make sure to close the outputstream of the export

This commit is contained in:
cpfeiffer 2018-02-19 21:41:24 +01:00
parent bf729f41b2
commit 6370c6cac1

View File

@ -65,8 +65,9 @@ public class PeriodicExporter extends BroadcastReceiver {
return;
}
Uri dstUri = Uri.parse(dst);
OutputStream out = context.getContentResolver().openOutputStream(dstUri);
helper.exportDB(dbHandler, out);
try (OutputStream out = context.getContentResolver().openOutputStream(dstUri)) {
helper.exportDB(dbHandler, out);
}
} catch (Exception ex) {
GB.updateExportFailedNotification(context.getString(R.string.notif_export_failed_title), context);
LOG.info("Exception while exporting DB: ", ex);