1

I'm working on Android Library. I was writing a JUnit test, using Roboletric, for testing SQLite code and I received the following error.

Cannot prepare statement, base error code: -92

The stack trace is:

android.database.sqlite.SQLiteException: Cannot prepare statement, base error code: -92
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.getSqliteException(ShadowSQLiteConnection.java:495)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.execute(ShadowSQLiteConnection.java:464)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.prepareStatement(ShadowSQLiteConnection.java:388)
    at org.robolectric.shadows.ShadowSQLiteConnection.nativePrepareStatement(ShadowSQLiteConnection.java:79)
    at android.database.sqlite.SQLiteConnection.nativePrepareStatement(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:882)
    at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:493)
    at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
    at android.database.sqlite.SQLiteProgram.__constructor__(SQLiteProgram.java:58)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java)
    at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java)
    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
    at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1253)
    at sqlite.feature.livedata.persistence.DaoPersonImpl.selectForLiveData(DaoPersonImpl.java:89)
    at sqlite.feature.livedata.persistence.DaoPersonImpl$1$1.onExecute(DaoPersonImpl.java:153)
    at sqlite.feature.livedata.persistence.DaoPersonImpl$1$1.onExecute(DaoPersonImpl.java:1)
    at sqlite.feature.livedata.persistence.BindAppDataSource.executeBatch(BindAppDataSource.java:452)
    at sqlite.feature.livedata.persistence.BindAppDataSource.executeBatch(BindAppDataSource.java:434)
    at sqlite.feature.livedata.persistence.DaoPersonImpl$1.compute(DaoPersonImpl.java:150)
    at sqlite.feature.livedata.persistence.DaoPersonImpl$1.compute(DaoPersonImpl.java:1)
    at com.abubusoft.kripton.android.sqlite.livedata.KriptonComputableLiveData$2.run(KriptonComputableLiveData.java:84)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: com.almworks.sqlite4java.SQLiteException: [-92] DB[2] is not confined or already disposed
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:188)
    at com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly(Uninterruptibles.java:143)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.execute(ShadowSQLiteConnection.java:459)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.prepareStatement(ShadowSQLiteConnection.java:388)
    at org.robolectric.shadows.ShadowSQLiteConnection.nativePrepareStatement(ShadowSQLiteConnection.java:79)
    at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.robolectric.internal.bytecode.ShadowWrangler$ShadowMethodPlan.run(ShadowWrangler.java:520)
    at android.database.sqlite.SQLiteConnection.nativePrepareStatement(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.$$robo$$acquirePreparedStatement(SQLiteConnection.java:882)
    at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.$$robo$$prepare(SQLiteConnection.java:493)
    at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java)
    at android.database.sqlite.SQLiteSession.$$robo$$prepare(SQLiteSession.java:588)
    at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java)
    at android.database.sqlite.SQLiteProgram.$$robo$$__constructor__(SQLiteProgram.java:58)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java)
    at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java)
    at android.database.sqlite.SQLiteDirectCursorDriver.$$robo$$query(SQLiteDirectCursorDriver.java:44)
    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java)
    at android.database.sqlite.SQLiteDatabase.$$robo$$rawQueryWithFactory(SQLiteDatabase.java:1314)
    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java)
    at android.database.sqlite.SQLiteDatabase.$$robo$$rawQuery(SQLiteDatabase.java:1253)
    at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java)
    ... 11 more
Caused by: com.almworks.sqlite4java.SQLiteException: [-92] DB[2] is not confined or already disposed
    at com.almworks.sqlite4java.SQLiteConnection.checkThread(SQLiteConnection.java:1386)
    at com.almworks.sqlite4java.SQLiteConnection.prepare(SQLiteConnection.java:451)
    at com.almworks.sqlite4java.SQLiteConnection.prepare(SQLiteConnection.java:542)
    at com.almworks.sqlite4java.SQLiteConnection.prepare(SQLiteConnection.java:529)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections$2.call(ShadowSQLiteConnection.java:392)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections$2.call(ShadowSQLiteConnection.java:388)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    ... 3 more
E/SQLiteConnectionPool: Failed to close connection, its fate is now in the hands of the merciful GC: SQLiteConnection: C:\Users\xcesco\AppData\Local\Temp\android-tmp-robolectric7009569461516564350\databases\app.db (1)
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Statement 29 [SELECT locale FROM android_metadata UNION SELECT NULL ORDER BY locale DESC LIMIT 1]DB[2][C][D] is disposed
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.execute(ShadowSQLiteConnection.java:469)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.finalizeStmt(ShadowSQLiteConnection.java:431)
    at org.robolectric.shadows.ShadowSQLiteConnection.nativeFinalizeStatement(ShadowSQLiteConnection.java:102)
    at android.database.sqlite.SQLiteConnection.nativeFinalizeStatement(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.finalizePreparedStatement(SQLiteConnection.java:928)
    at android.database.sqlite.SQLiteConnection.access$200(SQLiteConnection.java:87)
    at android.database.sqlite.SQLiteConnection$PreparedStatementCache.entryRemoved(SQLiteConnection.java:1253)
    at android.database.sqlite.SQLiteConnection$PreparedStatementCache.entryRemoved(SQLiteConnection.java:1242)
    at android.util.LruCache.trimToSize(LruCache.java:218)
    at android.util.LruCache.evictAll(LruCache.java:306)
    at android.database.sqlite.SQLiteConnection.dispose(SQLiteConnection.java:232)
    at android.database.sqlite.SQLiteConnection.close(SQLiteConnection.java:205)
    at android.database.sqlite.SQLiteConnectionPool.closeConnectionAndLogExceptionsLocked(SQLiteConnectionPool.java:528)
    at android.database.sqlite.SQLiteConnectionPool.closeAvailableNonPrimaryConnectionsAndLogExceptionsLocked(SQLiteConnectionPool.java:510)
    at android.database.sqlite.SQLiteConnectionPool.closeAvailableConnectionsAndLogExceptionsLocked(SQLiteConnectionPool.java:498)
    at android.database.sqlite.SQLiteConnectionPool.dispose(SQLiteConnectionPool.java:226)
    at android.database.sqlite.SQLiteConnectionPool.close(SQLiteConnectionPool.java:205)
    at android.database.sqlite.SQLiteDatabase.dispose(SQLiteDatabase.java:295)
    at android.database.sqlite.SQLiteDatabase.onAllReferencesReleased(SQLiteDatabase.java:272)
    at android.database.sqlite.SQLiteClosable.releaseReference(SQLiteClosable.java:74)
    at android.database.sqlite.SQLiteClosable.close(SQLiteClosable.java:106)
    at com.abubusoft.kripton.android.sqlite.AbstractDataSource.close(AbstractDataSource.java:249)
    at sqlite.feature.livedata.persistence.BindAppDataSource.executeBatch(BindAppDataSource.java:459)
    at sqlite.feature.livedata.persistence.BindAppDataSource.executeBatch(BindAppDataSource.java:434)
    at sqlite.feature.livedata.persistence.DaoPersonImpl$1.compute(DaoPersonImpl.java:150)
    at sqlite.feature.livedata.persistence.DaoPersonImpl$1.compute(DaoPersonImpl.java:1)
    at com.abubusoft.kripton.android.sqlite.livedata.KriptonComputableLiveData$2.run(KriptonComputableLiveData.java:84)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Statement 29 [SELECT locale FROM android_metadata UNION SELECT NULL ORDER BY locale DESC LIMIT 1]DB[2][C][D] is disposed
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:188)
    at com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly(Uninterruptibles.java:143)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.execute(ShadowSQLiteConnection.java:459)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.finalizeStmt(ShadowSQLiteConnection.java:431)
    at org.robolectric.shadows.ShadowSQLiteConnection.nativeFinalizeStatement(ShadowSQLiteConnection.java:102)
    at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.robolectric.internal.bytecode.ShadowWrangler$ShadowMethodPlan.run(ShadowWrangler.java:520)
    at android.database.sqlite.SQLiteConnection.nativeFinalizeStatement(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.$$robo$$finalizePreparedStatement(SQLiteConnection.java:928)
    at android.database.sqlite.SQLiteConnection.finalizePreparedStatement(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.access$200(SQLiteConnection.java:87)
    at android.database.sqlite.SQLiteConnection$PreparedStatementCache.$$robo$$entryRemoved(SQLiteConnection.java:1253)
    at android.database.sqlite.SQLiteConnection$PreparedStatementCache.entryRemoved(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection$PreparedStatementCache.entryRemoved(SQLiteConnection.java:1242)
    at android.util.LruCache.$$robo$$trimToSize(LruCache.java:218)
    at android.util.LruCache.trimToSize(LruCache.java)
    at android.util.LruCache.$$robo$$evictAll(LruCache.java:306)
    at android.util.LruCache.evictAll(LruCache.java)
    at android.database.sqlite.SQLiteConnection.$$robo$$dispose(SQLiteConnection.java:232)
    at android.database.sqlite.SQLiteConnection.dispose(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.$$robo$$close(SQLiteConnection.java:205)
    at android.database.sqlite.SQLiteConnection.close(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnectionPool.$$robo$$closeConnectionAndLogExceptionsLocked(SQLiteConnectionPool.java:528)
    at android.database.sqlite.SQLiteConnectionPool.closeConnectionAndLogExceptionsLocked(SQLiteConnectionPool.java)
    at android.database.sqlite.SQLiteConnectionPool.$$robo$$closeAvailableNonPrimaryConnectionsAndLogExceptionsLocked(SQLiteConnectionPool.java:510)
    at android.database.sqlite.SQLiteConnectionPool.closeAvailableNonPrimaryConnectionsAndLogExceptionsLocked(SQLiteConnectionPool.java)
    at android.database.sqlite.SQLiteConnectionPool.$$robo$$closeAvailableConnectionsAndLogExceptionsLocked(SQLiteConnectionPool.java:498)
    at android.database.sqlite.SQLiteConnectionPool.closeAvailableConnectionsAndLogExceptionsLocked(SQLiteConnectionPool.java)
    at android.database.sqlite.SQLiteConnectionPool.$$robo$$dispose(SQLiteConnectionPool.java:226)
    at android.database.sqlite.SQLiteConnectionPool.dispose(SQLiteConnectionPool.java)
    at android.database.sqlite.SQLiteConnectionPool.$$robo$$close(SQLiteConnectionPool.java:205)
    at android.database.sqlite.SQLiteConnectionPool.close(SQLiteConnectionPool.java)
    at android.database.sqlite.SQLiteDatabase.$$robo$$dispose(SQLiteDatabase.java:295)
    at android.database.sqlite.SQLiteDatabase.dispose(SQLiteDatabase.java)
    at android.database.sqlite.SQLiteDatabase.$$robo$$onAllReferencesReleased(SQLiteDatabase.java:272)
    at android.database.sqlite.SQLiteDatabase.onAllReferencesReleased(SQLiteDatabase.java)
    at android.database.sqlite.SQLiteClosable.$$robo$$releaseReference(SQLiteClosable.java:74)
    at android.database.sqlite.SQLiteClosable.releaseReference(SQLiteClosable.java)
    at android.database.sqlite.SQLiteClosable.$$robo$$close(SQLiteClosable.java:106)
    at android.database.sqlite.SQLiteClosable.close(SQLiteClosable.java)
    ... 9 more
Caused by: java.lang.IllegalStateException: Statement 29 [SELECT locale FROM android_metadata UNION SELECT NULL ORDER BY locale DESC LIMIT 1]DB[2][C][D] is disposed
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.getStatement(ShadowSQLiteConnection.java:359)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections$4.call(ShadowSQLiteConnection.java:434)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    ... 3 more
E/SQLiteConnectionPool: Failed to close connection, its fate is now in the hands of the merciful GC: SQLiteConnection: C:\Users\xcesco\AppData\Local\Temp\android-tmp-robolectric7009569461516564350\databases\app.db (0)
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Illegal connection pointer 1. Current pointers for thread Thread[pool-4-thread-1,5,main] []
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.execute(ShadowSQLiteConnection.java:469)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.finalizeStmt(ShadowSQLiteConnection.java:431)
    at org.robolectric.shadows.ShadowSQLiteConnection.nativeFinalizeStatement(ShadowSQLiteConnection.java:102)
    at android.database.sqlite.SQLiteConnection.nativeFinalizeStatement(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.finalizePreparedStatement(SQLiteConnection.java:928)
    at android.database.sqlite.SQLiteConnection.access$200(SQLiteConnection.java:87)
    at android.database.sqlite.SQLiteConnection$PreparedStatementCache.entryRemoved(SQLiteConnection.java:1253)
    at android.database.sqlite.SQLiteConnection$PreparedStatementCache.entryRemoved(SQLiteConnection.java:1242)
    at android.util.LruCache.trimToSize(LruCache.java:218)
    at android.util.LruCache.evictAll(LruCache.java:306)
    at android.database.sqlite.SQLiteConnection.dispose(SQLiteConnection.java:232)
    at android.database.sqlite.SQLiteConnection.close(SQLiteConnection.java:205)
    at android.database.sqlite.SQLiteConnectionPool.closeConnectionAndLogExceptionsLocked(SQLiteConnectionPool.java:528)
    at android.database.sqlite.SQLiteConnectionPool.closeAvailableConnectionsAndLogExceptionsLocked(SQLiteConnectionPool.java:501)
    at android.database.sqlite.SQLiteConnectionPool.dispose(SQLiteConnectionPool.java:226)
    at android.database.sqlite.SQLiteConnectionPool.close(SQLiteConnectionPool.java:205)
    at android.database.sqlite.SQLiteDatabase.dispose(SQLiteDatabase.java:295)
    at android.database.sqlite.SQLiteDatabase.onAllReferencesReleased(SQLiteDatabase.java:272)
    at android.database.sqlite.SQLiteClosable.releaseReference(SQLiteClosable.java:74)
    at android.database.sqlite.SQLiteClosable.close(SQLiteClosable.java:106)
    at com.abubusoft.kripton.android.sqlite.AbstractDataSource.close(AbstractDataSource.java:249)
    at sqlite.feature.livedata.persistence.BindAppDataSource.executeBatch(BindAppDataSource.java:459)
    at sqlite.feature.livedata.persistence.BindAppDataSource.executeBatch(BindAppDataSource.java:434)
    at sqlite.feature.livedata.persistence.DaoPersonImpl$1.compute(DaoPersonImpl.java:150)
    at sqlite.feature.livedata.persistence.DaoPersonImpl$1.compute(DaoPersonImpl.java:1)
    at com.abubusoft.kripton.android.sqlite.livedata.KriptonComputableLiveData$2.run(KriptonComputableLiveData.java:84)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Illegal connection pointer 1. Current pointers for thread Thread[pool-4-thread-1,5,main] []
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:188)
    at com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly(Uninterruptibles.java:143)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.execute(ShadowSQLiteConnection.java:459)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.finalizeStmt(ShadowSQLiteConnection.java:431)
    at org.robolectric.shadows.ShadowSQLiteConnection.nativeFinalizeStatement(ShadowSQLiteConnection.java:102)
    at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.robolectric.internal.bytecode.ShadowWrangler$ShadowMethodPlan.run(ShadowWrangler.java:520)
    at android.database.sqlite.SQLiteConnection.nativeFinalizeStatement(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.$$robo$$finalizePreparedStatement(SQLiteConnection.java:928)
    at android.database.sqlite.SQLiteConnection.finalizePreparedStatement(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.access$200(SQLiteConnection.java:87)
    at android.database.sqlite.SQLiteConnection$PreparedStatementCache.$$robo$$entryRemoved(SQLiteConnection.java:1253)
    at android.database.sqlite.SQLiteConnection$PreparedStatementCache.entryRemoved(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection$PreparedStatementCache.entryRemoved(SQLiteConnection.java:1242)
    at android.util.LruCache.$$robo$$trimToSize(LruCache.java:218)
    at android.util.LruCache.trimToSize(LruCache.java)
    at android.util.LruCache.$$robo$$evictAll(LruCache.java:306)
    at android.util.LruCache.evictAll(LruCache.java)
    at android.database.sqlite.SQLiteConnection.$$robo$$dispose(SQLiteConnection.java:232)
    at android.database.sqlite.SQLiteConnection.dispose(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.$$robo$$close(SQLiteConnection.java:205)
    at android.database.sqlite.SQLiteConnection.close(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnectionPool.$$robo$$closeConnectionAndLogExceptionsLocked(SQLiteConnectionPool.java:528)
    at android.database.sqlite.SQLiteConnectionPool.closeConnectionAndLogExceptionsLocked(SQLiteConnectionPool.java)
    at android.database.sqlite.SQLiteConnectionPool.$$robo$$closeAvailableConnectionsAndLogExceptionsLocked(SQLiteConnectionPool.java:501)
    at android.database.sqlite.SQLiteConnectionPool.closeAvailableConnectionsAndLogExceptionsLocked(SQLiteConnectionPool.java)
    at android.database.sqlite.SQLiteConnectionPool.$$robo$$dispose(SQLiteConnectionPool.java:226)
    at android.database.sqlite.SQLiteConnectionPool.dispose(SQLiteConnectionPool.java)
    at android.database.sqlite.SQLiteConnectionPool.$$robo$$close(SQLiteConnectionPool.java:205)
    at android.database.sqlite.SQLiteConnectionPool.close(SQLiteConnectionPool.java)
    at android.database.sqlite.SQLiteDatabase.$$robo$$dispose(SQLiteDatabase.java:295)
    at android.database.sqlite.SQLiteDatabase.dispose(SQLiteDatabase.java)
    at android.database.sqlite.SQLiteDatabase.$$robo$$onAllReferencesReleased(SQLiteDatabase.java:272)
    at android.database.sqlite.SQLiteDatabase.onAllReferencesReleased(SQLiteDatabase.java)
    at android.database.sqlite.SQLiteClosable.$$robo$$releaseReference(SQLiteClosable.java:74)
    at android.database.sqlite.SQLiteClosable.releaseReference(SQLiteClosable.java)
    at android.database.sqlite.SQLiteClosable.$$robo$$close(SQLiteClosable.java:106)
    at android.database.sqlite.SQLiteClosable.close(SQLiteClosable.java)
    ... 9 more
Caused by: java.lang.IllegalStateException: Illegal connection pointer 1. Current pointers for thread Thread[pool-4-thread-1,5,main] []
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.getConnection(ShadowSQLiteConnection.java:345)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.getStatement(ShadowSQLiteConnection.java:352)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections$4.call(ShadowSQLiteConnection.java:434)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    ... 3 more
I/BindAppDataSource, executeBatch (line 459): database CLOSED (READ_ONLY_OPENED) (connections: 0)
Exception in thread "pool-3-thread-1" android.database.sqlite.SQLiteException: Cannot prepare statement, base error code: -92
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.getSqliteException(ShadowSQLiteConnection.java:495)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.execute(ShadowSQLiteConnection.java:464)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.prepareStatement(ShadowSQLiteConnection.java:388)
    at org.robolectric.shadows.ShadowSQLiteConnection.nativePrepareStatement(ShadowSQLiteConnection.java:79)
    at android.database.sqlite.SQLiteConnection.nativePrepareStatement(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:882)
    at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:493)
    at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
    at android.database.sqlite.SQLiteProgram.__constructor__(SQLiteProgram.java:58)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java)
    at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java)
    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
    at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1253)
    at sqlite.feature.livedata.persistence.DaoPersonImpl.selectForLiveData(DaoPersonImpl.java:89)
    at sqlite.feature.livedata.persistence.DaoPersonImpl$1$1.onExecute(DaoPersonImpl.java:153)
    at sqlite.feature.livedata.persistence.DaoPersonImpl$1$1.onExecute(DaoPersonImpl.java:1)
    at sqlite.feature.livedata.persistence.BindAppDataSource.executeBatch(BindAppDataSource.java:452)
    at sqlite.feature.livedata.persistence.BindAppDataSource.executeBatch(BindAppDataSource.java:434)
    at sqlite.feature.livedata.persistence.DaoPersonImpl$1.compute(DaoPersonImpl.java:150)
    at sqlite.feature.livedata.persistence.DaoPersonImpl$1.compute(DaoPersonImpl.java:1)
    at com.abubusoft.kripton.android.sqlite.livedata.KriptonComputableLiveData$2.run(KriptonComputableLiveData.java:84)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: com.almworks.sqlite4java.SQLiteException: [-92] DB[2] is not confined or already disposed
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:188)
    at com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly(Uninterruptibles.java:143)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.execute(ShadowSQLiteConnection.java:459)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections.prepareStatement(ShadowSQLiteConnection.java:388)
    at org.robolectric.shadows.ShadowSQLiteConnection.nativePrepareStatement(ShadowSQLiteConnection.java:79)
    at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.robolectric.internal.bytecode.ShadowWrangler$ShadowMethodPlan.run(ShadowWrangler.java:520)
    at android.database.sqlite.SQLiteConnection.nativePrepareStatement(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.$$robo$$acquirePreparedStatement(SQLiteConnection.java:882)
    at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.$$robo$$prepare(SQLiteConnection.java:493)
    at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java)
    at android.database.sqlite.SQLiteSession.$$robo$$prepare(SQLiteSession.java:588)
    at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java)
    at android.database.sqlite.SQLiteProgram.$$robo$$__constructor__(SQLiteProgram.java:58)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java)
    at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java)
    at android.database.sqlite.SQLiteDirectCursorDriver.$$robo$$query(SQLiteDirectCursorDriver.java:44)
    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java)
    at android.database.sqlite.SQLiteDatabase.$$robo$$rawQueryWithFactory(SQLiteDatabase.java:1314)
    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java)
    at android.database.sqlite.SQLiteDatabase.$$robo$$rawQuery(SQLiteDatabase.java:1253)
    at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java)
    ... 11 more
Caused by: com.almworks.sqlite4java.SQLiteException: [-92] DB[2] is not confined or already disposed
    at com.almworks.sqlite4java.SQLiteConnection.checkThread(SQLiteConnection.java:1386)
    at com.almworks.sqlite4java.SQLiteConnection.prepare(SQLiteConnection.java:451)
    at com.almworks.sqlite4java.SQLiteConnection.prepare(SQLiteConnection.java:542)
    at com.almworks.sqlite4java.SQLiteConnection.prepare(SQLiteConnection.java:529)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections$2.call(ShadowSQLiteConnection.java:392)
    at org.robolectric.shadows.ShadowSQLiteConnection$Connections$2.call(ShadowSQLiteConnection.java:388)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    ... 3 more

What does it mean?

xcesco
  • 4,690
  • 4
  • 34
  • 65
  • 1
    https://stackoverflow.com/questions/41848392/always-get-thread-error-even-if-unit-test-passes-in-android-using-mockito#42077520 – DataDino Mar 28 '18 at 23:19
  • Also, It looks like you might have cut off the exception log because yours didn't include the "Caused by" section. You should avoid that in the future. – DataDino Mar 28 '18 at 23:31
  • Thanks for you contribute. I updated log. – xcesco Mar 28 '18 at 23:49

0 Answers0