Skip to content

Commit 2e59317

Browse files
committed
Code review: rename variable and update comment
Signed-off-by: Paul Gooderham <turkeyonmarblerye@gmail.com>
1 parent 877e147 commit 2e59317

File tree

1 file changed

+9
-6
lines changed
  • src/main/java/io/openliberty/tools/common/plugins/util

1 file changed

+9
-6
lines changed

src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* (C) Copyright IBM Corporation 2019, 2026.
2+
* (C) Copyright IBM Corporation 2019, 2026
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -2689,11 +2689,11 @@ private void toggleGenerateToSrc() {
26892689
}
26902690

26912691
private void deleteGenFeaturesFile(File dir) {
2692-
// processConfigFileChange() ignores deletion of generated features file
2693-
File srcGenFeaturesFile = new File(dir, BinaryScannerUtil.GENERATED_FEATURES_FILE_PATH);
2694-
if (srcGenFeaturesFile.exists()) {
2695-
if (!srcGenFeaturesFile.delete()) {
2696-
debug("Error trying to delete the generated features file:" + srcGenFeaturesFile.getAbsolutePath());
2692+
// N.B. processConfigFileChange() will be called upon deletion of generated features file, it should be ignored
2693+
File oldGenFeaturesFile = new File(dir, BinaryScannerUtil.GENERATED_FEATURES_FILE_PATH);
2694+
if (oldGenFeaturesFile.exists()) {
2695+
if (!oldGenFeaturesFile.delete()) {
2696+
debug("Error trying to delete the generated features file:" + oldGenFeaturesFile.getAbsolutePath());
26972697
}
26982698
}
26992699
}
@@ -4682,6 +4682,9 @@ private void processConfigFileChange(File fileChanged, ChangeType changeType, Th
46824682
// generateFeaturesTmpDir in the process of handling an xml config modicifcation.
46834683
// Deleting that directory could cause generated-features.xml to be deleted and we
46844684
// need to be careful how to handle that event e.g. don't call optimizeGenerateFeatures().
4685+
// Another scenario, when we toggle generateToSrc option we delete the old file and change the
4686+
// value of generateFeaturesFile. Therefore we must only use the base name of generateFeaturesFile
4687+
// in this file name check.
46854688
if (generateFeatures && (fileChanged.getName().endsWith(".xml")
46864689
&& !fileChanged.getName().equals(generateFeaturesFile.getName()))
46874690
&& serverFeaturesModified()) {

0 commit comments

Comments
 (0)