You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2018/02/14 23:42:03 UTC

[08/12] guacamole-client git commit: GUACAMOLE-504: Avoid unnecessary use of instanceof.

GUACAMOLE-504: Avoid unnecessary use of instanceof.


Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/e996a5a2
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/e996a5a2
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/e996a5a2

Branch: refs/heads/master
Commit: e996a5a2994b30004aaea32f0711ddab102f4518
Parents: ebd8974
Author: Nick Couchman <vn...@apache.org>
Authored: Sat Feb 10 14:41:37 2018 -0500
Committer: Nick Couchman <vn...@apache.org>
Committed: Sat Feb 10 14:41:37 2018 -0500

----------------------------------------------------------------------
 .../servlet/GuacamoleHTTPTunnelServlet.java     | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/e996a5a2/guacamole-common/src/main/java/org/apache/guacamole/servlet/GuacamoleHTTPTunnelServlet.java
----------------------------------------------------------------------
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 @@ public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
 
         // 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.");
         }
 
     }