Version of google-api-java-client (e.g. 1.5.0-beta)?
1.12.0-beta
Java environment (e.g. Java 6, Android 2.3, App Engine)?
Any
Describe the problem.
Reported by a customer, when doing media upload to the Storage API, they are
getting this NullPointerException:
java.lang.NullPointerException
at java.net.URI$Parser.parse(URI.java:3023)
at java.net.URI.<init>(URI.java:595)
at com.google.api.client.http.GenericUrl.<init>(GenericUrl.java:100)
at com.google.api.client.googleapis.media.MediaHttpUploader.upload(MediaHttpUploader.java:269)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:572)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:492)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:621)
Doing another kind of request to the same API with the same authorization
information results in this error:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
"code" : 403,
"errors" : [ {
"domain" : "usageLimits",
"message" : "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
"reason" : "dailyLimitExceededUnreg",
"extendedHelp" : "https://code.google.com/apis/console",
}]}
So most likely the upload initiation results in a 403 error as well. The
NullPointerException is being thrown on this line in MediaHttpUploader:
uploadUrl = new GenericUrl(initialResponse.getHeaders().getLocation());
How would you expect it to be fixed?
Instead of throwing a NullPointerException, we should just return the
HttpResponse on !initialResponse.isSuccessStatusCode().
Original issue reported on code.google.com by yan...@google.com on 3 Dec 2012 at 7:23
Original issue reported on code.google.com by
yan...@google.com
on 3 Dec 2012 at 7:23