bugfix for journal

This commit is contained in:
Jörg Prante 2023-08-29 14:00:32 +02:00
parent 582e7dd895
commit 16463a58e2
2 changed files with 3 additions and 3 deletions

View file

@ -1,5 +1,5 @@
group = org.xbib
name = net-http
version = 3.7.0
version = 3.7.1
org.gradle.warning.mode = ALL

View file

@ -60,7 +60,7 @@ public class Journal {
writeLock.lock();
Path path = journalPath.resolve("success").resolve(stamp + ".request");
Files.createDirectories(path.getParent());
Files.move(journalPath.resolve(stamp), path);
Files.move(journalPath.resolve(stamp + ".log"), path);
try (OutputStream outputStream = Files.newOutputStream(journalPath.resolve("success").resolve(stamp + ".response"), StandardOpenOption.CREATE)) {
outputStream.write(response.getBytes(StandardCharsets.UTF_8));
} finally {
@ -73,7 +73,7 @@ public class Journal {
writeLock.lock();
Path path = journalPath.resolve("fail").resolve(stamp + ".request");
Files.createDirectories(path.getParent());
Files.move(journalPath.resolve(stamp), path);
Files.move(journalPath.resolve(stamp + ".log"), path);
// save throwable in extra file
try (OutputStream outputStream = Files.newOutputStream(journalPath.resolve("fail").resolve(stamp + ".exception"), StandardOpenOption.CREATE)) {
outputStream.write(ExceptionFormatter.format(t).getBytes(StandardCharsets.UTF_8));