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 2017/06/07 00:32:27 UTC

[07/28] incubator-guacamole-client git commit: GUACAMOLE-102: Remove unnecessary checks for weight value in the compare function.

GUACAMOLE-102: Remove unnecessary checks for weight value in the compare function.


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

Branch: refs/heads/master
Commit: aa4c13492251a4dfd7e8449435f5eebd2eac7e40
Parents: 5863781
Author: Nick Couchman <vn...@apache.org>
Authored: Fri Jun 2 14:51:27 2017 -0400
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Mon Jun 5 15:34:21 2017 -0400

----------------------------------------------------------------------
 .../tunnel/RestrictedGuacamoleTunnelService.java | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/aa4c1349/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java
index d1b4912..56d2f5b 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java
@@ -187,21 +187,10 @@ public class RestrictedGuacamoleTunnelService
 
             @Override
             public int compare(ModeledConnection a, ModeledConnection b) {
-                
-                int weightA, weightB;
-                // Check if weight of a is non-null and retrieve it.
-                if (a.getConnectionWeight().intValue() > 0)
-                    weightA = a.getConnectionWeight().intValue();
-                // In all other cases assign 1 for sorting.
-                else
-                    weightA = 1;
-
-                // Check if weight of b is null, assign 1 if it is.
-                if (b.getConnectionWeight().intValue() > 0)
-                    weightB = b.getConnectionWeight().intValue();
-                // In all other cases assign 1 for sorting.
-                else
-                    weightB = 1;
+
+                // Get connection weight for the two systems being compared.                
+                int weightA = a.getConnectionWeight().intValue();
+                int weightB = b.getConnectionWeight().intValue();
 
                 // Get current active connections, add 1 to both to avoid calculations with 0.
                 int connsA = getActiveConnections(a).size() + 1;