mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUAC-1170: Use checked versions of empty list/set/map.
This commit is contained in:
@@ -316,7 +316,7 @@ public abstract class ModeledDirectoryObjectService<InternalType extends Modeled
|
|||||||
|
|
||||||
// Do not query if no identifiers given
|
// Do not query if no identifiers given
|
||||||
if (identifiers.isEmpty())
|
if (identifiers.isEmpty())
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.<InternalType>emptyList();
|
||||||
|
|
||||||
Collection<ModelType> objects;
|
Collection<ModelType> objects;
|
||||||
|
|
||||||
|
@@ -96,7 +96,7 @@ public abstract class ModeledGroupedDirectoryObjectService<InternalType extends
|
|||||||
|
|
||||||
// If both parents have the same identifier, nothing has changed
|
// If both parents have the same identifier, nothing has changed
|
||||||
if (parentIdentifier != null && parentIdentifier.equals(oldParentIdentifier))
|
if (parentIdentifier != null && parentIdentifier.equals(oldParentIdentifier))
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.<String>emptyList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -424,12 +424,12 @@ public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelS
|
|||||||
|
|
||||||
// If not a balancing group, there are no balanced connections
|
// If not a balancing group, there are no balanced connections
|
||||||
if (connectionGroup.getType() != ConnectionGroup.Type.BALANCING)
|
if (connectionGroup.getType() != ConnectionGroup.Type.BALANCING)
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.<ModeledConnection>emptyList();
|
||||||
|
|
||||||
// If group has no children, there are no balanced connections
|
// If group has no children, there are no balanced connections
|
||||||
Collection<String> identifiers = connectionMapper.selectIdentifiersWithin(connectionGroup.getIdentifier());
|
Collection<String> identifiers = connectionMapper.selectIdentifiersWithin(connectionGroup.getIdentifier());
|
||||||
if (identifiers.isEmpty())
|
if (identifiers.isEmpty())
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.<ModeledConnection>emptyList();
|
||||||
|
|
||||||
// Retrieve all children
|
// Retrieve all children
|
||||||
Collection<ConnectionModel> models = connectionMapper.select(identifiers);
|
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
|
// Simply return empty list if there are no active tunnels
|
||||||
Collection<ActiveConnectionRecord> records = activeTunnels.values();
|
Collection<ActiveConnectionRecord> records = activeTunnels.values();
|
||||||
if (records.isEmpty())
|
if (records.isEmpty())
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.<ActiveConnectionRecord>emptyList();
|
||||||
|
|
||||||
// Build set of all connection identifiers associated with active tunnels
|
// Build set of all connection identifiers associated with active tunnels
|
||||||
Set<String> identifiers = new HashSet<String>(records.size());
|
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 not a balancing group, assume no connections
|
||||||
if (connectionGroup.getType() != ConnectionGroup.Type.BALANCING)
|
if (connectionGroup.getType() != ConnectionGroup.Type.BALANCING)
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.<ActiveConnectionRecord>emptyList();
|
||||||
|
|
||||||
return activeConnectionGroups.get(connectionGroup.getIdentifier());
|
return activeConnectionGroups.get(connectionGroup.getIdentifier());
|
||||||
|
|
||||||
|
@@ -120,7 +120,7 @@ public class ActiveConnectionMultimap {
|
|||||||
if (connections != null)
|
if (connections != null)
|
||||||
return Collections.unmodifiableCollection(connections);
|
return Collections.unmodifiableCollection(connections);
|
||||||
|
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.<ActiveConnectionRecord>emptyList();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -65,7 +65,7 @@ public class CredentialsInfo {
|
|||||||
* CredentialsInfo object which describes empty credentials. No parameters
|
* CredentialsInfo object which describes empty credentials. No parameters
|
||||||
* are required.
|
* 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
|
* CredentialsInfo object which describes standard username/password
|
||||||
|
@@ -117,7 +117,7 @@ public class SimpleConnection extends AbstractConnection {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ConnectionRecord> getHistory() throws GuacamoleException {
|
public List<ConnectionRecord> getHistory() throws GuacamoleException {
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.<ConnectionRecord>emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,7 @@ public class SimpleDirectory<ObjectType> implements Directory<ObjectType> {
|
|||||||
/**
|
/**
|
||||||
* The Map of objects to provide access to.
|
* 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
|
* Creates a new empty SimpleDirectory which does not provide access to
|
||||||
|
@@ -42,7 +42,7 @@ public class SimpleObjectPermissionSet implements ObjectPermissionSet {
|
|||||||
/**
|
/**
|
||||||
* The set of all permissions currently granted.
|
* 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.
|
* Creates a new empty SimpleObjectPermissionSet.
|
||||||
|
@@ -40,7 +40,7 @@ public class SimpleSystemPermissionSet implements SystemPermissionSet {
|
|||||||
/**
|
/**
|
||||||
* The set of all permissions currently granted.
|
* 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.
|
* Creates a new empty SimpleSystemPermissionSet.
|
||||||
|
@@ -126,7 +126,7 @@ public class SimpleUserContext implements UserContext {
|
|||||||
// Add root group that contains only the given configurations
|
// Add root group that contains only the given configurations
|
||||||
this.rootGroup = new SimpleConnectionGroup(
|
this.rootGroup = new SimpleConnectionGroup(
|
||||||
ROOT_IDENTIFIER, ROOT_IDENTIFIER,
|
ROOT_IDENTIFIER, ROOT_IDENTIFIER,
|
||||||
connectionIdentifiers, Collections.EMPTY_LIST
|
connectionIdentifiers, Collections.<String>emptyList()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build new user from credentials
|
// Build new user from credentials
|
||||||
|
@@ -122,7 +122,7 @@ public class APIConnectionWrapper implements Connection {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends ConnectionRecord> getHistory() throws GuacamoleException {
|
public List<? extends ConnectionRecord> getHistory() throws GuacamoleException {
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.<ConnectionRecord>emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -108,7 +108,7 @@ public class LanguageRESTService {
|
|||||||
|
|
||||||
// If no translation files found, return an empty map
|
// If no translation files found, return an empty map
|
||||||
if (resourcePaths == null)
|
if (resourcePaths == null)
|
||||||
return Collections.EMPTY_MAP;
|
return Collections.<String, String>emptyMap();
|
||||||
|
|
||||||
Map<String, String> languageMap = new HashMap<String, String>();
|
Map<String, String> languageMap = new HashMap<String, String>();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user