fix(mongock-importer): skip IGNORED audit entries safely - #932
Merged
Conversation
`MongockImporterMongoDB.toAuditEntry` returns `null` for entries whose state is `IGNORED` (via `MongockAuditEntry.shouldBeIgnored()`), but the returned list is iterated downstream without a null check. Booting an application against a Mongock audit history containing an `IGNORED` entry therefore crashed with: NullPointerException: Cannot invoke "AuditEntry.getSystemChange()" because "auditEntryFromOrigin" is null inside the `migration-mongock-to-flamingock-community` system change. Changes: - **MongockImporterMongoDB**: filter `null`s out of the stream produced by `getAuditHistory()` and emit an INFO log when an entry is dropped because of `IGNORED`. The skipped entry's `changeId` is reported so operators know which legacy change was bypassed. - **MongockImportChange**: defensive null-filter at the caller so the same protection applies to any current or future `AuditHistoryReader` implementation (Couchbase, DynamoDB). - **MongoDBImporterTest**: regression test seeding the basic scenario plus one `IGNORED` entry. Asserts the `IGNORED` entry is absent from the Flamingock audit store and the rest of the audit history imports normally. No public API change. Behavior is purely additive (null-safety + log) relative to the previous code path.
osantana85
force-pushed
the
fix/mongock-importer-ignored-null-leak
branch
from
July 22, 2026 11:10
36747e2 to
e938cd0
Compare
`MongockImporterMongoDB.toAuditEntry` returns `null` for entries whose state is `IGNORED` (via `MongockAuditEntry.shouldBeIgnored()`), but the returned list is iterated downstream without a null check. Booting an application against a Mongock audit history containing an `IGNORED` entry therefore crashed with: NullPointerException: Cannot invoke "AuditEntry.getSystemChange()" because "auditEntryFromOrigin" is null inside the `migration-mongock-to-flamingock-community` system change. Changes: - **MongockImporterMongoDB**: filter `null`s out of the stream produced by `getAuditHistory()` and emit an INFO log when an entry is dropped because of `IGNORED`. The skipped entry's `changeId` is reported so operators know which legacy change was bypassed. - **MongockImportChange**: defensive null-filter at the caller so the same protection applies to any current or future `AuditHistoryReader` implementation (Couchbase, DynamoDB). - **MongoDBImporterTest**: regression test seeding the basic scenario plus one `IGNORED` entry. Asserts the `IGNORED` entry is absent from the Flamingock audit store and the rest of the audit history imports normally. No public API change. Behavior is purely additive (null-safety + log) relative to the previous code path.
…lamingock/flamingock-java into fix/mongock-importer-ignored-null-leak
osantana85
requested changes
Jul 29, 2026
osantana85
left a comment
Member
There was a problem hiding this comment.
Some comments to fix before apply changes to all importers
osantana85
previously approved these changes
Aug 1, 2026
osantana85
left a comment
Member
There was a problem hiding this comment.
Finally I think is better to remove log messages (I added comments)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MongockImporterMongoDB.toAuditEntryreturnsnullfor entries whose state isIGNORED(viaMongockAuditEntry.shouldBeIgnored()), but the returned list is iterated downstream without a null check. Booting an application against a Mongock audit history containing anIGNOREDentry therefore crashed with:NullPointerException: Cannot invoke
"AuditEntry.getSystemChange()" because "auditEntryFromOrigin" is null