问题描述
我正在编写代码以根据此处描述的内容提取所有位置的见解: https://developers.google.com/my-business/content/insight-data?hl=en 有时(并不总是)在运行代码时我有这个异常:
Exception in thread "main" java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2736)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3211)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:896)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:358)
at com.google.api.client.util.IoUtils.deserialize(IoUtils.java:171)
at com.google.api.client.util.store.FileDataStoreFactory$FileDataStore.<init>(FileDataStoreFactory.java:102)
at com.google.api.client.util.store.FileDataStoreFactory.createDataStore(FileDataStoreFactory.java:73)
at com.google.api.client.util.store.AbstractDataStoreFactory.getDataStore(AbstractDataStoreFactory.java:55)
at com.google.api.client.auth.oauth2.StoredCredential.getDefaultDataStore(StoredCredential.java:171)
at com.google.api.client.auth.oauth2.AuthorizationCodeFlow$Builder.setDataStoreFactory(AuthorizationCodeFlow.java:744)
at com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow$Builder.setDataStoreFactory(GoogleAuthorizationCodeFlow.java:209)
有谁知道我该如何解决这个问题?错误是否可能是因为我的帐户中有很多位置并且它向 GMB 发送了太多请求?
JSONObject jObj=new JSONObject();
ReportLocationInsightsRequest content = new ReportLocationInsightsRequest();
content.setFactory(JSON_FACTORY);
BasicmetricsRequest basicRequest = new BasicmetricsRequest();
content.setLocationNames(locationNamelist); // locationNamelist is provided prevIoUsely in another function
List<MetricRequest> metricRequests= new ArrayList<MetricRequest>();
MetricRequest metricR=new MetricRequest();
String metric="ALL";
metricR.setMetric(metric);
metricRequests.add(metricR);
timeRange.setStartTime(MyStartTime); // desired start time
timeRange.setEndTime(MyEndTime); // desired end time
basicRequest.setTimeRange(timeRange);
basicRequest.setMetricRequests(metricRequests);
content.setBasicRequest(basicRequest );
TimeRange timeRange=new TimeRange();
try {
MyBusiness.Accounts.Locations.ReportInsights locationReportInsight=
mybusiness.accounts().locations().reportInsights(accName,content);
ReportLocationInsightsResponse response= locationReportInsight.execute();
jObj=new JSONObject(response);
}catch(Exception e) {
System.out.println(" Exception "+ e);
}
提前致谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)