code: public List<JSONObject> queryJava(String queryString, boolean getPatchSets, boolean getCurrentPatchSet,
                                        boolean getFiles, boolean getCommitMessage, boolean getComments)
              throws SshException, IOException, GerritQueryException {
  
          final List<JSONObject> list = new LinkedList<JSONObject>();
  
          runQuery(queryString, getPatchSets, getCurrentPatchSet, getFiles, getCommitMessage, getComments,
                  new LineVisitor() {
                      @Override
                      public void visit(String line) throws GerritQueryException {
                          JSONObject json = (JSONObject)JSONSerializer.toJSON(line.trim());
                          if (json.has("type") && "error".equalsIgnoreCase(json.getString("type"))) {
                              throw new GerritQueryException(json.getString("message"));
                          }
                          list.add(json);
                      }
                  });
          return list;
      }
docs: Runs the query and returns the result as a list of Java JSONObjects.
  @param queryString the query.
  @param getPatchSets getPatchSets if all patch-sets of the projects found should be included in the result.
  Meaning if --patch-sets should be appended to the command call.
  @param getCurrentPatchSet if the current patch-set for the projects found should be included in the result.
  Meaning if --current-patch-set should be appended to the command call.
  @param getFiles if the files of the patch sets should be included in the result.
  Meaning if --files should be appended to the command call.
  @param getCommitMessage if full commit message should be included in the result.
  Meaning if --commit-message should be appended to the command call.
  @param getComments if patchset comments should be included in the results.
  Meaning if --comments should be appended to the command call.
  
  @return the query result as a List of JSONObjects.
  @throws GerritQueryException if Gerrit reports an error with the query.
  @throws SshException if there is an error in the SSH Connection.
  @throws IOException for some other IO problem.