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
* unavailable.
*/
public int getConnectionWeight() {
if (connectionWeight == null)
return 1;
return connectionWeight.intValue();
public Integer getConnectionWeight() {
return connectionWeight;
}
/**

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
* The weight of the connection.
@@ -420,8 +421,10 @@ public class ModeledConnection extends ModeledChildDirectoryObject<ConnectionMod
*/
public int getConnectionWeight() {
// Return the connection weight
return getModel().getConnectionWeight();
Integer connectionWeight = getModel().getConnectionWeight();
if(connectionWeight == null)
return 1;
return connectionWeight;
}