GUACAMOLE-102: Move null checking logic to ModeledConnection.

This commit is contained in:
Nick Couchman
2017-06-05 14:53:21 -04:00
parent f77c50730d
commit f66bbd2e0f
2 changed files with 8 additions and 7 deletions

View File

@@ -192,10 +192,8 @@ public class ConnectionModel extends ChildObjectModel {
* negative numbers are used to indicate the system is * negative numbers are used to indicate the system is
* unavailable. * unavailable.
*/ */
public int getConnectionWeight() { public Integer getConnectionWeight() {
if (connectionWeight == null) return connectionWeight;
return 1;
return connectionWeight.intValue();
} }
/** /**

View File

@@ -412,7 +412,8 @@ public class ModeledConnection extends ModeledChildDirectoryObject<ConnectionMod
} }
/** /**
* Returns the weight of the connection, or the default. * Returns the weight of the connection, or a default
* of 1 if the weight is undefined.
* *
* @return * @return
* The weight of the connection. * The weight of the connection.
@@ -420,8 +421,10 @@ public class ModeledConnection extends ModeledChildDirectoryObject<ConnectionMod
*/ */
public int getConnectionWeight() { public int getConnectionWeight() {
// Return the connection weight Integer connectionWeight = getModel().getConnectionWeight();
return getModel().getConnectionWeight(); if(connectionWeight == null)
return 1;
return connectionWeight;
} }