GUACAMOLE-504: Avoid unnecessary use of instanceof.
diff --git a/guacamole-common/src/main/java/org/apache/guacamole/servlet/GuacamoleHTTPTunnelServlet.java b/guacamole-common/src/main/java/org/apache/guacamole/servlet/GuacamoleHTTPTunnelServlet.java
index 4845f90..be2da13 100644
--- a/guacamole-common/src/main/java/org/apache/guacamole/servlet/GuacamoleHTTPTunnelServlet.java
+++ b/guacamole-common/src/main/java/org/apache/guacamole/servlet/GuacamoleHTTPTunnelServlet.java
@@ -259,18 +259,16 @@
// Catch any thrown guacamole exception and attempt to pass within the
// HTTP response, logging each error appropriately.
+ catch (GuacamoleClientException e) {
+ logger.warn("HTTP tunnel request rejected: {}", e.getMessage());
+ sendError(response, e.getStatus().getGuacamoleStatusCode(),
+ e.getStatus().getHttpStatusCode(), e.getMessage());
+ }
catch (GuacamoleException e) {
- if (e instanceof GuacamoleClientException) {
- logger.warn("HTTP tunnel request rejected: {}", e.getMessage());
- sendError(response, e.getStatus().getGuacamoleStatusCode(),
- e.getStatus().getHttpStatusCode(), e.getMessage());
- }
- else {
- logger.error("HTTP tunnel request failed: {}", e.getMessage());
- logger.debug("Internal error in HTTP tunnel.", e);
- sendError(response, e.getStatus().getGuacamoleStatusCode(),
- e.getStatus().getHttpStatusCode(), "Internal server error.");
- }
+ logger.error("HTTP tunnel request failed: {}", e.getMessage());
+ logger.debug("Internal error in HTTP tunnel.", e);
+ sendError(response, e.getStatus().getGuacamoleStatusCode(),
+ e.getStatus().getHttpStatusCode(), "Internal server error.");
}
}