Skip to content

Regression in Liquibase 4.25.0: Liquibase#calculateCheckSum() always fails #5225

Closed
@joschi

Description

Search first

  • I searched and no similar issues were found

Description

The changes in #4463 cause Liquibase#calculateCheckSum() to always fail with the error message:

Error encountered while parsing the command line. '--changeset-identifier' cannot be provided alongside other changeset arguments: '--changeset-id', '--changeset-path', '--changeset-author'.

Looks like this check is responsible for the error message:
https://github.com/liquibase/liquibase/blame/v4.25.1/liquibase-standard/src/main/java/liquibase/command/core/CalculateChecksumCommandStep.java#L140-L142

The command is always constructed with

CalculateChecksumCommandStep.CHANGESET_PATH_ARG, CalculateChecksumCommandStep.CHANGESET_ID_ARG, CalculateChecksumCommandStep.CHANGESET_AUTHOR_ARG, and CalculateChecksumCommandStep.CHANGESET_IDENTIFIER_ARG which triggers the exception:

https://github.com/liquibase/liquibase/blob/v4.25.1/liquibase-standard/src/main/java/liquibase/Liquibase.java#L1271-L1278

Steps To Reproduce

With Liquibase 4.25.0:

@Test
void liquibasePullRequest4463() throws LiquibaseException {
  Liquibase liquibase = new Liquibase("migrations.xml", new ClassLoaderResourceAccessor(), new H2Database());
  liquibase.calculateCheckSum("", "1", "name");
}

Exception:

liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: java.lang.IllegalArgumentException: Error encountered while parsing the command line. '--changeset-identifier' cannot be provided alongside other changeset arguments: '--changeset-id', '--changeset-path', '--changeset-author'.

	at liquibase.command.CommandScope.execute(CommandScope.java:237)
	at liquibase.Liquibase.calculateCheckSum(Liquibase.java:1278)
	at com.github.joschi.liquibase.DbCalculateChecksumCommandTest.liquibasePullRequest4463(DbCalculateChecksumCommandTest.java:47)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
Caused by: liquibase.exception.LiquibaseException: java.lang.IllegalArgumentException: Error encountered while parsing the command line. '--changeset-identifier' cannot be provided alongside other changeset arguments: '--changeset-id', '--changeset-path', '--changeset-author'.
	at liquibase.command.core.CalculateChecksumCommandStep.validateIdentifierParameters(CalculateChecksumCommandStep.java:148)
	at liquibase.command.core.CalculateChecksumCommandStep.run(CalculateChecksumCommandStep.java:95)
	at liquibase.command.CommandScope.execute(CommandScope.java:214)
	... 5 more
Caused by: java.lang.IllegalArgumentException: Error encountered while parsing the command line. '--changeset-identifier' cannot be provided alongside other changeset arguments: '--changeset-id', '--changeset-path', '--changeset-author'.
	... 8 more

Expected/Desired Behavior

The checksum of the changeset should be calculated without an exception.

Liquibase Version

4.25.0

Database Vendor & Version

All

Liquibase Integration

Code (via liquibase.Liquibase)

Liquibase Extensions

No response

OS and/or Infrastructure Type/Provider

No response

Additional Context

Are you willing to submit a PR?

  • I'm willing to submit a PR (Thank you!)

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions