Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8271447: java.nio.file.InvalidPathException: Malformed input or input…
… contains unmappable characters

Reviewed-by: mgronlun
  • Loading branch information
egahlin committed Dec 22, 2021
1 parent 713fbeb commit e49d4a9870c19f55a1d5473743880b415a8ead3c
Showing 1 changed file with 13 additions and 1 deletion.
@@ -74,7 +74,7 @@ public String next(LocalDateTime time) throws IOException {

// If more than one file per second
while (counter < MAX_CHUNK_NAMES) {
String extendedName = String.format("%s_%02d%s", filename, counter, FILE_EXTENSION);
String extendedName = makeExtendedName(filename, counter);
p = directory.resolve(extendedName);
counter++;
if (!fileAcess.exists(p)) {
@@ -83,4 +83,16 @@ public String next(LocalDateTime time) throws IOException {
}
throw new IOException("Unable to find unused filename after " + counter + " attempts");
}

private String makeExtendedName(String filename, int counter) {
StringBuilder sb = new StringBuilder();
sb.append(filename);
sb.append('_');
if (counter < 10) { // chronological sorted
sb.append('0');
}
sb.append(counter);
sb.append(FILE_EXTENSION);
return sb.toString();
}
}

1 comment on commit e49d4a9

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on e49d4a9 Dec 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.