1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-16 06:59:29 +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; return;
} }
Uri dstUri = Uri.parse(dst); Uri dstUri = Uri.parse(dst);
OutputStream out = context.getContentResolver().openOutputStream(dstUri); try (OutputStream out = context.getContentResolver().openOutputStream(dstUri)) {
helper.exportDB(dbHandler, out); helper.exportDB(dbHandler, out);
}
} catch (Exception ex) { } catch (Exception ex) {
GB.updateExportFailedNotification(context.getString(R.string.notif_export_failed_title), context); GB.updateExportFailedNotification(context.getString(R.string.notif_export_failed_title), context);
LOG.info("Exception while exporting DB: ", ex); LOG.info("Exception while exporting DB: ", ex);