Fix #64: Obergrenze für .bak-Backup-Schleife
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -117,7 +117,8 @@ public final class GuiConfigurationPropertiesWriter implements GuiConfigurationF
|
|||||||
LOG.info("Sicherungskopie erstellt: {}", bakPath);
|
LOG.info("Sicherungskopie erstellt: {}", bakPath);
|
||||||
return;
|
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);
|
Path numbered = targetPath.resolveSibling(targetPath.getFileName() + ".bak." + i);
|
||||||
if (!Files.exists(numbered)) {
|
if (!Files.exists(numbered)) {
|
||||||
copyFile(targetPath, numbered);
|
copyFile(targetPath, numbered);
|
||||||
@@ -125,6 +126,8 @@ public final class GuiConfigurationPropertiesWriter implements GuiConfigurationF
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
throw new GuiConfigurationWriteException(
|
||||||
|
"Maximale Anzahl an .bak-Sicherungen (1000) für '" + targetPath + "' erreicht");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user