GUACAMOLE-102: Move null checking logic to ModeledConnection.
This commit is contained in:
1 parent
f77c50730d
commit
f66bbd2e0f
2 files changed
+8
-7
No files matched your search
+2
-4
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+6
-3
@@ -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