diff --git a/core/src/main/java/org/acegisecurity/acl/basic/jdbc/JdbcDaoImpl.java b/core/src/main/java/org/acegisecurity/acl/basic/jdbc/JdbcDaoImpl.java index c1c7005e5d..70ac71c905 100644 --- a/core/src/main/java/org/acegisecurity/acl/basic/jdbc/JdbcDaoImpl.java +++ b/core/src/main/java/org/acegisecurity/acl/basic/jdbc/JdbcDaoImpl.java @@ -1,4 +1,4 @@ -/* Copyright 2004 Acegi Technology Pty Limited +/* Copyright 2004, 2005 Acegi Technology Pty Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -106,17 +106,14 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements BasicAclDao { * AclObjectIdentity was requested */ public BasicAclEntry[] getAcls(AclObjectIdentity aclObjectIdentity) { - // Ensure we can process this type of AclObjectIdentity - if (!(aclObjectIdentity instanceof NamedEntityObjectIdentity)) { - return null; + String aclObjectIdentityString; + + try { + aclObjectIdentityString = convertAclObjectIdentityToString(aclObjectIdentity); + } catch (IllegalArgumentException unsupported) { + return null; // pursuant to contract described in JavaDocs above } - NamedEntityObjectIdentity neoi = (NamedEntityObjectIdentity) aclObjectIdentity; - - // Compose the String we expect to find in the RDBMS - String aclObjectIdentityString = neoi.getClassname() + ":" - + neoi.getId(); - // Lookup the object's main properties from the RDBMS (guaranteed no nulls) List objects = objectProperties.execute(aclObjectIdentityString); @@ -189,6 +186,31 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements BasicAclDao { return objectPropertiesQuery; } + /** + * Responsible for covering a AclObjectIdentity to a + * String that can be located in the RDBMS. + * + * @param aclObjectIdentity to locate + * + * @return the object identity as a String + * + * @throws IllegalArgumentException DOCUMENT ME! + */ + protected String convertAclObjectIdentityToString( + AclObjectIdentity aclObjectIdentity) { + // Ensure we can process this type of AclObjectIdentity + if (!(aclObjectIdentity instanceof NamedEntityObjectIdentity)) { + throw new IllegalArgumentException( + "Only aclObjectIdentity of type NamedEntityObjectIdentity supported (was passed: " + + aclObjectIdentity + ")"); + } + + NamedEntityObjectIdentity neoi = (NamedEntityObjectIdentity) aclObjectIdentity; + + // Compose the String we expect to find in the RDBMS + return neoi.getClassname() + ":" + neoi.getId(); + } + protected void initDao() throws ApplicationContextException { initMappingSqlQueries(); } diff --git a/core/src/main/java/org/acegisecurity/acl/basic/jdbc/JdbcExtendedDaoImpl.java b/core/src/main/java/org/acegisecurity/acl/basic/jdbc/JdbcExtendedDaoImpl.java index 6f31b3a667..6edbe4fe99 100644 --- a/core/src/main/java/org/acegisecurity/acl/basic/jdbc/JdbcExtendedDaoImpl.java +++ b/core/src/main/java/org/acegisecurity/acl/basic/jdbc/JdbcExtendedDaoImpl.java @@ -1,4 +1,4 @@ -/* Copyright 2004 Acegi Technology Pty Limited +/* Copyright 2004, 2005 Acegi Technology Pty Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package net.sf.acegisecurity.acl.basic.jdbc; import net.sf.acegisecurity.acl.basic.AclObjectIdentity; import net.sf.acegisecurity.acl.basic.BasicAclEntry; import net.sf.acegisecurity.acl.basic.BasicAclExtendedDao; -import net.sf.acegisecurity.acl.basic.NamedEntityObjectIdentity; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -295,30 +294,6 @@ public class JdbcExtendedDaoImpl extends JdbcDaoImpl aclPermissionUpdate = new AclPermissionUpdate(getDataSource()); } - /** - * Responsible for covering a AclObjectIdentity to a - * String that can be located in the RDBMS. - * - * @param aclObjectIdentity to locate - * - * @return the object identity as a String - * - * @throws IllegalArgumentException DOCUMENT ME! - */ - String convertAclObjectIdentityToString(AclObjectIdentity aclObjectIdentity) { - // Ensure we can process this type of AclObjectIdentity - if (!(aclObjectIdentity instanceof NamedEntityObjectIdentity)) { - throw new IllegalArgumentException( - "Only aclObjectIdentity of type NamedEntityObjectIdentity supported (was passed: " - + aclObjectIdentity + ")"); - } - - NamedEntityObjectIdentity neoi = (NamedEntityObjectIdentity) aclObjectIdentity; - - // Compose the String we expect to find in the RDBMS - return neoi.getClassname() + ":" + neoi.getId(); - } - /** * Convenience method that creates an acl_object_identity record if * required. diff --git a/doc/xdocs/changes.xml b/doc/xdocs/changes.xml index e18f9eb9cd..4d4b07a72b 100644 --- a/doc/xdocs/changes.xml +++ b/doc/xdocs/changes.xml @@ -58,6 +58,7 @@ Added debug statement to AbstractTicketValidator to help with Acegi+CAS+SSL setup (thanks Seth Ladd for the patch) (see http://opensource.atlassian.com/projects/spring/browse/SEC-34) Added package.html files to empty resources dirs so CVS serves them to new developers Added package.html files to reamining java packages (see http://opensource.atlassian.com/projects/spring/browse/SEC-41) + Relocated JdbcDaoExtendedImpl.convertAclObjectIdentityToString to superclass HttpSessionContextIntegrationFilter elegantly handles IOExceptions and ServletExceptions within filter chain (see http://opensource.atlassian.com/projects/spring/browse/SEC-20)