googleads / googleads/googleads-java-lib

Queries with no results return a null array

Open
#283 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
234
Forks
360
PR merge metrics
No merged PRs in 30d

Description

Hello!

This library allows you to query via StatementBuilder. When you run a query that returns no results, the XYPage#getResults() returns null. On my side, this has only been confirmed to be true with InventoryServiceInterface#getAdUnitsByStatement(), however it would be right to assume it is true for other query implementations as well.

Returning null arrays is an anti-pattern. Can this be fixed to return empty arrays instead? This has already been mentioned in #214.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with StatementBuilder and the InventoryServiceInterface#getAdUnitsByStatement() path, then review the related discussion in #214. Check how XYPage#getResults() is produced for empty query results across the other query implementations. Done means empty arrays are returned instead of null for every affected implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.