Skip to content

Conversation

filipelautert
Copy link
Collaborator

@filipelautert filipelautert commented Feb 10, 2025

Impact

  • Bug fix (non-breaking change which fixes expected existing functionality)
  • Enhancement/New feature (adds functionality without impacting existing logic)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Improvement of fix #6716 , providing backwards compatibility

* fix filename that was incorrect generated during 4.31.0

* chore: refactor and javadocs

* chore: more javadocs

* fix nullpointer; use correct method for logicalFilePath; logs

* chore comments

* fix another nullpointer

* chore: adding integration tests

* fix test title
}

private String getFilePath(ChangeSet changeSet) {
if (StringUtil.isNotEmpty(changeSet.getStoredFilePath())) {

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
StringUtil.isNotEmpty
should be avoided because it has been deprecated.

Copilot Autofix

AI 7 months ago

To fix the problem, we need to replace the usage of the deprecated StringUtil.isNotEmpty method with its recommended alternative. The StringUtil.isNotEmpty method has been deprecated in favor of StringUtil.isNotNullOrEmpty. We will update the code to use StringUtil.isNotNullOrEmpty instead.

  • Locate the usage of StringUtil.isNotEmpty in the getFilePath method.
  • Replace StringUtil.isNotEmpty with StringUtil.isNotNullOrEmpty.
  • Ensure that the functionality remains the same by checking if the file path is not null or empty.
Suggested changeset 1
liquibase-standard/src/main/java/liquibase/sqlgenerator/core/UpdateChangeSetFilenameGenerator.java

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/liquibase-standard/src/main/java/liquibase/sqlgenerator/core/UpdateChangeSetFilenameGenerator.java b/liquibase-standard/src/main/java/liquibase/sqlgenerator/core/UpdateChangeSetFilenameGenerator.java
--- a/liquibase-standard/src/main/java/liquibase/sqlgenerator/core/UpdateChangeSetFilenameGenerator.java
+++ b/liquibase-standard/src/main/java/liquibase/sqlgenerator/core/UpdateChangeSetFilenameGenerator.java
@@ -45,3 +45,3 @@
     private String getFilePath(ChangeSet changeSet) {
-        if (StringUtil.isNotEmpty(changeSet.getStoredFilePath())) {
+        if (StringUtil.isNotNullOrEmpty(changeSet.getStoredFilePath())) {
             return changeSet.getStoredFilePath();
EOF
@@ -45,3 +45,3 @@
private String getFilePath(ChangeSet changeSet) {
if (StringUtil.isNotEmpty(changeSet.getStoredFilePath())) {
if (StringUtil.isNotNullOrEmpty(changeSet.getStoredFilePath())) {
return changeSet.getStoredFilePath();
Copilot is powered by AI and may make mistakes. Always verify output.
} else {
ChangeLogHistoryService changeLogService = Scope.getCurrentScope().getSingleton(ChangeLogHistoryServiceFactory.class).getChangeLogService(database);
try {
changeLogService.replaceFilePath(changeSet, ranChangeSet.getChangeLog());

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
ChangeLogHistoryService.replaceFilePath
should be avoided because it has been deprecated.

Copilot Autofix

AI 7 months ago

To fix the problem, we need to replace the usage of the deprecated method replaceFilePath with the recommended alternative. According to the deprecation notice, the alternative method to use is replacePath. We will update the code to use replacePath instead of replaceFilePath.

Suggested changeset 1
liquibase-standard/src/main/java/liquibase/util/ValidatingVisitorUtil.java

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/liquibase-standard/src/main/java/liquibase/util/ValidatingVisitorUtil.java b/liquibase-standard/src/main/java/liquibase/util/ValidatingVisitorUtil.java
--- a/liquibase-standard/src/main/java/liquibase/util/ValidatingVisitorUtil.java
+++ b/liquibase-standard/src/main/java/liquibase/util/ValidatingVisitorUtil.java
@@ -263,3 +263,3 @@
                     try {
-                        changeLogService.replaceFilePath(changeSet, ranChangeSet.getChangeLog());
+                        changeLogService.replacePath(changeSet, ranChangeSet.getChangeLog());
                     } catch (DatabaseException e) {
EOF
@@ -263,3 +263,3 @@
try {
changeLogService.replaceFilePath(changeSet, ranChangeSet.getChangeLog());
changeLogService.replacePath(changeSet, ranChangeSet.getChangeLog());
} catch (DatabaseException e) {
Copilot is powered by AI and may make mistakes. Always verify output.
@suryaaki2 suryaaki2 merged commit 06a1a23 into master Feb 11, 2025
38 checks passed
@suryaaki2 suryaaki2 deleted the DAT-19579-master branch February 11, 2025 22:28
eichingertim pushed a commit to eichingertim/liquibase that referenced this pull request May 10, 2025
) (liquibase#6716)

fix filename that was incorrect generated during 4.31.0 (liquibase#6712)

* fix filename that was incorrect generated during 4.31.0

* chore: refactor and javadocs

* chore: more javadocs

* fix nullpointer; use correct method for logicalFilePath; logs

* chore comments

* fix another nullpointer

* chore: adding integration tests

* fix test title

Co-authored-by: suryaaki2 <80348493+suryaaki2@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants