jmuehlner commented on code in PR #883:
URL: https://github.com/apache/guacamole-client/pull/883#discussion_r1228560706
##########
extensions/guacamole-history-recording-storage/src/main/java/org/apache/guacamole/history/connection/HistoryConnectionRecord.java:
##########
@@ -131,7 +131,9 @@ public HistoryConnectionRecord(ConnectionRecord record)
throws GuacamoleExceptio
*/
private boolean isSessionRecording(File file) {
- try (Reader reader = new InputStreamReader(new FileInputStream(file),
StandardCharsets.UTF_8)) {
Review Comment:
Ok, so apparently this try-with-resources language feature doesn't handle
exceptions very well. I had a garbage recording in my recording storage,
causing the `readInstruction()` call below to throw a distinctly unfriendly
error:
```
17:32:58.156 [http-nio-8080-exec-2] ERROR o.a.g.rest.RESTExceptionMapper -
Unexpected internal error: Self-suppression not permitted
17:32:58.161 [http-nio-8080-exec-2] DEBUG o.a.g.rest.RESTExceptionMapper -
Unexpected error in REST endpoint.
java.lang.IllegalArgumentException: Self-suppression not permitted
at java.base/java.lang.Throwable.addSuppressed(Throwable.java:1054)
at
org.apache.guacamole.history.connection.HistoryConnectionRecord.isSessionRecording(HistoryConnectionRecord.java:140)
at
org.apache.guacamole.history.connection.HistoryConnectionRecord.getType(HistoryConnectionRecord.java:201)
[ snipped many lines for readability ]
Caused by: org.apache.guacamole.GuacamoleServerException: Non-numeric
character in element length.
at
org.apache.guacamole.io.ReaderGuacamoleReader.read(ReaderGuacamoleReader.java:157)
at
org.apache.guacamole.io.ReaderGuacamoleReader.readInstruction(ReaderGuacamoleReader.java:195)
at
org.apache.guacamole.history.connection.HistoryConnectionRecord.isSessionRecording(HistoryConnectionRecord.java:137)
... 64 common frames omitted
```
This is related to the suppressed exceptions discussed here
https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html#suppressed-exceptions.
I don't fully understand exactly what makes the `GuacamoleServerException` a
self-suppressed exception, and why that's bad, but in any case, going back to
this more traditional approach solves the problem.
I now get a sensible debug message in the logs about the problem with the
recording and the page loads fine, as expected.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]