Fix #64: Obergrenze für .bak-Backup-Schleife

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-04-28 15:37:36 +02:00
parent 899525a75c
commit a910633c64
@@ -117,7 +117,8 @@ public final class GuiConfigurationPropertiesWriter implements GuiConfigurationF
LOG.info("Sicherungskopie erstellt: {}", bakPath);
return;
}
for (int i = 1; ; i++) {
final int MAX_BACKUP_ATTEMPTS = 1000;
for (int i = 1; i <= MAX_BACKUP_ATTEMPTS; i++) {
Path numbered = targetPath.resolveSibling(targetPath.getFileName() + ".bak." + i);
if (!Files.exists(numbered)) {
copyFile(targetPath, numbered);
@@ -125,6 +126,8 @@ public final class GuiConfigurationPropertiesWriter implements GuiConfigurationF
return;
}
}
throw new GuiConfigurationWriteException(
"Maximale Anzahl an .bak-Sicherungen (1000) für '" + targetPath + "' erreicht");
}
/**