GUAC-1181: Consider null to be empty.

This commit is contained in:
Michael Jumper
2015-04-25 13:13:08 -07:00
parent 6463a047bb
commit da468c6ac9
3 changed files with 7 additions and 7 deletions

View File

@@ -154,7 +154,7 @@ public class ConnectionService extends ModeledGroupedDirectoryObjectService<Mode
super.beforeCreate(user, model);
// Name must not be blank
if (model.getName().trim().isEmpty())
if (model.getName() == null || model.getName().trim().isEmpty())
throw new GuacamoleClientException("Connection names must not be blank.");
// Do not attempt to create duplicate connections
@@ -171,7 +171,7 @@ public class ConnectionService extends ModeledGroupedDirectoryObjectService<Mode
super.beforeUpdate(user, model);
// Name must not be blank
if (model.getName().trim().isEmpty())
if (model.getName() == null || model.getName().trim().isEmpty())
throw new GuacamoleClientException("Connection names must not be blank.");
// Check whether such a connection is already present
@@ -212,7 +212,7 @@ public class ConnectionService extends ModeledGroupedDirectoryObjectService<Mode
String value = parameterEntry.getValue();
// There is no need to insert empty parameters
if (value.isEmpty())
if (value == null || value.isEmpty())
continue;
// Produce model object from parameter

View File

@@ -137,7 +137,7 @@ public class ConnectionGroupService extends ModeledGroupedDirectoryObjectService
super.beforeCreate(user, model);
// Name must not be blank
if (model.getName().trim().isEmpty())
if (model.getName() == null || model.getName().trim().isEmpty())
throw new GuacamoleClientException("Connection group names must not be blank.");
// Do not attempt to create duplicate connection groups
@@ -154,7 +154,7 @@ public class ConnectionGroupService extends ModeledGroupedDirectoryObjectService
super.beforeUpdate(user, model);
// Name must not be blank
if (model.getName().trim().isEmpty())
if (model.getName() == null || model.getName().trim().isEmpty())
throw new GuacamoleClientException("Connection group names must not be blank.");
// Check whether such a connection group is already present

View File

@@ -144,7 +144,7 @@ public class UserService extends ModeledDirectoryObjectService<ModeledUser, User
super.beforeCreate(user, model);
// Username must not be blank
if (model.getIdentifier().trim().isEmpty())
if (model.getIdentifier() == null || model.getIdentifier().trim().isEmpty())
throw new GuacamoleClientException("The username must not be blank.");
// Do not create duplicate users
@@ -161,7 +161,7 @@ public class UserService extends ModeledDirectoryObjectService<ModeledUser, User
super.beforeUpdate(user, model);
// Username must not be blank
if (model.getIdentifier().trim().isEmpty())
if (model.getIdentifier() == null || model.getIdentifier().trim().isEmpty())
throw new GuacamoleClientException("The username must not be blank.");
// Check whether such a user is already present