#fixed code
                              public List<String> getTables(String schema) throws SQLException {
    if (!tablesCache.isEmpty()){
      return tablesCache;
    }
    tablesCache.addAll(connection.getTables(schema));
    return tablesCache;
  }
#vulnerable code 
                              public List<String> getTables(String schema) throws SQLException {
    if (!tablesCache.isEmpty()){
      return tablesCache;
    }
    DbmsQueryResult queryResult = connection.executeQuery(syntax.getTableCommand(schema));
    JdbcResultSet jdbcQueryResult = new JdbcResultSet(queryResult);
    while (queryResult.next()) {
      tablesCache.add(jdbcQueryResult.getString(syntax.getTableNameColumnIndex()));
    }
    return tablesCache;
  } 
                            #location 3 
                            #vulnerability type RESOURCE_LEAK