[GH] Extended integrity error message
Extended integrity error message with db identity hashes.
## Proposed Changes
- Currently it is hard to tell by the data integrity exception message what database versions are being compared. With mentioned hashes it would become easy for code consumers to understand what have changed and what db versions are conflicting.
## Testing
Test: ./gradlew test connectedCheck
This is an imported pull request from https://github.com/androidx/androidx/pull/310.
Resolves #310
Github-Pr-Head-Sha: 9b2fc65bbc3407fb619084ed0844032c0a1df936
GitOrigin-RevId: ca6558ac0adbd9c02111dfb33c028a2dca938b19
Change-Id: Ied92df2351bb2888f1c21da47109e61464f7aadb
diff --git a/room/room-runtime/src/main/java/androidx/room/RoomOpenHelper.java b/room/room-runtime/src/main/java/androidx/room/RoomOpenHelper.java
index 3dbe7dd..3d72956 100644
--- a/room/room-runtime/src/main/java/androidx/room/RoomOpenHelper.java
+++ b/room/room-runtime/src/main/java/androidx/room/RoomOpenHelper.java
@@ -153,7 +153,8 @@
if (!mIdentityHash.equals(identityHash) && !mLegacyHash.equals(identityHash)) {
throw new IllegalStateException("Room cannot verify the data integrity. Looks like"
+ " you've changed schema but forgot to update the version number. You can"
- + " simply fix this by increasing the version number.");
+ + " simply fix this by increasing the version number. Expected identity"
+ + " hash: " + identityHash + ", found: " + mIdentityHash);
}
} else {
// No room_master_table, this might an a pre-populated DB, we must validate to see if