Path: blob/master/src/java.naming/share/classes/javax/naming/directory/AttributeModificationException.java
41159 views
/*1* Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.naming.directory;2627import javax.naming.NamingException;2829/**30* This exception is thrown when an attempt is31* made to add, or remove, or modify an attribute, its identifier,32* or its values that conflicts with the attribute's (schema) definition33* or the attribute's state.34* It is thrown in response to DirContext.modifyAttributes().35* It contains a list of modifications that have not been performed, in the36* order that they were supplied to modifyAttributes().37* If the list is null, none of the modifications were performed successfully.38*<p>39* An AttributeModificationException instance is not synchronized40* against concurrent multithreaded access. Multiple threads trying41* to access and modify a single AttributeModification instance42* should lock the object.43*44* @author Rosanna Lee45* @author Scott Seligman46*47* @see DirContext#modifyAttributes48* @since 1.349*/5051/*52*<p>53* The serialized form of an AttributeModificationException object54* consists of the serialized fields of its NamingException55* superclass, followed by an array of ModificationItem objects.56*57*/585960public class AttributeModificationException extends NamingException {61/**62* Contains the possibly null list of unexecuted modifications.63* @serial64*/65private ModificationItem[] unexecs = null;6667/**68* Constructs a new instance of AttributeModificationException using69* an explanation. All other fields are set to null.70*71* @param explanation Possibly null additional detail about this exception.72* If null, this exception has no detail message.7374* @see java.lang.Throwable#getMessage75*/76public AttributeModificationException(String explanation) {77super(explanation);78}7980/**81* Constructs a new instance of AttributeModificationException.82* All fields are set to null.83*/84public AttributeModificationException() {85super();86}8788/**89* Sets the unexecuted modification list to be e.90* Items in the list must appear in the same order in which they were91* originally supplied in DirContext.modifyAttributes().92* The first item in the list is the first one that was not executed.93* If this list is null, none of the operations originally submitted94* to modifyAttributes() were executed.9596* @param e The possibly null list of unexecuted modifications.97* @see #getUnexecutedModifications98*/99public void setUnexecutedModifications(ModificationItem[] e) {100unexecs = e;101}102103/**104* Retrieves the unexecuted modification list.105* Items in the list appear in the same order in which they were106* originally supplied in DirContext.modifyAttributes().107* The first item in the list is the first one that was not executed.108* If this list is null, none of the operations originally submitted109* to modifyAttributes() were executed.110111* @return The possibly null unexecuted modification list.112* @see #setUnexecutedModifications113*/114public ModificationItem[] getUnexecutedModifications() {115return unexecs;116}117118/**119* The string representation of this exception consists of120* information about where the error occurred, and121* the first unexecuted modification.122* This string is meant for debugging and not mean to be interpreted123* programmatically.124* @return The non-null string representation of this exception.125*/126public String toString() {127String orig = super.toString();128if (unexecs != null) {129orig += ("First unexecuted modification: " +130unexecs[0].toString());131}132return orig;133}134135/**136* Use serialVersionUID from JNDI 1.1.1 for interoperability137*/138private static final long serialVersionUID = 8060676069678710186L;139}140141142