From 1f9e8f5e4dc70bd6f24b76f8765d7d69be6187ef Mon Sep 17 00:00:00 2001 From: Marco Bungart Date: Tue, 30 Apr 2024 19:01:40 +0200 Subject: [PATCH] Auto-close ResultSet --- src/main/java/de/turing85/run/query/RunQueryResource.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/turing85/run/query/RunQueryResource.java b/src/main/java/de/turing85/run/query/RunQueryResource.java index de1ea3e..522f7d0 100644 --- a/src/main/java/de/turing85/run/query/RunQueryResource.java +++ b/src/main/java/de/turing85/run/query/RunQueryResource.java @@ -34,8 +34,8 @@ public class RunQueryResource { @Transactional public Response runQuery(@Valid @NotNull @QueryParam("query") String query) { try (Connection connection = dataSource.getConnection(); - Statement statement = connection.createStatement()) { - final ResultSet rs = statement.executeQuery(query); + Statement statement = connection.createStatement(); + ResultSet rs = statement.executeQuery(query)) { return Response.ok(transformToCsv(rs)).build(); } catch (Exception e) { final String message = e.getMessage();