requery / sqlite-android

Android SQLite support library
Apache License 2.0
1.06k stars 140 forks source link

SupportSQLiteDatabase.setMaxSqlCacheSize(0) throws IllegalArgumentException #99

Open benasher44 opened 5 years ago

benasher44 commented 5 years ago

Setting the maxSqlCacheSize to 0 is allowed according to the SupportSQLiteDatabase database docs and the bounds check here. However, setting 0 crashes the PreparedStatementCache because its parent class does not allow 0 as a value:

java.lang.IllegalArgumentException: maxSize <= 0
        at androidx.collection.LruCache.<init>(LruCache.java:53)
        at io.requery.android.database.sqlite.SQLiteConnection$PreparedStatementCache.<init>(SQLiteConnection.java:1334)
benasher44 commented 4 years ago

FWIW, Android has the same bug :/