001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
005 *
006 * The contents of this file are subject to the terms
007 * of the Common Development and Distribution License
008 * (the License). You may not use this file except in
009 * compliance with the License.
010 *
011 * You can obtain a copy of the License at
012 * https://opensso.dev.java.net/public/CDDLv1.0.html or
013 * opensso/legal/CDDLv1.0.txt
014 * See the License for the specific language governing
015 * permission and limitations under the License.
016 *
017 * When distributing Covered Code, include this CDDL
018 * Header Notice in each file and include the License file
019 * at opensso/legal/CDDLv1.0.txt.
020 * If applicable, add the following below the CDDL Header,
021 * with the fields enclosed by brackets [] replaced by
022 * your own identifying information:
023 * "Portions Copyrighted [year] [name of copyright owner]"
024 *
025 * $Id: EventException.java,v 1.3 2008/06/25 05:41:38 qcheng Exp $
026 *
027 */
028
029package com.iplanet.services.ldap.event;
030
031import java.io.PrintStream;
032import java.io.PrintWriter;
033
034import com.iplanet.services.ldap.LDAPServiceException;
035
036/**
037 * Exception occurs while setting an event request or when trigering the
038 * "entryChanged()" method after a persistent search results are received from
039 * the Directory Server.
040 * @supported.api
041 */
042public class EventException extends LDAPServiceException {
043
044    /**
045     * Holds the message assocuated with this exception, if present.
046     */
047    private String _message = "";
048
049    /**
050     * Constructs a EventException with no detail message and no nested
051     * exception. public EventException() { super(); }
052     */
053
054    /**
055     * Constructs a EventException with a detail message.
056     * 
057     * @param msg
058     *            Message string for the exception 
059     * @supported.api
060     */
061    public EventException(String msg) {
062        super(msg);
063        _message = msg;
064    }
065
066    /**
067     * Constructor with message string and an embedded exception Constructs a
068     * EventException with the given detail message and nested exception.
069     * 
070     * @param msg
071     *            Message string
072     * @param t
073     *            The embedded exception 
074     * @supported.api
075     */
076    public EventException(String msg, Throwable t) {
077        super(msg, t);
078        _message = msg;
079    }
080
081    /**
082     * Returns a string representation of this EventException, including the
083     * detail message (if present);
084     * 
085     * @return a string representation of this EventException, including its
086     *         detail message, if present.
087     * @supported.api
088     */
089    public String toString() {
090        return super.toString()
091                + (_message == null ? "" : " [message: " + _message + "]");
092    }
093
094    /**
095     * Returns a string representation of the message in the this EventException
096     * (if present)
097     * 
098     * @return a string representation of the detailed message, if present.
099     *        
100     * @supported.api
101     */
102    public String getMessage() {
103        return _message;
104    }
105
106    /**
107     * Prints a stack trace for this EventException to System.out;
108     *
109     * @supported.api
110     */
111    public void printStackTrace() {
112        super.printStackTrace();
113    }
114
115    /**
116     * Prints a stack trace for this EventException to the given PrintStream;
117     * 
118     * @param printStream
119     *            a PrintStream to print the stack trace out to.
120     *           
121     * @supported.api
122     */
123    public void printStackTrace(PrintStream printStream) {
124        super.printStackTrace(printStream);
125    }
126
127    /**
128     * Prints a stack trace for this EventException to the given PrintWriter;
129     * 
130     * @param printWriter
131     *            a PrintWriter to print the stack trace out to.
132     *           
133     * @supported.api
134     */
135    public void printStackTrace(PrintWriter printWriter) {
136        super.printStackTrace(printWriter);
137    }
138}




























































Copyright © 2010-2017, ForgeRock All Rights Reserved.