gpt4 book ai didi

Android 解析抛出 IllegalStateException。需要调试指导

转载 作者:太空狗 更新时间:2023-10-29 14:45:31 36 4
gpt4 key购买 nike

我正在为后端使用 Parse 开发一个 Android 应用程序。一切正常,直到出现奇怪的崩溃。我在下面粘贴了堆栈跟踪。谁能帮忙看看真正的原因是什么?我的研究表明这是因为数据库列中的大字符串。但是从一开始我的 ParseObject 中就有很大的字符串,没有任何问题。

代码:

private HashMap getFormResponsesMap() {
HashMap<String, FormResponse> formResponsesMap = new HashMap<>();
ParseQuery<FormResponse> query = FormResponse.getQuery();
query.fromPin(Application.FORM_RESPONSE_GROUP_NAME);
query.whereEqualTo("surveyor", ParseUser.getCurrentUser());
query.fromLocalDatastore();
try {
List<FormResponse> objects = query.find(); //exception is thrown here.
for (FormResponse response : objects) {
formResponsesMap.put(response.getUuidString(), response);
}
} catch (ParseException e) {
e.printStackTrace();
}
return formResponsesMap;
}

堆栈跟踪:

11-24 22:36:45.913 22779-23746/com.myapp.qa E/AndroidRuntime: FATAL EXCEPTION: Thread-26505
Process: com.myapp.qa, PID: 22779
java.lang.IllegalStateException: Couldn't read row 0, col 0 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
at android.database.CursorWindow.nativeGetString(Native Method)
at android.database.CursorWindow.getString(CursorWindow.java:434)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)
at com.parse.OfflineStore$9.then(OfflineStore.java:607)
at com.parse.OfflineStore$9.then(OfflineStore.java:590)
at bolts.Task$14.run(Task.java:872)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeImmediately(Task.java:863)
at bolts.Task.continueWith(Task.java:661)
at bolts.Task.continueWith(Task.java:672)
at bolts.Task$12.then(Task.java:766)
at bolts.Task$12.then(Task.java:754)
at bolts.Task$15.run(Task.java:917)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeAfterTask(Task.java:908)
at bolts.Task.access$100(Task.java:32)
at bolts.Task$11.then(Task.java:708)
at bolts.Task$11.then(Task.java:705)
at bolts.Task.runContinuations(Task.java:956)
at bolts.Task.trySetResult(Task.java:994)
at bolts.TaskCompletionSource.trySetResult(TaskCompletionSource.java:39)
at bolts.TaskCompletionSource.setResult(TaskCompletionSource.java:62)
at bolts.Task$15$1.then(Task.java:934)
at bolts.Task$15$1.then(Task.java:921)
at bolts.Task$14.run(Task.java:872)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeImmediately(Task.java:863)
at bolts.Task.continueWith(Task.java:661)
at bolts.Task.continueWith(Task.java:672)
at bolts.Task$15.run(Task.java:921)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)

最佳答案

现在回答这个问题为时已晚,但对于 future 的读者来说,发生这种情况的原因之一是当您尝试从游标访问该列不存在的列的值时。这意味着表名或列名不正确。

关于Android 解析抛出 IllegalStateException。需要调试指导,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40791928/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com