IllegalArgumentException:索引 1 处的绑定值为 null

发布于 2024-10-10 01:39:04 字数 3146 浏览 3 评论 0原文

有人知道这意味着什么吗?

12-31 20:55:45.861: ERROR/AndroidRuntime(12478): Caused by: java.lang.IllegalArgumentException: the bind value at index 1 is null
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:234)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.database.sqlite.SQLiteQuery.bindString(SQLiteQuery.java:182)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:48)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1345)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:330)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:280)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.providers.ProductContentProvider.query(ProductContentProvider.java:350)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.content.ContentProvider$Transport.query(ContentProvider.java:163)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.content.ContentResolver.query(ContentResolver.java:245)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.providers.FacadeContentProvider.query(FacadeContentProvider.java:563)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.content.ContentProvider$Transport.query(ContentProvider.java:163)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.content.ContentResolver.query(ContentResolver.java:245)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.util.ScanAddTask.existsProduct(ScanAddTask.java:164)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.util.ScanAddTask.<init>(ScanAddTask.java:71)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.util.ItemScanAddTask.<init>(ItemScanAddTask.java:34)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.ui.activities.collections.cd.CDCollectionViewWindow$MusicCDItemScanAddTask.<init>(CDCollectionViewWindow.java:147)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.ui.activities.collections.cd.CDCollectionViewWindow.restoreLocalState(CDCollectionViewWindow.java:1044)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.ui.activities.collections.cd.CDCollectionViewWindow.onRestoreInstanceState(CDCollectionViewWindow.java:966)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.app.Activity.performRestoreInstanceState(Activity.java:815)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1096)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2641)

Does anybody know what this means?

12-31 20:55:45.861: ERROR/AndroidRuntime(12478): Caused by: java.lang.IllegalArgumentException: the bind value at index 1 is null
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:234)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.database.sqlite.SQLiteQuery.bindString(SQLiteQuery.java:182)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:48)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1345)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:330)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:280)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.providers.ProductContentProvider.query(ProductContentProvider.java:350)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.content.ContentProvider$Transport.query(ContentProvider.java:163)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.content.ContentResolver.query(ContentResolver.java:245)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.providers.FacadeContentProvider.query(FacadeContentProvider.java:563)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.content.ContentProvider$Transport.query(ContentProvider.java:163)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.content.ContentResolver.query(ContentResolver.java:245)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.util.ScanAddTask.existsProduct(ScanAddTask.java:164)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.util.ScanAddTask.<init>(ScanAddTask.java:71)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.util.ItemScanAddTask.<init>(ItemScanAddTask.java:34)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.ui.activities.collections.cd.CDCollectionViewWindow$MusicCDItemScanAddTask.<init>(CDCollectionViewWindow.java:147)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.ui.activities.collections.cd.CDCollectionViewWindow.restoreLocalState(CDCollectionViewWindow.java:1044)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at net.lp.collectionista.ui.activities.collections.cd.CDCollectionViewWindow.onRestoreInstanceState(CDCollectionViewWindow.java:966)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.app.Activity.performRestoreInstanceState(Activity.java:815)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1096)
12-31 20:55:45.861: ERROR/AndroidRuntime(12478):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2641)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

无人接听 2024-10-17 01:39:04

绑定值显然是指插入到query()中的选择的selectionArgs。如果这样的 selectionArgs 值为 null,您会得到这个。

The bind value apparently refers to the selectionArgs for the selection, that you insert into query(). If such a selectionArgs value is null, you get this.

作死小能手 2024-10-17 01:39:04

@Gray@pjv 响应是了解导致此错误的问题的关键。你必须小心选择和selectionArgs匹配,如果你传递selection = nullselectionArgs = some,你也会得到这个错误! :) 谢谢!

@Gray and @pjv response was the point for realize what problem caused this error. You have to be careful with selection and selectionArgs matching, if you pass selection = null and selectionArgs = something, you will get this error too! :) Thnks!

我只土不豪 2024-10-17 01:39:04

这与问题并不完全相关,但我面临着一个类似的问题,参数开头包含破折号(-)。这是导致问题的原因。

所以我这样逃避了争论,

return mDatabase.query(table_name,
                       null,
                       column_name + "=?",
                       new String[]{"\\" + argument},
                       null,
                       null,
                       null);

这为我解决了这个问题。

您还可以看到这个: 如何转义特殊字符,例如' 在 android 的 sqlite 中

This does not exactly relate to the question, but I was facing a similiar issue for me the argument containted a dash (-) at the beginning. This was causing the issue.

So I escaped the argument like this

return mDatabase.query(table_name,
                       null,
                       column_name + "=?",
                       new String[]{"\\" + argument},
                       null,
                       null,
                       null);

This solved it for me.

You can also see this : How to escape special characters like ' in sqlite in android

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文