Skip to content

Commit ac8db4c

Browse files
committed
Ensure that all error logging is async
Signed-off-by: Taylor Smock <[email protected]>
1 parent 44b3aba commit ac8db4c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/org/openstreetmap/josm/plugins/routing2/lib/valhalla/ValhallaServer.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,7 @@ public Trip generateRoute(OsmDataLayer layer, JsonObject tripConfig, ILatLon...
220220
} catch (IOException e) {
221221
throw new UncheckedIOException(e);
222222
}
223-
try (BufferedReader errors = p.errorReader()) {
224-
errors.lines().forEach(Logging::error);
225-
} catch (IOException e) {
226-
throw new UncheckedIOException(e);
227-
}
223+
logErrors(p);
228224
final JsonObject data;
229225
try (BufferedReader br = new BufferedReader(p.inputReader())) {
230226
br.mark(40);
@@ -470,6 +466,11 @@ private static InputStream runCommand(String... args) throws IOException {
470466
throw new JosmRuntimeException(interruptedException);
471467
}
472468
}
469+
logErrors(p);
470+
return p.getInputStream();
471+
}
472+
473+
private static void logErrors(Process p) {
473474
// Do not block here.
474475
ForkJoinPool.commonPool().submit(() -> {
475476
try (BufferedReader errors = p.errorReader()) {
@@ -478,6 +479,5 @@ private static InputStream runCommand(String... args) throws IOException {
478479
throw new UncheckedIOException(e);
479480
}
480481
});
481-
return p.getInputStream();
482482
}
483483
}

0 commit comments

Comments
 (0)