necouchman commented on a change in pull request #611:
URL: https://github.com/apache/guacamole-client/pull/611#discussion_r638410276
##########
File path:
guacamole-common/src/main/java/org/apache/guacamole/protocol/ConfiguredGuacamoleSocket.java
##########
@@ -59,17 +68,83 @@
*/
private GuacamoleProtocolVersion protocolVersion =
GuacamoleProtocolVersion.VERSION_1_0_0;
-
+
+ /**
+ * Parses the given "error" instruction, throwing a GuacamoleException that
+ * corresponds to its status code and message.
+ *
+ * @param instruction
+ * The "error" instruction to parse.
+ *
+ * @throws GuacamoleException
+ * A GuacamoleException that corresponds to the status code and message
+ * present within the given "error" instruction.
+ */
+ private static void handleReceivedError(GuacamoleInstruction instruction)
+ throws GuacamoleException {
+
+ // Provide reasonable default error message for invalid "error"
+ // instructions that fail to provide one
+ String message = "Internal error within guacd / protocol handling.";
+
+ // Consider all error instructions without a corresponding status code
+ // to be server errors
+ GuacamoleStatus status = GuacamoleStatus.SERVER_ERROR;
+
+ // Parse human-readable message from "error" instruction, warning if no
+ // message was given
+ List<String> args = instruction.getArgs();
+ if (args.size() >= 1)
+ message = args.get(0);
+ else
+ logger.debug("Received \"error\" instruction no corresponding
message.");
Review comment:
instruction _with_ no corresponding message?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]