Skip to content

Commit 659f7c4

Browse files
author
DvirDukhan
committed
changed try resource block
1 parent ca8d001 commit 659f7c4

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/main/java/com/redislabs/redisgraph/RedisGraph.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,9 @@ public ResultSet query(String graphId, String query, Object ...args) {
8989
query = String.format(query, args);
9090
}
9191
graphCaches.putIfAbsent(graphId, new GraphCache(graphId, this));
92-
Jedis conn = null;
9392
List<Object> rawResponse = new ArrayList<Object>();
94-
try {
95-
conn = getConnection();
93+
try(Jedis conn = getConnection();){
9694
rawResponse= sendCompactCommand(conn, Command.QUERY, graphId, query).getObjectMultiBulkReply();
97-
conn.close();
98-
99-
} catch (Exception e) {
100-
e.printStackTrace();
101-
if(conn != null && conn.isConnected()){
102-
conn.close();
103-
throw e;
104-
}
10595
}
10696
return new ResultSetImpl(rawResponse, graphCaches.get(graphId));
10797

0 commit comments

Comments
 (0)