# HG changeset patch # User Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com> # Date 1631604136 -7200 # Node ID eb7ecfbb48f24e809f7a5eec2246412a66cd0df2 # Parent 79393647d7fb1fb081fd1b6c1ba37166c6836e98 Never forget to close the download handle diff --git a/src/main/java/org/monetdb/jdbc/MonetConnection.java b/src/main/java/org/monetdb/jdbc/MonetConnection.java --- a/src/main/java/org/monetdb/jdbc/MonetConnection.java +++ b/src/main/java/org/monetdb/jdbc/MonetConnection.java @@ -3256,13 +3256,16 @@ public class MonetConnection } Download handle = new Download(server); - downloadHandler.handleDownload(handle, path, true); - if (!handle.hasBeenUsed()) { - String message = String.format("Call to %s.handleDownload for path '%s' sent neither data nor an error message", - downloadHandler.getClass().getCanonicalName(), path); - throw new IOException(message); + try { + downloadHandler.handleDownload(handle, path, true); + if (!handle.hasBeenUsed()) { + String message = String.format("Call to %s.handleDownload for path '%s' sent neither data nor an error message", + downloadHandler.getClass().getCanonicalName(), path); + throw new IOException(message); + } + } finally { + handle.close(); } - handle.close(); return handle.getError(); }