mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-1105: Adding the RM module causes exceptions when listing the existing audit applications through the audit webscript - Added a try/catch for a ClassCastException around the check to see if the returned object contained a PROP_HOLD_REASON in the RMAfterInvocationProvider. The reason for this is that the containsKeys method will throw a class cast exception if we attempt to see if the keys contain an instance of QName if the returnedObject instance is a TreeMap containing strings as is the case when listing the audit applications through the RESTful interface.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.1@59361 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -951,24 +951,31 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
|||||||
@SuppressWarnings({"unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes" })
|
||||||
private Map decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Map returnedObject) throws AccessDeniedException
|
private Map decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Map returnedObject) throws AccessDeniedException
|
||||||
{
|
{
|
||||||
if (returnedObject.containsKey(RecordsManagementModel.PROP_HOLD_REASON))
|
try {
|
||||||
{
|
if (returnedObject.containsKey(RecordsManagementModel.PROP_HOLD_REASON))
|
||||||
HashMap filtered = new HashMap();
|
|
||||||
filtered.putAll(returnedObject);
|
|
||||||
// get the node ref from the properties or delete
|
|
||||||
String protocol = DefaultTypeConverter.INSTANCE.convert(String.class, filtered.get(ContentModel.PROP_STORE_PROTOCOL));
|
|
||||||
String identifier = DefaultTypeConverter.INSTANCE.convert(String.class, filtered.get(ContentModel.PROP_STORE_IDENTIFIER));
|
|
||||||
String uuid = DefaultTypeConverter.INSTANCE.convert(String.class, filtered.get(ContentModel.PROP_NODE_UUID));
|
|
||||||
StoreRef storeRef = new StoreRef(protocol, identifier);
|
|
||||||
NodeRef nodeRef = new NodeRef(storeRef, uuid);
|
|
||||||
if ((nodeRef == null) || (permissionService.hasPermission(filePlanService.getFilePlan(nodeRef), RMPermissionModel.VIEW_UPDATE_REASONS_FOR_FREEZE) != AccessStatus.ALLOWED))
|
|
||||||
{
|
{
|
||||||
filtered.remove(RecordsManagementModel.PROP_HOLD_REASON);
|
HashMap filtered = new HashMap();
|
||||||
|
filtered.putAll(returnedObject);
|
||||||
|
// get the node ref from the properties or delete
|
||||||
|
String protocol = DefaultTypeConverter.INSTANCE.convert(String.class, filtered.get(ContentModel.PROP_STORE_PROTOCOL));
|
||||||
|
String identifier = DefaultTypeConverter.INSTANCE.convert(String.class, filtered.get(ContentModel.PROP_STORE_IDENTIFIER));
|
||||||
|
String uuid = DefaultTypeConverter.INSTANCE.convert(String.class, filtered.get(ContentModel.PROP_NODE_UUID));
|
||||||
|
StoreRef storeRef = new StoreRef(protocol, identifier);
|
||||||
|
NodeRef nodeRef = new NodeRef(storeRef, uuid);
|
||||||
|
if ((nodeRef == null) || (permissionService.hasPermission(filePlanService.getFilePlan(nodeRef), RMPermissionModel.VIEW_UPDATE_REASONS_FOR_FREEZE) != AccessStatus.ALLOWED))
|
||||||
|
{
|
||||||
|
filtered.remove(RecordsManagementModel.PROP_HOLD_REASON);
|
||||||
|
}
|
||||||
|
return filtered;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return returnedObject;
|
||||||
}
|
}
|
||||||
return filtered;
|
|
||||||
}
|
}
|
||||||
else
|
catch(ClassCastException ex)
|
||||||
{
|
{
|
||||||
|
// This will happen if returnedObject is an instance of TreeMap containing anything other than instances of QName
|
||||||
return returnedObject;
|
return returnedObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user