diff --git a/source/java/org/alfresco/repo/audit/model/AuditEntry.java b/source/java/org/alfresco/repo/audit/model/AuditEntry.java index 0534ae590d..48a64b21af 100644 --- a/source/java/org/alfresco/repo/audit/model/AuditEntry.java +++ b/source/java/org/alfresco/repo/audit/model/AuditEntry.java @@ -197,25 +197,38 @@ public class AuditEntry extends AbstractAuditEntry implements InitializingBean, private Document createDocument() { - InputStream is = auditConfiguration.getInputStream(); - if (is == null) - { - throw new AuditModelException("Audit configuration could not be opened"); - } - SAXReader reader = new SAXReader(); + InputStream is = null; try { - Document document = reader.read(is); - is.close(); - return document; + is = auditConfiguration.getInputStream(); + if (is == null) + { + throw new AuditModelException("Audit configuration could not be opened"); + } + SAXReader reader = new SAXReader(); + try + { + Document document = reader.read(is); + return document; + } + catch (DocumentException e) + { + throw new AuditModelException("Failed to create audit model document ", e); + } } - catch (DocumentException e) + finally { - throw new AuditModelException("Failed to create audit model document ", e); - } - catch (IOException e) - { - throw new AuditModelException("Failed to close audit model document ", e); + if (is != null) + { + try + { + is.close(); + } + catch (IOException e) + { + throw new AuditModelException("Failed to close audit model document ", e); + } + } } } diff --git a/source/java/org/alfresco/repo/domain/hibernate/AbstractPermissionsDaoComponentImpl.java b/source/java/org/alfresco/repo/domain/hibernate/AbstractPermissionsDaoComponentImpl.java index e832187bd1..4a0c0b8472 100644 --- a/source/java/org/alfresco/repo/domain/hibernate/AbstractPermissionsDaoComponentImpl.java +++ b/source/java/org/alfresco/repo/domain/hibernate/AbstractPermissionsDaoComponentImpl.java @@ -365,7 +365,16 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions DbAccessControlList acl = null; try { - acl = getACLDAO(nodeRef).getAccessControlList(nodeRef); + AccessControlListDAO aclDAO = getACLDAO(nodeRef); + if (aclDAO == null) + { + return; + } + acl = aclDAO.getAccessControlList(nodeRef); + if (acl == null) + { + return; + } } catch (InvalidNodeRefException e) { @@ -402,7 +411,16 @@ public abstract class AbstractPermissionsDaoComponentImpl implements Permissions DbAccessControlList acl = null; try { - acl = getACLDAO(nodeRef).getAccessControlList(nodeRef); + AccessControlListDAO aclDAO = getACLDAO(nodeRef); + if (aclDAO == null) + { + return; + } + acl = aclDAO.getAccessControlList(nodeRef); + if (acl == null) + { + return; + } } catch (InvalidNodeRefException e) { diff --git a/source/java/org/alfresco/repo/domain/hibernate/Permission.hbm.xml b/source/java/org/alfresco/repo/domain/hibernate/Permission.hbm.xml index 0a2240d906..2f6405d52f 100644 --- a/source/java/org/alfresco/repo/domain/hibernate/Permission.hbm.xml +++ b/source/java/org/alfresco/repo/domain/hibernate/Permission.hbm.xml @@ -444,7 +444,6 @@ ]]> - - + + SELECT {n.*} FROM alf_node n JOIN alf_node_properties p ON n.id = p.node_id + JOIN alf_child_assoc c on c.child_node_id = n.id + JOIN alf_store s on s.id = n.store_id WHERE + c.qname_localname = :userName1 AND p.qname_id = :qnameId AND - n.node_deleted = :False" + p.string_value = :userName2 AND + n.node_deleted = :False AND + s.protocol = :storeProtocol AND + s.identifier = :storeIdentifier - + + + + SELECT + {n.*} + FROM + alf_node n + JOIN alf_node_properties p ON n.id = p.node_id + JOIN alf_store s on s.id = n.store_id + WHERE + p.qname_id = :qnameId AND + n.node_deleted = :False AND + s.protocol = :storeProtocol AND + s.identifier = :storeIdentifier + +