Skip to content

Throw a specific exception for SQLITE_NOTADB. #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package net.zetetic.database.sqlcipher;

import android.database.sqlite.SQLiteException;

/**
* An exception that is specific to the "SQLITE_NOTADB" error code.
*
* <a href="https://www.sqlite.org/rescode.html#notadb">SQLITE_NOTADB</a>
*/
class SQLiteNotADatabaseException extends SQLiteException {
public SQLiteNotADatabaseException() {
super();
}

public SQLiteNotADatabaseException(String error) {
super(error);
}

public SQLiteNotADatabaseException(String error, Throwable cause) {
super(error, cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void throw_sqlite3_exception(JNIEnv* env, int errcode,
/* Upstream treats treat "unsupported file format" error as corruption (SQLiteDatabaseCorruptException).
However, SQLITE_NOTADB can occur with mismatched keys, which is not a corruption case, so SQLCipher
treats this as a general exception */
exceptionClass = "android/database/sqlite/SQLiteException";
exceptionClass = "net/zetetic/database/sqlcipher/SQLiteNotADatabaseException";
break;
case SQLITE_CONSTRAINT:
exceptionClass = "android/database/sqlite/SQLiteConstraintException";
Expand Down