Skip to content

Commit 40e9aa1

Browse files
Fix file descriptor leak when downloads are interrupted
This fixes a java warning.
1 parent 19a9e4d commit 40e9aa1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arduino-core/src/cc/arduino/utils/network/FileDownloader.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,10 @@ private void downloadFile() throws InterruptedException {
207207
file.write(buffer, 0, read);
208208
setDownloaded(getDownloaded() + read);
209209

210-
if (Thread.interrupted())
210+
if (Thread.interrupted()) {
211+
file.close();
211212
throw new InterruptedException();
213+
}
212214
}
213215

214216
if (getDownloadSize() != null) {

0 commit comments

Comments
 (0)