holograph commented on a change in pull request #500: URL: https://github.com/apache/guacamole-client/pull/500#discussion_r575814039
########## File path: guacamole-common/src/main/java/org/apache/guacamole/GuacamoleServerErrorCommandException.java ########## @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole; + +import org.apache.guacamole.protocol.GuacamoleStatus; + +/** + * The exception thrown when the Guacamole server explicitly sends an error + * command to the client. The error message and status code reflect the arguments + * of the error command as determined by the server. + */ +public class GuacamoleServerErrorCommandException extends GuacamoleServerException { + /** + * The Guacamole protocol status code, as determined by the server; + */ + private final GuacamoleStatus status; + + /** + * Creates a new GuacamoleServerException with the given message and status. + * + * @param message The error message, as determined by the server where the error + * originated. + * @param status The status code, as determined by the server where the error originated. Review comment: Fixed ########## File path: guacamole-common/src/main/java/org/apache/guacamole/GuacamoleServerErrorCommandException.java ########## @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole; + +import org.apache.guacamole.protocol.GuacamoleStatus; + +/** + * The exception thrown when the Guacamole server explicitly sends an error + * command to the client. The error message and status code reflect the arguments + * of the error command as determined by the server. + */ +public class GuacamoleServerErrorCommandException extends GuacamoleServerException { + /** + * The Guacamole protocol status code, as determined by the server; + */ + private final GuacamoleStatus status; + + /** + * Creates a new GuacamoleServerException with the given message and status. Review comment: Fixed ########## File path: guacamole-common/src/main/java/org/apache/guacamole/protocol/ConfiguredGuacamoleSocket.java ########## @@ -83,14 +111,24 @@ private GuacamoleInstruction expect(GuacamoleReader reader, String opcode) if (instruction == null) throw new GuacamoleServerException("End of stream while waiting for \"" + opcode + "\"."); + // Handle server control commands + if ("disconnect".equals(instruction.getOpcode())) + throw new GuacamoleServerException("Server disconnected while waiting for \"" + opcode + "\"."); + if ("error".equals(instruction.getOpcode())) { + GuacamoleServerErrorCommandException e = parseServerErrorCommandArgs(instruction.getArgs()); + if (e == null) + throw new GuacamoleServerException("Invalid command received from server: " + instruction); Review comment: Fixed ########## File path: guacamole-common/src/main/java/org/apache/guacamole/protocol/ConfiguredGuacamoleSocket.java ########## @@ -83,14 +111,24 @@ private GuacamoleInstruction expect(GuacamoleReader reader, String opcode) if (instruction == null) throw new GuacamoleServerException("End of stream while waiting for \"" + opcode + "\"."); + // Handle server control commands Review comment: Fixed ---------------------------------------------------------------- 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]
