mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-102: Move null checking logic to ModeledConnection.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user