我正在尝试使用下载 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)
编辑:此问题仅发生在使用我们应用程序的一个用户帐户中。对于所有其他用户来说它工作正常
最佳答案
我遇到了同样的问题,并通过更改网址解决了它。
我直接从 GDrive 获取的 URL:
https://docs.google.com/spreadsheets/d/19Du6mgmzP94vxxHK5httgfK4dqgycQkBBLDq_6I5J7o/edit#gid=1472457471
必须将上面的内容修改为:
https://spreadsheets.google.com/feeds/spreadsheets/**19Du6mgmzP94vxxHK5httgfK4dqgycQkBBLDq_6I5J7o
希望这会对某人有所帮助。
关于google-sheets - 非法参数异常 : Trying to set foreign cookie while downloading Google Spreadsheet via API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22321873/