mike-jumper commented on a change in pull request #611:
URL: https://github.com/apache/guacamole-client/pull/611#discussion_r638329067
##########
File path:
guacamole-common/src/main/java/org/apache/guacamole/protocol/ConfiguredGuacamoleSocket.java
##########
@@ -59,17 +68,87 @@
*/
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 {
+
+ GuacamoleStatus status;
+
+ // Consider all error instructions without a corresponding status code
+ // to be server errors
+ List<String> args = instruction.getArgs();
+ if (args.size() < 2) {
+ logger.debug("Received \"error\" instruction without status
code.");
+ status = GuacamoleStatus.SERVER_ERROR;
+ }
+
+ else {
+
+ // Parse the status code from the received error instruction
+ int statusCode;
+ try {
+ statusCode = Integer.parseInt(args.get(1));
+ }
+ catch (NumberFormatException e) {
+ logger.debug("Received \"error\" instruction with non-numeric
status code.", e);
+ return;
Review comment:
Corrected via refactor and rebase.
--
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]