Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent silent failures when two "databaseChangeLog" tags are present
If someone makes a mistake and copy/pastes a databaseChangeLog block in, and makes the file have two tags, the SnakeYAML parser silently covers up the first instance with the second one, which will cause the first block of changes to be silently omitted. This can be very problematic and cause hard-to-debug errors, which is why I have added a small FilterInputStream interceptor to check the stream as it is fed into the YAML parser, for a duplicate tag. Doing it with the FilterInputStream like this prevents the efficiency losses of opening the file twice.
- Loading branch information
1 parent
c95798b
commit 32c3961
Showing
4 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
46 changes: 46 additions & 0 deletions
46
liquibase-core/src/test/resources/liquibase/parser/core/yaml/malformedDoubleChangeLog.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
databaseChangeLog: | ||
- changeSet: | ||
id: 1 | ||
author: nvoxland | ||
comment: "Some comments go here" | ||
changes: | ||
- createTable: | ||
tableName: person_yaml | ||
columns: | ||
- column: | ||
name: id | ||
type: int | ||
constraints: | ||
primaryKey: true | ||
nullable: false | ||
- column: | ||
name: name | ||
type: varchar(255) | ||
constraints: | ||
nullable: false | ||
- column: | ||
name: age | ||
type: int | ||
databaseChangeLog: | ||
- changeSet: | ||
id: 2 | ||
author: nvoxland | ||
comment: "Some other comments go here" | ||
changes: | ||
- createTable: | ||
tableName: person_yaml2 | ||
columns: | ||
- column: | ||
name: id | ||
type: int | ||
constraints: | ||
primaryKey: true | ||
nullable: false | ||
- column: | ||
name: name | ||
type: varchar(255) | ||
constraints: | ||
nullable: false | ||
- column: | ||
name: age | ||
type: int |
This file contains 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