comparison src/main/java/org/monetdb/jdbc/MonetConnection.java @ 546:eb7ecfbb48f2 onclient

Never forget to close the download handle
author Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
date Tue, 14 Sep 2021 09:22:16 +0200 (2021-09-14)
parents d462000fc410
children 5ce6a942aff3
comparison
equal deleted inserted replaced
545:79393647d7fb 546:eb7ecfbb48f2
3254 if (downloadHandler == null) { 3254 if (downloadHandler == null) {
3255 return "No file download handler has been registered with the JDBC driver"; 3255 return "No file download handler has been registered with the JDBC driver";
3256 } 3256 }
3257 3257
3258 Download handle = new Download(server); 3258 Download handle = new Download(server);
3259 downloadHandler.handleDownload(handle, path, true); 3259 try {
3260 if (!handle.hasBeenUsed()) { 3260 downloadHandler.handleDownload(handle, path, true);
3261 String message = String.format("Call to %s.handleDownload for path '%s' sent neither data nor an error message", 3261 if (!handle.hasBeenUsed()) {
3262 downloadHandler.getClass().getCanonicalName(), path); 3262 String message = String.format("Call to %s.handleDownload for path '%s' sent neither data nor an error message",
3263 throw new IOException(message); 3263 downloadHandler.getClass().getCanonicalName(), path);
3264 } 3264 throw new IOException(message);
3265 handle.close(); 3265 }
3266 } finally {
3267 handle.close();
3268 }
3266 return handle.getError(); 3269 return handle.getError();
3267 } 3270 }
3268 3271
3269 /** 3272 /**
3270 * Callback for sending files for COPY ON CLIENT 3273 * Callback for sending files for COPY ON CLIENT