Hi,

I am following the tutorial [1] to get access to the GA account report data
by executing a simple GA query, by using the Google Developers console.
I followed all steps mentioned in the tutorial and the code works fine.

I get an error when I access the same GA account report data by giving the
credential (Client secret and Id) of another user who also has shared
access to that report data.
I am successfully able to access the report data using the other users
credentials If I have already run the java application using my credentials
first. But If I run the app with the other users credentials first, then I
get the following error.

The Stack trace is shown below.

Exception in thread "main" java.lang.NullPointerException
at
com.google.api.client.repackaged.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:191)
at
com.google.api.client.util.Preconditions.checkNotNull(Preconditions.java:127)
at
com.google.api.client.json.jackson2.JacksonFactory.createJsonParser(JacksonFactory.java:92)
at
com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:85)
at
com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:81)
at
com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:88)
at
com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:287)
at
com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:307)
at
com.google.api.client.auth.oauth2.Credential.executeRefreshToken(Credential.java:570)
at
com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:489)
at
com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:217)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:859)
at
com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
at
com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
at
com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
at
org.wso2.dashboard.access.data.GoogleAnalyticsAccess.getGAAccountId(GoogleAnalyticsAccess.java:66)
at
org.wso2.dashboard.access.data.GoogleAnalyticsAccess.getNoOfUsersPerRegion(GoogleAnalyticsAccess.java:164)
at
org.wso2.dashboard.access.data.GoogleAnalyticsAccess.main(GoogleAnalyticsAccess.java:213)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

This seems to be a well known issue according to the link [2].

Has anyone encountered this before and have knowledge of a work around. Any
clarification on this issue is very much appreciated.

Thanks.

[1]
https://developers.google.com/analytics/solutions/articles/hello-analytics-api

[2] https://github.com/google/google-api-java-client/issues/904
-- 
Sabra Ossen
*Software Engineering Intern*
Mobile : +94 (0) 785 227 769
[email protected]
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to