1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-01 23:29:28 +01:00

Fix file descriptor leak when downloads are interrupted

This fixes a java warning.
This commit is contained in:
Matthijs Kooijman 2016-01-21 17:15:42 +01:00
parent 19a9e4d5e0
commit 40e9aa17b3

@ -207,9 +207,11 @@ public class FileDownloader extends Observable {
file.write(buffer, 0, read); file.write(buffer, 0, read);
setDownloaded(getDownloaded() + read); setDownloaded(getDownloaded() + read);
if (Thread.interrupted()) if (Thread.interrupted()) {
file.close();
throw new InterruptedException(); throw new InterruptedException();
} }
}
if (getDownloadSize() != null) { if (getDownloadSize() != null) {
if (getDownloaded() < getDownloadSize()) if (getDownloaded() < getDownloadSize())