001    /*
002     * Copyright 2009-2014 UnboundID Corp.
003     * All Rights Reserved.
004     */
005    /*
006     * Copyright (C) 2009-2014 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     */
021    package 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    public final class LDAPSDKUsageException
032           extends LDAPSDKRuntimeException
033    {
034      /**
035       * The serial version UID for this serializable class.
036       */
037      private static final long serialVersionUID = 4488711069492709961L;
038    
039    
040    
041      /**
042       * Creates a new instance of this exception with the provided message.
043       *
044       * @param  message  The message to use for this exception.
045       */
046      public LDAPSDKUsageException(final String message)
047      {
048        super(message);
049      }
050    
051    
052    
053      /**
054       * Creates a new instance of this exception with the provided message and
055       * cause.
056       *
057       * @param  message  The message to use for this exception.
058       * @param  cause    The underlying cause for this exception.  It may be
059       *                  {@code null} if no cause is available.
060       */
061      public LDAPSDKUsageException(final String message, final Throwable cause)
062      {
063        super(message, cause);
064      }
065    
066    
067    
068      /**
069       * {@inheritDoc}
070       */
071      @Override()
072      public void toString(final StringBuilder buffer)
073      {
074        buffer.append("LDAPSDKUsageException(message='");
075        buffer.append(getMessage());
076        buffer.append('\'');
077    
078        final Throwable cause = getCause();
079        if (cause != null)
080        {
081          buffer.append(", cause=");
082          buffer.append(cause.toString());
083        }
084    
085        buffer.append(')');
086      }
087    }