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 2006-2008 Sun Microsystems, Inc. 015 * Portions Copyright 2016 ForgeRock AS. 016 */ 017package org.forgerock.opendj.config.server; 018 019import org.forgerock.i18n.LocalizableException; 020import org.forgerock.i18n.LocalizableMessage; 021 022/** Thrown during the course of interactions with the Directory Server configuration. */ 023public final class ConfigException extends Exception implements LocalizableException { 024 private static final long serialVersionUID = -540463620272921157L; 025 private final LocalizableMessage message; 026 027 /** 028 * Returns the message that explains the problem that occurred. 029 * 030 * @return LocalizableMessage of the problem 031 */ 032 @Override 033 public LocalizableMessage getMessageObject() { 034 return message; 035 } 036 037 /** 038 * Creates a new configuration exception with the provided message. 039 * 040 * @param message 041 * The message to use for this configuration exception. 042 */ 043 public ConfigException(LocalizableMessage message) { 044 super(message.toString()); 045 this.message = message; 046 } 047 048 /** 049 * Creates a new configuration exception with the provided message and 050 * underlying cause. 051 * 052 * @param message 053 * The message to use for this configuration exception. 054 * @param cause 055 * The underlying cause that triggered this configuration 056 * exception. 057 */ 058 public ConfigException(LocalizableMessage message, Throwable cause) { 059 super(message.toString(), cause); 060 this.message = message; 061 } 062 063}