mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Sonar critical bug: inefficient use of keySet iterator instead of entrySet iterator
This commit is contained in:
@@ -1022,13 +1022,12 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
||||
for (String listName : listNames)
|
||||
{
|
||||
Map<String, List<String>> members = config.get(listName);
|
||||
|
||||
Set<String> authorityNames = members.keySet();
|
||||
JSONObject listMembers = new JSONObject();
|
||||
|
||||
for (String authorityName : authorityNames)
|
||||
for (Map.Entry<String, List<String>> member : members.entrySet())
|
||||
{
|
||||
List<String> authorities = members.get(authorityName);
|
||||
final String authorityName = member.getKey();
|
||||
final List<String> authorities = member.getValue();
|
||||
try
|
||||
{
|
||||
listMembers.put(authorityName, authorities);
|
||||
|
@@ -97,15 +97,12 @@ public class ScriptConstraint implements Serializable
|
||||
return new ScriptConstraintAuthority[0];
|
||||
}
|
||||
|
||||
// Here with some data to return
|
||||
Set<String> authorities = values.keySet();
|
||||
|
||||
ArrayList<ScriptConstraintAuthority> constraints = new ArrayList<>(values.size());
|
||||
for(String authority : authorities)
|
||||
for (Map.Entry<String, List<String>> entry : values.entrySet())
|
||||
{
|
||||
ScriptConstraintAuthority constraint = new ScriptConstraintAuthority();
|
||||
constraint.setAuthorityName(authority);
|
||||
constraint.setValues(values.get(authority));
|
||||
constraint.setAuthorityName(entry.getKey());
|
||||
constraint.setValues(entry.getValue());
|
||||
constraints.add(constraint);
|
||||
}
|
||||
|
||||
|
@@ -255,22 +255,23 @@ public final class RecordsManagementAuditEntry
|
||||
this.beforeProperties.size() + this.afterProperties.size());
|
||||
|
||||
// add all the properties present before the audited action
|
||||
for (QName valuePropName : this.beforeProperties.keySet())
|
||||
for (Map.Entry<QName, Serializable> entry : this.beforeProperties.entrySet())
|
||||
{
|
||||
final QName valuePropName = entry.getKey();
|
||||
Pair<Serializable, Serializable> values = new Pair<>(
|
||||
this.beforeProperties.get(valuePropName),
|
||||
entry.getValue(),
|
||||
this.afterProperties.get(valuePropName));
|
||||
this.changedProperties.put(valuePropName, values);
|
||||
}
|
||||
|
||||
// add all the properties present after the audited action that
|
||||
// have not already been added
|
||||
for (QName valuePropName : this.afterProperties.keySet())
|
||||
for (Map.Entry<QName, Serializable> entry : this.afterProperties.entrySet())
|
||||
{
|
||||
final QName valuePropName = entry.getKey();
|
||||
if (!this.beforeProperties.containsKey(valuePropName))
|
||||
{
|
||||
Pair<Serializable, Serializable> values = new Pair<>(null,
|
||||
this.afterProperties.get(valuePropName));
|
||||
Pair<Serializable, Serializable> values = new Pair<>(null, entry.getValue());
|
||||
this.changedProperties.put(valuePropName, values);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user