IllegalArgumentException:尝试通过API下载Google Spreadsheet时设置外部cookie?

Bar*_*ani 5 google-docs google-sheets illegalargumentexception google-spreadsheet-api google-drive-api

我正在尝试使用下载API版本3(v3)下载Google电子表格.我在下载电子表格时收到"java.lang.IllegalArgumentException:尝试设置外部cookie"错误消息.我通过我的谷歌应用程序帐户尝试,该帐户通过2腿oauth身份验证过程进行身份验证.有没有人面临这种​​问题?

这是错误堆栈跟踪:

Servlet.service() for servlet action threw exception|java.lang.IllegalArgumentException: Trying to set foreign cookie
    at com.google.gdata.client.http.GoogleGDataRequest$GoogleCookie.<init>(GoogleGDataRequest.java:166)
    at com.google.gdata.client.http.GoogleGDataRequest$GoogleCookieHandler.put(GoogleGDataRequest.java:399)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:710)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1000)
    at sun.net.www.protocol.http.HttpURLConnection.getHeaderFields(HttpURLConnection.java:2053)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getHeaderFields(HttpsURLConnectionImpl.java:263)
    at com.google.gdata.client.http.HttpGDataRequest.isOAuthProxyErrorResponse(HttpGDataRequest.java:558)
    at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:549)
    at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530)
    at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)
Run Code Online (Sandbox Code Playgroud)

编辑:此问题仅在我们的用户的一个帐户中使用我们的应用程序.它适用于所有其他用户

edd*_*son 0

我这样获得服务:

        int GDATA_TIMEOUT = 10* 1000;   
        spreadsheetService = new SpreadsheetService("cellmaster.com.au-v0.2");

        spreadsheetService.setHeader("Authorization", "Bearer " + accessToken);

        spreadsheetService.setConnectTimeout(GDATA_TIMEOUT);
        spreadsheetService.setReadTimeout(GDATA_TIMEOUT);
Run Code Online (Sandbox Code Playgroud)

并包括一个重试循环,因为它偶尔会失败。