protected AccessControlList toAcl(final Acl acl) {
        if(Acl.EMPTY.equals(acl)) {
            return null;
        }
        if(Acl.CANNED_PRIVATE.equals(acl)) {
            return AccessControlList.REST_CANNED_PRIVATE;
        }
        if(Acl.CANNED_BUCKET_OWNER_FULLCONTROL.equals(acl)) {
            return AccessControlList.REST_CANNED_BUCKET_OWNER_FULLCONTROL;
        }
        if(Acl.CANNED_BUCKET_OWNER_READ.equals(acl)) {
            return AccessControlList.REST_CANNED_BUCKET_OWNER_READ;
        }
        if(Acl.CANNED_AUTHENTICATED_READ.equals(acl)) {
            return AccessControlList.REST_CANNED_AUTHENTICATED_READ;
        }
        if(Acl.CANNED_PUBLIC_READ.equals(acl)) {
            return AccessControlList.REST_CANNED_PUBLIC_READ;
        }
        if(Acl.CANNED_PUBLIC_READ_WRITE.equals(acl)) {
            return AccessControlList.REST_CANNED_PUBLIC_READ_WRITE;
        }
        final AccessControlList list = new AccessControlList();
        for(Acl.UserAndRole userAndRole : acl.asList()) {
            if(!userAndRole.isValid()) {
                continue;
            }
            if(userAndRole.getUser() instanceof Acl.Owner) {
                list.setOwner(new StorageOwner(userAndRole.getUser().getIdentifier(),
                        userAndRole.getUser().getDisplayName()));
            }
            else if(userAndRole.getUser() instanceof Acl.EmailUser) {
                list.grantPermission(new EmailAddressGrantee(userAndRole.getUser().getIdentifier()),
                        Permission.parsePermission(userAndRole.getRole().getName()));
            }
            else if(userAndRole.getUser() instanceof Acl.GroupUser) {
                // Handle special cases
                if(userAndRole.getUser().getIdentifier().equals(Acl.GroupUser.EVERYONE)) {
                    list.grantPermission(GroupGrantee.ALL_USERS,
                            Permission.parsePermission(userAndRole.getRole().getName()));
                }
                else if(userAndRole.getUser().getIdentifier().equals(Acl.GroupUser.AUTHENTICATED)) {
                    list.grantPermission(GroupGrantee.AUTHENTICATED_USERS,
                            Permission.parsePermission(userAndRole.getRole().getName()));
                }
                else {
                    // Generic mappings
                    list.grantPermission(new GroupGrantee(userAndRole.getUser().getIdentifier()),
                            Permission.parsePermission(userAndRole.getRole().getName()));
                }
            }
            else if(userAndRole.getUser() instanceof Acl.CanonicalUser) {
                list.grantPermission(new CanonicalGrantee(userAndRole.getUser().getIdentifier()),
                        Permission.parsePermission(userAndRole.getRole().getName()));
            }
            else {
                log.warn(String.format("Unsupported user %s", userAndRole.getUser()));
            }
        }
        if(null == list.getOwner()) {
            log.warn(String.format("Missing owner in %s", acl));
            return null;
        }
        return list;
    }
@Test
    public void testInvalidOwner() {
        final S3AccessControlListFeature f = new S3AccessControlListFeature(session);
        assertNull(f.toAcl(Acl.EMPTY));
        assertNull(f.toAcl(new Acl(new Acl.UserAndRole(new Acl.Owner(""), new Acl.Role(Acl.Role.FULL)))));
    }