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:32 UTC

[12/28] incubator-guacamole-client git commit: GUACAMOLE-102: Move null check for connection weight to the connection model.

GUACAMOLE-102: Move null check for connection weight to the connection model.


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/58637818
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/58637818
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/58637818

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

----------------------------------------------------------------------
 .../apache/guacamole/auth/jdbc/connection/ConnectionModel.java   | 2 ++
 .../auth/jdbc/tunnel/RestrictedGuacamoleTunnelService.java       | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/58637818/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionModel.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionModel.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionModel.java
index 56cf4ac..69ef4c3 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionModel.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionModel.java
@@ -191,6 +191,8 @@ public class ConnectionModel extends ChildObjectModel {
      *     -1 indicates that the system is unavailable.
      */
     public Integer getConnectionWeight() {
+        if (connectionWeight == null)
+            return 1;
         return connectionWeight;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/58637818/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 71d4f7f..d1b4912 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
@@ -190,14 +190,14 @@ public class RestrictedGuacamoleTunnelService
                 
                 int weightA, weightB;
                 // Check if weight of a is non-null and retrieve it.
-                if (a.getConnectionWeight() != null && a.getConnectionWeight().intValue() > 0)
+                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() != null && b.getConnectionWeight().intValue() > 0)
+                if (b.getConnectionWeight().intValue() > 0)
                     weightB = b.getConnectionWeight().intValue();
                 // In all other cases assign 1 for sorting.
                 else