001/* 002 * Copyright 2009-2017 UnboundID Corp. 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2009-2017 UnboundID Corp. 007 * 008 * This program is free software; you can redistribute it and/or modify 009 * it under the terms of the GNU General Public License (GPLv2 only) 010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 011 * as published by the Free Software Foundation. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Public License for more details. 017 * 018 * You should have received a copy of the GNU General Public License 019 * along with this program; if not, see <http://www.gnu.org/licenses>. 020 */ 021package com.unboundid.util; 022 023 024 025/** 026 * This class provides a runtime exception that may be thrown by the LDAP SDK 027 * if it detects a problem with the usage of the SDK itself (e.g., a 028 * {@code null} value provided for an argument that must not be {@code null}, or 029 * an argument value that violates a documented constraint). 030 */ 031@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 032public final class LDAPSDKUsageException 033 extends LDAPSDKRuntimeException 034{ 035 /** 036 * The serial version UID for this serializable class. 037 */ 038 private static final long serialVersionUID = 4488711069492709961L; 039 040 041 042 /** 043 * Creates a new instance of this exception with the provided message. 044 * 045 * @param message The message to use for this exception. 046 */ 047 public LDAPSDKUsageException(final String message) 048 { 049 super(message); 050 } 051 052 053 054 /** 055 * Creates a new instance of this exception with the provided message and 056 * cause. 057 * 058 * @param message The message to use for this exception. 059 * @param cause The underlying cause for this exception. It may be 060 * {@code null} if no cause is available. 061 */ 062 public LDAPSDKUsageException(final String message, final Throwable cause) 063 { 064 super(message, cause); 065 } 066 067 068 069 /** 070 * {@inheritDoc} 071 */ 072 @Override() 073 public void toString(final StringBuilder buffer) 074 { 075 buffer.append("LDAPSDKUsageException(message='"); 076 buffer.append(getMessage()); 077 buffer.append('\''); 078 079 final Throwable cause = getCause(); 080 if (cause != null) 081 { 082 buffer.append(", cause="); 083 buffer.append(cause.toString()); 084 } 085 086 buffer.append(')'); 087 } 088}