2
|
1 |
/*
|
5506
|
2 |
* Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
|
2
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
5506
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
5506
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
2
|
24 |
*/
|
|
25 |
|
|
26 |
package javax.naming.directory;
|
|
27 |
|
|
28 |
import javax.naming.NamingException;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* This exception is thrown when an attempt is
|
|
32 |
* made to add, or remove, or modify an attribute, its identifier,
|
|
33 |
* or its values that conflicts with the attribute's (schema) definition
|
|
34 |
* or the attribute's state.
|
|
35 |
* It is thrown in response to DirContext.modifyAttributes().
|
|
36 |
* It contains a list of modifications that have not been performed, in the
|
|
37 |
* order that they were supplied to modifyAttributes().
|
|
38 |
* If the list is null, none of the modifications were performed successfully.
|
|
39 |
*<p>
|
|
40 |
* An AttributeModificationException instance is not synchronized
|
|
41 |
* against concurrent multithreaded access. Multiple threads trying
|
|
42 |
* to access and modify a single AttributeModification instance
|
|
43 |
* should lock the object.
|
|
44 |
*
|
|
45 |
* @author Rosanna Lee
|
|
46 |
* @author Scott Seligman
|
|
47 |
*
|
|
48 |
* @see DirContext#modifyAttributes
|
|
49 |
* @since 1.3
|
|
50 |
*/
|
|
51 |
|
|
52 |
/*
|
|
53 |
*<p>
|
|
54 |
* The serialized form of an AttributeModificationException object
|
|
55 |
* consists of the serialized fields of its NamingException
|
|
56 |
* superclass, followed by an array of ModificationItem objects.
|
|
57 |
*
|
|
58 |
*/
|
|
59 |
|
|
60 |
|
|
61 |
public class AttributeModificationException extends NamingException {
|
|
62 |
/**
|
|
63 |
* Contains the possibly null list of unexecuted modifications.
|
|
64 |
* @serial
|
|
65 |
*/
|
|
66 |
private ModificationItem[] unexecs = null;
|
|
67 |
|
|
68 |
/**
|
|
69 |
* Constructs a new instance of AttributeModificationException using
|
|
70 |
* an explanation. All other fields are set to null.
|
|
71 |
*
|
|
72 |
* @param explanation Possibly null additional detail about this exception.
|
|
73 |
* If null, this exception has no detail message.
|
|
74 |
|
|
75 |
* @see java.lang.Throwable#getMessage
|
|
76 |
*/
|
|
77 |
public AttributeModificationException(String explanation) {
|
|
78 |
super(explanation);
|
|
79 |
}
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Constructs a new instance of AttributeModificationException.
|
|
83 |
* All fields are set to null.
|
|
84 |
*/
|
|
85 |
public AttributeModificationException() {
|
|
86 |
super();
|
|
87 |
}
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Sets the unexecuted modification list to be e.
|
|
91 |
* Items in the list must appear in the same order in which they were
|
|
92 |
* originally supplied in DirContext.modifyAttributes().
|
|
93 |
* The first item in the list is the first one that was not executed.
|
|
94 |
* If this list is null, none of the operations originally submitted
|
|
95 |
* to modifyAttributes() were executed.
|
|
96 |
|
|
97 |
* @param e The possibly null list of unexecuted modifications.
|
|
98 |
* @see #getUnexecutedModifications
|
|
99 |
*/
|
|
100 |
public void setUnexecutedModifications(ModificationItem[] e) {
|
|
101 |
unexecs = e;
|
|
102 |
}
|
|
103 |
|
|
104 |
/**
|
|
105 |
* Retrieves the unexecuted modification list.
|
|
106 |
* Items in the list appear in the same order in which they were
|
|
107 |
* originally supplied in DirContext.modifyAttributes().
|
|
108 |
* The first item in the list is the first one that was not executed.
|
|
109 |
* If this list is null, none of the operations originally submitted
|
|
110 |
* to modifyAttributes() were executed.
|
|
111 |
|
|
112 |
* @return The possibly null unexecuted modification list.
|
|
113 |
* @see #setUnexecutedModifications
|
|
114 |
*/
|
|
115 |
public ModificationItem[] getUnexecutedModifications() {
|
|
116 |
return unexecs;
|
|
117 |
}
|
|
118 |
|
|
119 |
/**
|
|
120 |
* The string representation of this exception consists of
|
|
121 |
* information about where the error occurred, and
|
|
122 |
* the first unexecuted modification.
|
|
123 |
* This string is meant for debugging and not mean to be interpreted
|
|
124 |
* programmatically.
|
|
125 |
* @return The non-null string representation of this exception.
|
|
126 |
*/
|
|
127 |
public String toString() {
|
|
128 |
String orig = super.toString();
|
|
129 |
if (unexecs != null) {
|
|
130 |
orig += ("First unexecuted modification: " +
|
|
131 |
unexecs[0].toString());
|
|
132 |
}
|
|
133 |
return orig;
|
|
134 |
}
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Use serialVersionUID from JNDI 1.1.1 for interoperability
|
|
138 |
*/
|
|
139 |
private static final long serialVersionUID = 8060676069678710186L;
|
|
140 |
}
|