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