New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Batch requests should allow null callbacks #634
Comments
From yan...@google.com on October 01, 2012 18:53:55 Status: Accepted |
From rmis...@google.com on December 12, 2012 06:41:06 Labels: -Milestone-Version1.13.0 Milestone-Version1.14.0 |
From yan...@google.com on January 22, 2013 08:14:54 Labels: -Type-Defect -Milestone-Version1.14.0 Type-Enhancement Milestone-Version2.1.0 |
From yan...@google.com on February 06, 2013 16:05:10 Labels: -Milestone-Version2.1.0 Milestone-Version1.16.0 |
From yan...@google.com on June 10, 2013 06:29:23 Owner: pele...@google.com |
From yan...@google.com on June 21, 2013 07:06:17 Labels: -Milestone-Version1.16.0 Milestone-Version1.17.0 |
From pele...@google.com on July 28, 2013 23:08:22 Labels: -Milestone-Version1.17.0 Milestone-Version1.18.0 |
From yan...@google.com on September 27, 2013 05:03:13 Labels: -Milestone-Version1.18.0 |
From jasonhall@google.com on October 01, 2012 09:31:59
Version of google-api-java-client (e.g. 1.5.0-beta)? HEAD Java environment (e.g. Java 6, Android 2.3, App Engine)? App Engine Describe the problem. I'd like to perform a batch request, but I don't particularly care about the respective responses. I essentially want to "fire and forget" a series of API requests.
Currently I'm calling:
BatchRequest batch = compute.batch();
for (...) {
compute.instances().insert(...).queue(batch, null);
}
batch.execute();
This results in an NPE because of a Preconditions.checkNotNull check on the callback:
java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:193)
at com.google.api.client.googleapis.batch.BatchRequest.queue(BatchRequest.java:161)
at com.google.api.services.compute.Compute$Instances$Insert.queue(Compute.java:2642) How would you expect it to be fixed? Either remove the checkNotNull check, or provide another queue() method that doesn't take a callback. Ideally requests that don't configure a callback would also skip parsing of the response entirely, since nothing downstream requires any details of the response.
This would lead to clearer more succinct code than the current working alternative, which is to define a no-op JsonBatchCallback instance that does nothing.
Original issue: http://code.google.com/p/google-api-java-client/issues/detail?id=620
The text was updated successfully, but these errors were encountered: