close storage opened when testing rejected wallet schemas
What changed, and why it matters
This commit fixes a minor cleanup issue in a single test file. When running a test that checks whether invalid wallet files are rejected, the test now properly closes a temporary storage object afterward. It does not change any production code or fix a security vulnerability in the wallet itself.
No security action required. Treat as routine test maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change is confined to src/test/java/com/sparrowwallet/sparrow/io/DbPersistenceTest.java. The assertRejected helper previously opened a Storage instance to verify that loading an unencrypted wallet throws StorageException, but it never closed that storage. The patch wraps the assertion in a try/finally so storage.closeAndWait() is always invoked. This is a test-hygiene/resource-leak fix, not a product security fix.
Changed components
src/test/java/com/sparrowwallet/sparrow/io/DbPersistenceTest.javaInspect captured patch +5 / −1
### src/test/java/com/sparrowwallet/sparrow/io/DbPersistenceTest.java
@@ -54,7 +54,11 @@ private File buildWalletFile(String... schemaObjects) throws Exception {
private void assertRejected(File walletFile) {
Storage storage = new Storage(PersistenceType.DB, walletFile);
- Assertions.assertThrows(StorageException.class, storage::loadUnencryptedWallet);
+ try {
+ Assertions.assertThrows(StorageException.class, storage::loadUnencryptedWallet);
+ } finally {
+ storage.closeAndWait();
+ }
}
@TestWhy this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.