Skip to content

Commit bf44c65

Browse files
author
Christopher J. Brody
committed
1 parent 8a6e87f commit bf44c65

File tree

6 files changed

+17
-66
lines changed

6 files changed

+17
-66
lines changed

src/main/java/net/zetetic/tests/ChangePasswordTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ public boolean execute(SQLiteDatabase database) {
3737
try {
3838
char[] nullPassword = null;
3939
database.changePassword(nullPassword);
40-
41-
Log.e(ZeteticApplication.TAG, "BEHAVIOR CHANGED please update this test");
42-
return false;
43-
} catch (NullPointerException e) {
44-
Log.v(ZeteticApplication.TAG, "IGNORED: null pointer exception when calling SQLiteDatabase.changePassword with null password String", e);
4540
} catch (Exception e) {
4641
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: exception", e);
4742
return false;

src/main/java/net/zetetic/tests/CorruptDatabaseTest.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,7 @@ public boolean execute(SQLiteDatabase null_database_ignored) {
7373

7474
// Try with a null DatabaseErrorHandler:
7575
ZeteticApplication.getInstance().extractAssetToDatabaseDirectory("corrupt.db");
76-
try {
77-
database = SQLiteDatabase.openOrCreateDatabase(unencryptedDatabase, "", null, null, null);
78-
79-
Log.e(TAG, "BEHAVIOR CHANGED: please update this test and attempt a rawQuery");
80-
return false;
81-
} catch (NullPointerException ex) {
82-
Log.v(TAG, "IGNORED: NullPointerException due to null DatabaseErrorHandler", ex);
83-
}
76+
SQLiteDatabase.openOrCreateDatabase(unencryptedDatabase, "", null, null, null);
8477

8578
return true;
8679
} catch (Exception ex) {

src/main/java/net/zetetic/tests/CreateNonEncryptedDatabaseTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,8 @@ public boolean execute(SQLiteDatabase database) {
8686

8787
try {
8888
String nullPasswordString = null;
89-
SQLiteDatabase.create(null, nullPasswordString);
90-
Log.e(ZeteticApplication.TAG, "BEHAVIOR CHANGED please update this test");
91-
return false;
92-
} catch (NullPointerException e) {
93-
Log.v(ZeteticApplication.TAG, "IGNORED: null pointer exception when opening database with null String password", e);
89+
SQLiteDatabase.create(null, nullPasswordString)
90+
.close();
9491
} catch (Exception e) {
9592
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: exception", e);
9693
return false;

src/main/java/net/zetetic/tests/InvalidOpenArgumentTest.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,9 @@ public boolean execute(SQLiteDatabase database) {
5050
Log.e(ZeteticApplication.TAG,
5151
"NOT EXPECTED: SQLiteDatabase.openOrCreateDatabase() with null file did not fail");
5252
return false;
53-
} catch (NullPointerException e){
54-
Log.v(ZeteticApplication.TAG,
55-
"IGNORED: SQLiteDatabase.openOrCreateDatabase() with null file did throw a NullPointerException", e);
5653
} catch (IllegalArgumentException e){
57-
Log.e(ZeteticApplication.TAG,
58-
"BEHAVIOR CHANGED: SQLiteDatabase.openOrCreateDatabase() with null file did throw an IllegalArgumentException - please update this test", e);
59-
return false;
54+
Log.v(ZeteticApplication.TAG,
55+
"EXPECTED RESULT: SQLiteDatabase.openOrCreateDatabase() with null file did throw an IllegalArgumentException OK", e);
6056
} catch (Exception e){
6157
Log.e(ZeteticApplication.TAG,
6258
"NOT EXPECTED: SQLiteDatabase.openOrCreateDatabase() with no password did throw an unexpected exception type", e);
@@ -69,13 +65,9 @@ public boolean execute(SQLiteDatabase database) {
6965
Log.e(ZeteticApplication.TAG,
7066
"NOT EXPECTED: SQLiteDatabase.openOrCreateDatabase() with null file did not fail");
7167
return false;
72-
} catch (NullPointerException e){
73-
Log.v(ZeteticApplication.TAG,
74-
"IGNORED: SQLiteDatabase.openOrCreateDatabase() with null file did throw a NullPointerException", e);
7568
} catch (IllegalArgumentException e){
76-
Log.e(ZeteticApplication.TAG,
77-
"BEHAVIOR CHANGED: SQLiteDatabase.openOrCreateDatabase() with null file did throw an IllegalArgumentException - please update this test", e);
78-
return false;
69+
Log.v(ZeteticApplication.TAG,
70+
"EXPECTED RESULT: SQLiteDatabase.openOrCreateDatabase() with null file did throw an IllegalArgumentException OK", e);
7971
} catch (Exception e){
8072
Log.e(ZeteticApplication.TAG,
8173
"NOT EXPECTED: SQLiteDatabase.openOrCreateDatabase() with null file did throw an unexpected exception type", e);

src/main/java/net/zetetic/tests/QueryNonEncryptedDatabaseTest.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,47 +47,27 @@ public boolean execute(SQLiteDatabase database) {
4747

4848
try {
4949
database = SQLiteDatabase.openOrCreateDatabase(unencryptedDatabase, nullPasswordString, null);
50-
51-
Log.e(ZeteticApplication.TAG, "BEHAVIOR CHANGED please update this test and check results of a raw SELECT query");
52-
return false;
53-
} catch (NullPointerException e) {
54-
Log.v(ZeteticApplication.TAG, "IGNORED: null pointer exception when opening database with null String password", e);
5550
} catch (Exception e) {
5651
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: exception", e);
5752
return false;
5853
}
5954

6055
try {
6156
database = SQLiteDatabase.openOrCreateDatabase(unencryptedDatabase.getPath(), nullPasswordString, null, null, null);
62-
63-
Log.e(ZeteticApplication.TAG, "BEHAVIOR CHANGED please update this test and check results of a raw SELECT query");
64-
return false;
65-
} catch (NullPointerException e) {
66-
Log.v(ZeteticApplication.TAG, "IGNORED: null pointer exception when opening database with null String password", e);
6757
} catch (Exception e) {
6858
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: exception", e);
6959
return false;
7060
}
7161

7262
try {
7363
database = SQLiteDatabase.openDatabase(unencryptedDatabase.getPath(), nullPasswordString, null, SQLiteDatabase.OPEN_READWRITE);
74-
75-
Log.e(ZeteticApplication.TAG, "BEHAVIOR CHANGED please update this test and check results of a raw SELECT query");
76-
return false;
77-
} catch (NullPointerException e) {
78-
Log.v(ZeteticApplication.TAG, "IGNORED: null pointer exception when opening database with null String password", e);
7964
} catch (Exception e) {
8065
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: exception", e);
8166
return false;
8267
}
8368

8469
try {
8570
database = SQLiteDatabase.openDatabase(unencryptedDatabase.getPath(), nullPasswordString, null, SQLiteDatabase.OPEN_READWRITE, null, null);
86-
87-
Log.e(ZeteticApplication.TAG, "BEHAVIOR CHANGED please update this test and check results of a raw SELECT query");
88-
return false;
89-
} catch (NullPointerException e) {
90-
Log.v(ZeteticApplication.TAG, "IGNORED: null pointer exception when opening database with null String password", e);
9171
} catch (Exception e) {
9272
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: exception", e);
9373
return false;

src/main/java/net/zetetic/tests/ReadableWritableInvalidPasswordTest.java

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public boolean execute(SQLiteDatabase database) {
2727
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: successfully opened writable encrypted database with invalid password");
2828
return false;
2929
} catch (SQLiteException e) {
30-
Log.v(ZeteticApplication.TAG, "EXPECTED: SQLiteException when opening writable encrypted database with invalid password OK", e);
30+
Log.v(ZeteticApplication.TAG, "EXPECTED RESULT: SQLiteException when opening writable encrypted database with invalid password OK", e);
3131
} catch (Exception e) {
3232
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: other exception when opening writable encrypted database with invalid password", e);
3333
return false;
@@ -38,7 +38,7 @@ public boolean execute(SQLiteDatabase database) {
3838
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: successfully opened readable encrypted database with invalid password");
3939
return false;
4040
} catch (SQLiteException e) {
41-
Log.v(ZeteticApplication.TAG, "EXPECTED: SQLiteException when opening readable encrypted database with invalid password OK", e);
41+
Log.v(ZeteticApplication.TAG, "EXPECTED RESULT: SQLiteException when opening readable encrypted database with invalid password OK", e);
4242
} catch (Exception e) {
4343
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: other exception when opening readable encrypted database with invalid password", e);
4444
return false;
@@ -49,7 +49,7 @@ public boolean execute(SQLiteDatabase database) {
4949
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: successfully opened writable encrypted database with blank password String");
5050
return false;
5151
} catch (SQLiteException e) {
52-
Log.v(ZeteticApplication.TAG, "EXPECTED: SQLiteException when opening writable encrypted database with blank password String OK", e);
52+
Log.v(ZeteticApplication.TAG, "EXPECTED RESULT: SQLiteException when opening writable encrypted database with blank password String OK", e);
5353
} catch (Exception e) {
5454
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: other exception when opening writable encrypted database with blank password String", e);
5555
return false;
@@ -60,7 +60,7 @@ public boolean execute(SQLiteDatabase database) {
6060
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: successfully opened readable encrypted database with blank password String");
6161
return false;
6262
} catch (SQLiteException e) {
63-
Log.v(ZeteticApplication.TAG, "EXPECTED: SQLiteException when opening readable encrypted database with blank password String OK", e);
63+
Log.v(ZeteticApplication.TAG, "EXPECTED RESULT: SQLiteException when opening readable encrypted database with blank password String OK", e);
6464
} catch (Exception e) {
6565
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: other exception when opening readable encrypted database with blank password String", e);
6666
return false;
@@ -71,7 +71,7 @@ public boolean execute(SQLiteDatabase database) {
7171
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: successfully opened writable encrypted database with blank password char array");
7272
return false;
7373
} catch (SQLiteException e) {
74-
Log.v(ZeteticApplication.TAG, "EXPECTED: SQLiteException when opening writable encrypted database with blank password char array OK", e);
74+
Log.v(ZeteticApplication.TAG, "EXPECTED RESULT: SQLiteException when opening writable encrypted database with blank password char array OK", e);
7575
} catch (Exception e) {
7676
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: other exception when opening writable encrypted database with blank password char array", e);
7777
return false;
@@ -82,7 +82,7 @@ public boolean execute(SQLiteDatabase database) {
8282
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: successfully opened readable encrypted database with blank password char array");
8383
return false;
8484
} catch (SQLiteException e) {
85-
Log.v(ZeteticApplication.TAG, "EXPECTED: SQLiteException when opening readable encrypted database with blank password char array OK", e);
85+
Log.v(ZeteticApplication.TAG, "EXPECTED RESULT: SQLiteException when opening readable encrypted database with blank password char array OK", e);
8686
} catch (Exception e) {
8787
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: other exception when opening readable encrypted database with blank password char array", e);
8888
return false;
@@ -95,7 +95,7 @@ public boolean execute(SQLiteDatabase database) {
9595
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: successfully opened writable encrypted database with null password char array");
9696
return false;
9797
} catch (SQLiteException e) {
98-
Log.v(ZeteticApplication.TAG, "EXPECTED: SQLiteException when opening writable encrypted database with null password char array OK", e);
98+
Log.v(ZeteticApplication.TAG, "EXPECTED RESULT: SQLiteException when opening writable encrypted database with null password char array OK", e);
9999
} catch (Exception e) {
100100
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: other exception when opening writable encrypted database with null password char array", e);
101101
return false;
@@ -106,7 +106,7 @@ public boolean execute(SQLiteDatabase database) {
106106
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: successfully opened readable encrypted database with null password char array");
107107
return false;
108108
} catch (SQLiteException e) {
109-
Log.v(ZeteticApplication.TAG, "EXPECTED: SQLiteException when opening readable encrypted database with null password char array OK", e);
109+
Log.v(ZeteticApplication.TAG, "EXPECTED RESULT: SQLiteException when opening readable encrypted database with null password char array OK", e);
110110
} catch (Exception e) {
111111
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: other exception when opening readable encrypted database with null password char array", e);
112112
return false;
@@ -120,10 +120,7 @@ public boolean execute(SQLiteDatabase database) {
120120
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: successfully opened writable encrypted database with null password String");
121121
return false;
122122
} catch (SQLiteException e) {
123-
Log.e(ZeteticApplication.TAG, "BEHAVIOR CHANGED: SQLiteException when opening writable encrypted database with null password String - please update this test", e);
124-
return false;
125-
} catch (NullPointerException e) {
126-
Log.v(ZeteticApplication.TAG, "IGNORED: null pointer exception when opening writable database with null password String", e);
123+
Log.v(ZeteticApplication.TAG, "EXPECTED RESULT: SQLiteException when opening writable encrypted database with null password String OK", e);
127124
} catch (Exception e) {
128125
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: exception when opening writable database with null password String", e);
129126
return false;
@@ -135,10 +132,7 @@ public boolean execute(SQLiteDatabase database) {
135132
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: successfully opened readable encrypted database with null password String");
136133
return false;
137134
} catch (SQLiteException e) {
138-
Log.e(ZeteticApplication.TAG, "BEHAVIOR CHANGED: SQLiteException when opening readable encrypted database with null password String - please update this test", e);
139-
return false;
140-
} catch (NullPointerException e) {
141-
Log.v(ZeteticApplication.TAG, "IGNORED: null pointer exception when opening readable encrypted with null password String", e);
135+
Log.v(ZeteticApplication.TAG, "EXPECTED RESULT: SQLiteException when opening readable encrypted database with null password String OK", e);
142136
} catch (Exception e) {
143137
Log.e(ZeteticApplication.TAG, "NOT EXPECTED: exception when opening readable encrypted with null password String", e);
144138
return false;

0 commit comments

Comments
 (0)