001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2016 ForgeRock AS.
015 */
016
017package com.sun.identity.idm;
018
019
020import org.forgerock.opendj.ldap.ResultCode;
021
022/**
023 * The exception class whose instance is thrown if there is any error related with password issue.
024 * @supported.all.api
025 */
026public class PasswordPolicyException extends IdRepoException {
027
028    /**
029     * Create a new password policy exception with a custom error message
030     * @param msg the error message
031     */
032    public PasswordPolicyException(String msg) {
033        super(msg);
034    }
035
036    /**
037     * Create a new Password policy exception
038     * @param resultCode the LDAP error code
039     * @param errorCode the error code
040     * @param args the arguments required for this error code.
041     */
042    public PasswordPolicyException(ResultCode resultCode, String errorCode, Object... args) {
043        super(IdRepoBundle.BUNDLE_NAME, errorCode, String.valueOf(resultCode.intValue()), args);
044    }
045
046    /**
047     * Create a password policy exception from an id repo exception.
048     * @param e the id repo exception
049     */
050    public PasswordPolicyException(IdRepoException e) {
051        super(IdRepoBundle.BUNDLE_NAME, e.getErrorCode(), e.getLDAPErrorCode(), e.getMessageArgs());
052    }
053
054    /**
055     * Create a password policy exception from an id repo exception.
056     * @param e the id repo exception
057     * @param args the arguments required for this error code.
058     */
059    public PasswordPolicyException(IdRepoException e, Object[] args) {
060        super(IdRepoBundle.BUNDLE_NAME, e.getErrorCode(), e.getLDAPErrorCode(), args);
061    }
062
063    /**
064     * Create a new Password policy exception
065     * @param errorCode the error code
066     * @param args the arguments required for this error code.
067     */
068    public PasswordPolicyException(String errorCode, Object[] args) {
069        super(IdRepoBundle.BUNDLE_NAME, errorCode, args);
070    }
071}