Skip to content

Commit f6e7ac9

Browse files
Adjustments for 4.5.0 release
1 parent 04f2b5e commit f6e7ac9

File tree

6 files changed

+24
-12
lines changed

6 files changed

+24
-12
lines changed

app/src/main/java/net/zetetic/tests/CipherMigrateTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ public boolean execute(SQLiteDatabase database) {
2222
public void preKey(SQLiteDatabase database) {}
2323
public void postKey(SQLiteDatabase database) {
2424
String value = QueryHelper.singleValueFromQuery(database, "PRAGMA cipher_migrate");
25+
setMessage(String.format("cipher_migrate result:%s", value));
2526
status[0] = Integer.valueOf(value) == 0;
2627
}
2728
};
28-
database = SQLiteDatabase.openOrCreateDatabase(olderFormatDatabase,
29-
ZeteticApplication.DATABASE_PASSWORD, null, hook);
29+
database = SQLiteDatabase.openDatabase(olderFormatDatabase.getPath(),
30+
ZeteticApplication.DATABASE_PASSWORD, null,
31+
SQLiteDatabase.OPEN_READWRITE | SQLiteDatabase.CREATE_IF_NECESSARY, hook);
3032
if(database != null){
3133
database.close();
3234
}

app/src/main/java/net/zetetic/tests/JavaClientLibraryVersionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
public class
66
JavaClientLibraryVersionTest extends SQLCipherTest {
77

8-
private final String EXPECTED_SQLCIPHER_ANDROID_VERSION = "4.4.3";
8+
private final String EXPECTED_SQLCIPHER_ANDROID_VERSION = "4.5.0";
99

1010
@Override
1111
public boolean execute(SQLiteDatabase database) {

app/src/main/java/net/zetetic/tests/PragmaCipherVersionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
public class PragmaCipherVersionTest extends SQLCipherTest {
88

9-
private final String CURRENT_CIPHER_VERSION = "4.4.3";
9+
private final String CURRENT_CIPHER_VERSION = "4.5.0";
1010

1111
@Override
1212
public boolean execute(SQLiteDatabase database) {

app/src/main/java/net/zetetic/tests/VerifyUTF8EncodingForKeyTest.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import net.sqlcipher.database.SQLiteDatabase;
55
import net.sqlcipher.database.SQLiteDatabaseHook;
66
import net.sqlcipher.database.SQLiteException;
7+
import net.sqlcipher.database.SQLiteStatement;
78
import net.zetetic.ZeteticApplication;
89

910
import java.io.File;
@@ -27,17 +28,26 @@ public boolean execute(SQLiteDatabase database) {
2728
setMessage(String.format("Database should not open with password:%s", invalidPassword));
2829
return false;
2930
}
30-
} catch (SQLiteException ex){}
31+
} catch (SQLiteException ex){
32+
log(String.format("Error opening database:%s", ex.getMessage()));
33+
}
3134
SQLiteDatabaseHook hook = new SQLiteDatabaseHook() {
32-
public void preKey(SQLiteDatabase database) {}
33-
public void postKey(SQLiteDatabase database) {
34-
database.rawExecSQL("PRAGMA cipher_migrate;");
35+
public void preKey(SQLiteDatabase db) {}
36+
public void postKey(SQLiteDatabase db) {
37+
SQLiteStatement statement = db.compileStatement("PRAGMA cipher_migrate;");
38+
long result = statement.simpleQueryForLong();
39+
statement.close();
40+
String message = String.format("cipher_migrate result:%d", result);
41+
setMessage(message);
42+
log(message);
3543
}
3644
};
37-
sourceDatabase = SQLiteDatabase.openDatabase(sourceDatabaseFile.getPath(),
38-
password, null, SQLiteDatabase.OPEN_READWRITE, hook);
45+
sourceDatabase = SQLiteDatabase.openDatabase(sourceDatabaseFile.getAbsolutePath(),
46+
password, null,
47+
SQLiteDatabase.OPEN_READWRITE | SQLiteDatabase.CREATE_IF_NECESSARY, hook);
3948
return queryContent(sourceDatabase);
4049
} catch (Exception e) {
50+
log(String.format("Error attempting to open database:%s", e.getMessage()));
4151
return false;
4252
}
4353
}

app/src/main/java/net/zetetic/tests/support/JavaClientLibraryVersionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
public class JavaClientLibraryVersionTest extends SupportTest {
77

8-
private final String EXPECTED_SQLCIPHER_ANDROID_VERSION = "4.4.3";
8+
private final String EXPECTED_SQLCIPHER_ANDROID_VERSION = "4.5.0";
99

1010
@Override
1111
public boolean execute(SQLiteDatabase database) {

app/src/main/java/net/zetetic/tests/support/PragmaCipherVersionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public class PragmaCipherVersionTest extends SupportTest {
99

10-
private final String CURRENT_CIPHER_VERSION = "4.4.3";
10+
private final String CURRENT_CIPHER_VERSION = "4.5.0";
1111

1212
@Override
1313
public boolean execute(SQLiteDatabase database) {

0 commit comments

Comments
 (0)