我遇到了一个奇怪的问题,但使用 DropBox 是我上周没有遇到的。我创建了一个简单的 Java 控制台应用程序来从 DropBox 中提取文件然后在本地存储,这可以正常工作,但由于某种原因它现在失败了。正在从文件中读取 AccessToken 和 UserID。
MyDBAccessToken = params.get(0);
MyDBUserID = params.get(1);
MyDBUrlState = null;
DbxAuthFinish authToken = new DbxAuthFinish(MyDBAccessToken, MyDBUserID, MyDBUrlState);
DbxRequestConfig config = new DbxRequestConfig( "JavaTutorial/1.0", Locale.getDefault().toString());
DbxClient MyDBClient = new DbxClient(config, authToken.accessToken);
System.out.println("Linked to DropBox account: " + MyDBClient.getAccountInfo().displayName + " ID " + MyDBClient.getAccountInfo().userId);
这是我的堆栈跟踪
Exception in thread "main" java.lang.AssertionError: bad index: -1, field = "datastores"
at com.dropbox.core.DbxAccountInfo$Quota$1.read(DbxAccountInfo.java:91)
at com.dropbox.core.DbxAccountInfo$Quota$1.read(DbxAccountInfo.java:66)
at com.dropbox.core.json.JsonReader.readField(JsonReader.java:26)
at com.dropbox.core.DbxAccountInfo$1.read(DbxAccountInfo.java:152)
at com.dropbox.core.DbxAccountInfo$1.read(DbxAccountInfo.java:128)
at com.dropbox.core.json.JsonReader.readFully(JsonReader.java:349)
at com.dropbox.core.json.JsonReader.readFully(JsonReader.java:238)
at com.dropbox.core.DbxRequestUtil.readJsonFromResponse(DbxRequestUtil.java:218)
at com.dropbox.core.DbxClient$4.handle(DbxClient.java:275)
at com.dropbox.core.DbxClient$4.handle(DbxClient.java:270)
at com.dropbox.core.DbxRequestUtil.doGet(DbxRequestUtil.java:269)
at com.dropbox.core.DbxClient.doGet(DbxClient.java:1804)
at com.dropbox.core.DbxClient.getAccountInfo(DbxClient.java:270)