You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Angela Schreiber (Jira)" <ji...@apache.org> on 2021/01/29 08:41:00 UTC

[jira] [Created] (SLING-10103) UserUtil.disableUser throws IllegalArgumentException for null reason

Angela Schreiber created SLING-10103:
----------------------------------------

             Summary: UserUtil.disableUser throws IllegalArgumentException for null reason
                 Key: SLING-10103
                 URL: https://issues.apache.org/jira/browse/SLING-10103
             Project: Sling
          Issue Type: Bug
          Components: Repoinit
            Reporter: Angela Schreiber


{code}
public static boolean disableUser(Session session, String id, String reason) throws RepositoryException {
        if (reason == null) {
            throw new IllegalArgumentException("reason can't be null");
        }
        ....
    }
{code}

i am not sure why this throws an exception, but i know for sure that a null reason is a valid argument in {{User.disable(String}}.

{code}
/**
     * Disable this user thus preventing future login if the <code>reason</code>
     * is a non-null String.<br>
     * Note however, that this user will still be accessible by
     * {@link UserManager#getAuthorizable}.
     *
     * @param reason String describing the reason for disable this user or
     * <code>null</code> if the user account should be enabled again.
     * @throws RepositoryException If an error occurs.
     */
    void disable(@Nullable String reason) throws RepositoryException;
{code}

i would suggest to remove that check.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)