Skip to content

Commit 46e94f3

Browse files
Remove several net.sqlcipher.database exceptions, use android.database.sqlite variants
This removes the following net.zetetic exceptions: - net.sqlcipher.SQLException - net.sqlcipher.database.SQLiteAbortException - net.sqlcipher.database.SQLiteConstraintException - net.sqlcipher.database.SQLiteDatabaseCorruptException - net.sqlcipher.database.SQLiteDiskIOException - net.sqlcipher.database.SQLiteDoneException - net.sqlcipher.database.SQLiteException - net.sqlcipher.database.SQLiteFullException - net.sqlcipher.database.SQLiteMisuseException Most clients will likely need to adjust the following import statements: -import net.sqlcipher.database.SQLiteException; +import android.database.sqlite.SQLiteException; This change normalizes the exception classes used by the library for better integration with the androidx Room library.
1 parent e721961 commit 46e94f3

18 files changed

+28
-277
lines changed

android-database-sqlcipher/src/main/cpp/net_sqlcipher_database_SQLiteDatabase.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -645,28 +645,28 @@ namespace sqlcipher {
645645
const char* exceptionClass;
646646
switch (errcode) {
647647
case SQLITE_IOERR:
648-
exceptionClass = "net/sqlcipher/database/SQLiteDiskIOException";
648+
exceptionClass = "android/database/sqlite/SQLiteDiskIOException";
649649
break;
650650
case SQLITE_CORRUPT:
651-
exceptionClass = "net/sqlcipher/database/SQLiteDatabaseCorruptException";
651+
exceptionClass = "android/database/sqlite/SQLiteDatabaseCorruptException";
652652
break;
653653
case SQLITE_CONSTRAINT:
654-
exceptionClass = "net/sqlcipher/database/SQLiteConstraintException";
654+
exceptionClass = "android/database/sqlite/SQLiteConstraintException";
655655
break;
656656
case SQLITE_ABORT:
657-
exceptionClass = "net/sqlcipher/database/SQLiteAbortException";
657+
exceptionClass = "android/database/sqlite/SQLiteAbortException";
658658
break;
659659
case SQLITE_DONE:
660-
exceptionClass = "net/sqlcipher/database/SQLiteDoneException";
660+
exceptionClass = "android/database/sqlite/SQLiteDoneException";
661661
break;
662662
case SQLITE_FULL:
663-
exceptionClass = "net/sqlcipher/database/SQLiteFullException";
663+
exceptionClass = "android/database/sqlite/SQLiteFullException";
664664
break;
665665
case SQLITE_MISUSE:
666-
exceptionClass = "net/sqlcipher/database/SQLiteMisuseException";
666+
exceptionClass = "android/database/sqlite/SQLiteMisuseException";
667667
break;
668668
default:
669-
exceptionClass = "net/sqlcipher/database/SQLiteException";
669+
exceptionClass = "android/database/sqlite/SQLiteException";
670670
break;
671671
}
672672

android-database-sqlcipher/src/main/java/net/sqlcipher/DatabaseUtils.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@
1616

1717
package net.sqlcipher;
1818

19-
import net.sqlcipher.database.SQLiteAbortException;
20-
import net.sqlcipher.database.SQLiteConstraintException;
2119
import net.sqlcipher.database.SQLiteDatabase;
22-
import net.sqlcipher.database.SQLiteDatabaseCorruptException;
23-
import net.sqlcipher.database.SQLiteDiskIOException;
24-
import net.sqlcipher.database.SQLiteException;
25-
import net.sqlcipher.database.SQLiteFullException;
2620
import net.sqlcipher.database.SQLiteProgram;
2721
import net.sqlcipher.database.SQLiteStatement;
2822

@@ -34,6 +28,14 @@
3428

3529
import android.content.ContentValues;
3630
import android.content.OperationApplicationException;
31+
import android.database.Cursor;
32+
import android.database.SQLException;
33+
import android.database.sqlite.SQLiteAbortException;
34+
import android.database.sqlite.SQLiteConstraintException;
35+
import android.database.sqlite.SQLiteDatabaseCorruptException;
36+
import android.database.sqlite.SQLiteDiskIOException;
37+
import android.database.sqlite.SQLiteException;
38+
import android.database.sqlite.SQLiteFullException;
3739
import android.os.Parcel;
3840
import android.text.TextUtils;
3941
import android.util.Config;
@@ -145,7 +147,7 @@ private static final void readExceptionFromParcel(Parcel reply, String msg, int
145147
case 4:
146148
throw new SQLiteAbortException(msg);
147149
case 5:
148-
throw new net.sqlcipher.database.SQLiteConstraintException(msg);
150+
throw new SQLiteConstraintException(msg);
149151
case 6:
150152
throw new SQLiteDatabaseCorruptException(msg);
151153
case 7:

android-database-sqlcipher/src/main/java/net/sqlcipher/DefaultDatabaseErrorHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import java.util.List;
2121

2222
import net.sqlcipher.database.SQLiteDatabase;
23-
import net.sqlcipher.database.SQLiteException;
2423

24+
import android.database.sqlite.SQLiteException;
2525
import android.util.Log;
2626
import android.util.Pair;
2727

android-database-sqlcipher/src/main/java/net/sqlcipher/SQLException.java

Lines changed: 0 additions & 30 deletions
This file was deleted.

android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteAbortException.java

Lines changed: 0 additions & 30 deletions
This file was deleted.

android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteConstraintException.java

Lines changed: 0 additions & 27 deletions
This file was deleted.

android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteCursor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import net.sqlcipher.AbstractWindowedCursor;
2020
import net.sqlcipher.BuildConfig;
2121
import net.sqlcipher.CursorWindow;
22-
import net.sqlcipher.SQLException;
2322

2423
import java.lang.ref.WeakReference;
2524
import java.util.HashMap;
@@ -29,6 +28,7 @@
2928

3029
import android.database.CharArrayBuffer;
3130
import android.database.DataSetObserver;
31+
import android.database.SQLException;
3232
import android.os.Handler;
3333
import android.os.Message;
3434
import android.os.Process;

android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteDatabase.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import net.sqlcipher.DatabaseUtils;
2323
import net.sqlcipher.DatabaseErrorHandler;
2424
import net.sqlcipher.DefaultDatabaseErrorHandler;
25-
import net.sqlcipher.SQLException;
25+
import net.sqlcipher.database.SQLiteStatement;
2626
import net.sqlcipher.database.SQLiteDebug.DbStats;
2727
import net.sqlcipher.database.SQLiteDatabaseHook;
2828
import net.sqlcipher.database.SQLiteQueryStats;
@@ -53,6 +53,9 @@
5353
import android.content.ContentValues;
5454

5555
import android.content.Context;
56+
import android.database.SQLException;
57+
import android.database.sqlite.SQLiteDatabaseCorruptException;
58+
import android.database.sqlite.SQLiteException;
5659

5760
import android.os.CancellationSignal;
5861
import android.os.Debug;

android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteDatabaseCorruptException.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteDiskIOException.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)