Closed allenhsu-17live closed 2 years ago
Hi @allenhsu-17live
From your stack trace it appears the exception is thrown from the call to database.beginTransaction();
, specifically here. Have you tried to create a new test case within the SQLCipher for Android test suite that showcases the behavior? Renaming the exception that is thrown doesn't resolve the root issue you're experiencing from what I can see.
Him @developernotes
I can't , because the report from online.
But I think we should consider use android.database.sqlite
exception to replace all. right?
and even cause in this line database.beginTransaction();
I wrote the mock to test
try {
try {
beginTransactionMock()
} finally {
closeLockMoc()
}
} catch (e: SQLException) {
print("dosomething")
//dosomething
}
fun beginTransactionMock() {
throw SQLException("beginTransactionMock")
}
fun closeLockMoc() {
// throw SQLException("closeLockMoc")
}
The outermost try catch will still catch the error. will print dosomething
but if you use different packageNam
try {
try {
beginTransactionMock()
} finally {
closeLockMoc()
}
} catch (e: SQLException) {
print("dosomething")
//dosomething
}
fun beginTransactionMock() {
throw mock.SQLException("beginTransactionMock")
}
fun closeLockMoc() {
// throw mock.SQLException("closeLockMoc")
}
will be get crash
Hi @allenhsu-17live
I understand the catch logic you are suggesting, however, it doesn't address why the exception is being thrown in the first place. As to the rename, it may be possible to make an adjustment to the exception hierarchy without renaming. This is something we will consider.
@developernotes Ok, got it, But regardless of the root cause, I still suggest that you should use the official android exception instead of a copy. You can refer to the PR I mentioned
Hello, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "bug", "enhancement", or "security" and I will leave it open. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to reopen with up-to-date information.
Expected Behavior
No crash
Actual Behavior
crash happen from firebase
I guess the rootcase on here
the roomdata base catch
SQLiteException exception
, but the full class isandroid.database.sqlite.SQLiteException
But when I use net.sqlcipher.database, will throw this exceptionnet.sqlcipher.database.SQLiteException
It's different class. so Room can't try catch that. could you try to fix it?Steps to Reproduce
SQLCipher version (can be identified by executing
PRAGMA cipher_version;
):SQLCipher for Android version: 4.4.3 Are you able to reproduce this issue within the SQLCipher for Android test suite? I can't, just only firebase report
Note: If you are not posting a specific issue for the SQLCipher library, please post your question to the SQLCipher discuss site. Thanks!