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