GUAC-1170: Use checked versions of empty list/set/map.

This commit is contained in:
Michael Jumper
2015-04-26 13:56:57 -07:00
parent b74c05b9f7
commit 51e9ff77e5
12 changed files with 15 additions and 15 deletions

View File

@@ -316,7 +316,7 @@ public abstract class ModeledDirectoryObjectService<InternalType extends Modeled
// Do not query if no identifiers given
if (identifiers.isEmpty())
return Collections.EMPTY_LIST;
return Collections.<InternalType>emptyList();
Collection<ModelType> objects;

View File

@@ -96,7 +96,7 @@ public abstract class ModeledGroupedDirectoryObjectService<InternalType extends
// If both parents have the same identifier, nothing has changed
if (parentIdentifier != null && parentIdentifier.equals(oldParentIdentifier))
return Collections.EMPTY_LIST;
return Collections.<String>emptyList();
}

View File

@@ -424,12 +424,12 @@ public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelS
// If not a balancing group, there are no balanced connections
if (connectionGroup.getType() != ConnectionGroup.Type.BALANCING)
return Collections.EMPTY_LIST;
return Collections.<ModeledConnection>emptyList();
// If group has no children, there are no balanced connections
Collection<String> identifiers = connectionMapper.selectIdentifiersWithin(connectionGroup.getIdentifier());
if (identifiers.isEmpty())
return Collections.EMPTY_LIST;
return Collections.<ModeledConnection>emptyList();
// Retrieve all children
Collection<ConnectionModel> models = connectionMapper.select(identifiers);
@@ -453,7 +453,7 @@ public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelS
// Simply return empty list if there are no active tunnels
Collection<ActiveConnectionRecord> records = activeTunnels.values();
if (records.isEmpty())
return Collections.EMPTY_LIST;
return Collections.<ActiveConnectionRecord>emptyList();
// Build set of all connection identifiers associated with active tunnels
Set<String> identifiers = new HashSet<String>(records.size());
@@ -521,7 +521,7 @@ public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelS
// If not a balancing group, assume no connections
if (connectionGroup.getType() != ConnectionGroup.Type.BALANCING)
return Collections.EMPTY_LIST;
return Collections.<ActiveConnectionRecord>emptyList();
return activeConnectionGroups.get(connectionGroup.getIdentifier());

View File

@@ -120,7 +120,7 @@ public class ActiveConnectionMultimap {
if (connections != null)
return Collections.unmodifiableCollection(connections);
return Collections.EMPTY_LIST;
return Collections.<ActiveConnectionRecord>emptyList();
}
}

View File

@@ -65,7 +65,7 @@ public class CredentialsInfo {
* CredentialsInfo object which describes empty credentials. No parameters
* are required.
*/
public static final CredentialsInfo EMPTY = new CredentialsInfo(Collections.EMPTY_LIST);
public static final CredentialsInfo EMPTY = new CredentialsInfo(Collections.<Parameter>emptyList());
/**
* CredentialsInfo object which describes standard username/password

View File

@@ -117,7 +117,7 @@ public class SimpleConnection extends AbstractConnection {
@Override
public List<ConnectionRecord> getHistory() throws GuacamoleException {
return Collections.EMPTY_LIST;
return Collections.<ConnectionRecord>emptyList();
}
}

View File

@@ -45,7 +45,7 @@ public class SimpleDirectory<ObjectType> implements Directory<ObjectType> {
/**
* The Map of objects to provide access to.
*/
private Map<String, ObjectType> objects = Collections.EMPTY_MAP;
private Map<String, ObjectType> objects = Collections.<String, ObjectType>emptyMap();
/**
* Creates a new empty SimpleDirectory which does not provide access to

View File

@@ -42,7 +42,7 @@ public class SimpleObjectPermissionSet implements ObjectPermissionSet {
/**
* The set of all permissions currently granted.
*/
private Set<ObjectPermission> permissions = Collections.EMPTY_SET;
private Set<ObjectPermission> permissions = Collections.<ObjectPermission>emptySet();
/**
* Creates a new empty SimpleObjectPermissionSet.

View File

@@ -40,7 +40,7 @@ public class SimpleSystemPermissionSet implements SystemPermissionSet {
/**
* The set of all permissions currently granted.
*/
private Set<SystemPermission> permissions = Collections.EMPTY_SET;
private Set<SystemPermission> permissions = Collections.<SystemPermission>emptySet();
/**
* Creates a new empty SimpleSystemPermissionSet.

View File

@@ -126,7 +126,7 @@ public class SimpleUserContext implements UserContext {
// Add root group that contains only the given configurations
this.rootGroup = new SimpleConnectionGroup(
ROOT_IDENTIFIER, ROOT_IDENTIFIER,
connectionIdentifiers, Collections.EMPTY_LIST
connectionIdentifiers, Collections.<String>emptyList()
);
// Build new user from credentials

View File

@@ -122,7 +122,7 @@ public class APIConnectionWrapper implements Connection {
@Override
public List<? extends ConnectionRecord> getHistory() throws GuacamoleException {
return Collections.EMPTY_LIST;
return Collections.<ConnectionRecord>emptyList();
}
}

View File

@@ -108,7 +108,7 @@ public class LanguageRESTService {
// If no translation files found, return an empty map
if (resourcePaths == null)
return Collections.EMPTY_MAP;
return Collections.<String, String>emptyMap();
Map<String, String> languageMap = new HashMap<String, String>();