Closed
Description
Currently i am trying run AdManager reports API RunSavedQuery example .throw a Null Exception.
Exception in thread "main" java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at java.util.Arrays$ArrayList.<init>(Arrays.java:3813)
at java.util.Arrays.asList(Arrays.java:3800)
at com.wps.education.utils.RunSavedQuery.runExample(RunSavedQuery.java:99)
at com.wps.education.utils.RunSavedQuery.main(RunSavedQuery.java:179)
near 99 line
// Create statement to retrieve the saved query.
StatementBuilder statementBuilder =
new StatementBuilder()
.where("id = :id")
.orderBy("id ASC")
.limit(1)
.withBindVariableValue("id", savedQueryId);
SavedQueryPage page = reportService.getSavedQueriesByStatement(statementBuilder.toStatement());
SavedQuery savedQuery = Iterables.getOnlyElement(Arrays.asList(page.getResults())); // line 99
if (!savedQuery.getIsCompatibleWithApiVersion()) {
throw new IllegalStateException("The saved query is not compatible with this API version.");
}
Debug found the page.getResults() is null on the line 99.
pom :
<dependency>
<groupId>com.google.api-ads</groupId>
<artifactId>ads-lib</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>com.google.api-ads</groupId>
<artifactId>dfp-axis</artifactId>
<version>RELEASE</version>
</dependency>
I set savedQueryId is 11772918516 in the https://www.google.com/admanager/21xxx76111#reports/report/detail/report_id=1177xx
I can see the result from the https://www.google.com/admanager/21xxx76111#reports/report/detail/report_id=1177xx
url when click on run
button on the web UI.
Did I set it up wrong?
Metadata
Metadata
Assignees
Labels
No labels