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

This commit is contained in:
Nick Couchman authored and Nick Couchman committed 2017-06-05 15:34:21 -04:00
1 parent 4033e097c7
commit 58637818ca
2 files changed
+4 -2

No files matched your search

@@ -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;
}
@@ -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