Fix Bug #12 (2/2): Zweite Validierungsstelle in TargetFilenameBuildingService angepasst

- TargetFilenameBuildingService.isAllowedTitleCharacters() erlaubt jetzt Bindestrich (-)
- Fehlermeldung nach Windows-Cleaning aktualisiert
- JavaDoc aktualisiert
- Test TargetFilenameBuildingServiceTest.buildBaseFilename_titleWithHyphen angepasst
- Test DocumentProcessingCoordinatorTest angepasst (Bindestrich → Ausrufezeichen)
- Vollständiger Reactor-Build grün: mvn clean verify
This commit is contained in:
2026-04-23 07:24:49 +02:00
parent 34c8245ae9
commit 2e6d0b1d6d
3 changed files with 12 additions and 12 deletions
@@ -93,7 +93,7 @@ public final class TargetFilenameBuildingService {
* <li>Validated title must be non-null and non-blank.</li>
* <li>Validated title must not exceed the configured maximum length
* (before Windows cleaning).</li>
* <li>After Windows-character cleaning, title must contain only letters, digits, and spaces.</li>
* <li>After Windows-character cleaning, title must contain only letters, digits, spaces, and hyphens.</li>
* </ul>
* If any rule is violated, the state is treated as an
* {@link InconsistentProposalState}.
@@ -148,11 +148,11 @@ public final class TargetFilenameBuildingService {
+ title + "'");
}
// After cleaning, verify that only letters, digits, and spaces remain
// After cleaning, verify that only letters, digits, spaces, and hyphens remain
if (!isAllowedTitleCharacters(cleanedTitle)) {
return new InconsistentProposalState(
"After Windows-compatibility cleaning, title contains disallowed characters "
+ "(only letters, digits, and spaces are permitted): '"
+ "(only letters, digits, spaces, and hyphens are permitted): '"
+ cleanedTitle + "'");
}
@@ -166,13 +166,13 @@ public final class TargetFilenameBuildingService {
// -------------------------------------------------------------------------
/**
* Returns {@code true} if every character in the title is a letter, a digit, or a space.
* Returns {@code true} if every character in the title is a letter, a digit, space, or hyphen.
* Unicode letters (including German Umlauts and ß) are permitted.
*/
private static boolean isAllowedTitleCharacters(String title) {
for (int i = 0; i < title.length(); i++) {
char c = title.charAt(i);
if (!Character.isLetter(c) && !Character.isDigit(c) && c != ' ') {
if (!Character.isLetter(c) && !Character.isDigit(c) && c != ' ' && c != '-') {
return false;
}
}