1
0

Kleinere Korrekturen

This commit is contained in:
2026-04-10 07:50:51 +02:00
parent 3f1d50d356
commit 8a785f1baa
10 changed files with 339 additions and 36 deletions

View File

@@ -248,23 +248,6 @@ public class StartConfigurationValidator {
// === Helper methods for common validation patterns ===
/**
* Validates that a required directory path is not null, exists, and is a directory.
* <p>
* Used for paths like source and target folders that must already exist before processing can begin.
*/
private void validateRequiredExistingDirectory(Path path, String fieldName, List<String> errors) {
if (path == null) {
errors.add("- " + fieldName + ": must not be null");
return;
}
if (!Files.exists(path)) {
errors.add("- " + fieldName + ": path does not exist: " + path);
} else if (!Files.isDirectory(path)) {
errors.add("- " + fieldName + ": path is not a directory: " + path);
}
}
/**
* Validates that a required file path is not null and its parent directory exists and is a directory.
* <p>
@@ -324,14 +307,13 @@ public class StartConfigurationValidator {
* or exists and is a directory.
*/
private void validateOptionalExistingDirectory(Path directoryPath, String fieldName, List<String> errors) {
if (directoryPath != null && !directoryPath.toString().isBlank()) {
if (Files.exists(directoryPath)) {
if (directoryPath != null && !directoryPath.toString().isBlank() && Files.exists(directoryPath)) {
if (!Files.isDirectory(directoryPath)) {
errors.add("- " + fieldName + ": exists but is not a directory: " + directoryPath);
}
}
// If it doesn't exist yet, that's acceptable - we don't auto-create
}
}
/**

View File

@@ -9,9 +9,6 @@ import java.nio.file.Paths;
import java.util.Properties;
import java.util.function.Function;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import de.gecheckt.pdf.umbenenner.application.config.provider.MultiProviderConfiguration;
import de.gecheckt.pdf.umbenenner.application.config.startup.StartConfiguration;
import de.gecheckt.pdf.umbenenner.application.port.out.ConfigurationPort;
@@ -28,7 +25,6 @@ import de.gecheckt.pdf.umbenenner.application.port.out.ConfigurationPort;
*/
public class PropertiesConfigurationPortAdapter implements ConfigurationPort {
private static final Logger LOG = LogManager.getLogger(PropertiesConfigurationPortAdapter.class);
private static final String DEFAULT_CONFIG_FILE_PATH = "config/application.properties";
private final Function<String, String> environmentLookup;