src/share/classes/javax/naming/directory/BasicAttribute.java
Print this page
*** 89,106 ****
* A flag for recording whether this attribute's values are ordered.
* @serial
*/
protected boolean ordered = false;
public Object clone() {
BasicAttribute attr;
try {
attr = (BasicAttribute)super.clone();
} catch (CloneNotSupportedException e) {
attr = new BasicAttribute(attrID, ordered);
}
! attr.values = (Vector)values.clone();
return attr;
}
/**
* Determines whether obj is equal to this attribute.
--- 89,107 ----
* A flag for recording whether this attribute's values are ordered.
* @serial
*/
protected boolean ordered = false;
+ @SuppressWarnings("unchecked")
public Object clone() {
BasicAttribute attr;
try {
attr = (BasicAttribute)super.clone();
} catch (CloneNotSupportedException e) {
attr = new BasicAttribute(attrID, ordered);
}
! attr.values = (Vector<Object>)values.clone();
return attr;
}
/**
* Determines whether obj is equal to this attribute.
*** 147,157 ****
return false;
}
}
} else {
// order is not relevant; check for existence
! Enumeration theirs = target.getAll();
while (theirs.hasMoreElements()) {
if (find(theirs.nextElement()) < 0)
return false;
}
}
--- 148,158 ----
return false;
}
}
} else {
// order is not relevant; check for existence
! Enumeration<?> theirs = target.getAll();
while (theirs.hasMoreElements()) {
if (find(theirs.nextElement()) < 0)
return false;
}
}
*** 213,223 ****
StringBuffer answer = new StringBuffer(attrID + ": ");
if (values.size() == 0) {
answer.append("No values");
} else {
boolean start = true;
! for (Enumeration e = values.elements(); e.hasMoreElements(); ) {
if (!start)
answer.append(", ");
answer.append(e.nextElement());
start = false;
}
--- 214,224 ----
StringBuffer answer = new StringBuffer(attrID + ": ");
if (values.size() == 0) {
answer.append("No values");
} else {
boolean start = true;
! for (Enumeration<Object> e = values.elements(); e.hasMoreElements(); ) {
if (!start)
answer.append(", ");
answer.append(e.nextElement());
start = false;
}
*** 252,262 ****
* @param ordered true means the attribute's values will be ordered;
* false otherwise.
*/
public BasicAttribute(String id, boolean ordered) {
attrID = id;
! values = new Vector();
this.ordered = ordered;
}
/**
* Constructs a new instance of a possibly ordered attribute with a
--- 253,263 ----
* @param ordered true means the attribute's values will be ordered;
* false otherwise.
*/
public BasicAttribute(String id, boolean ordered) {
attrID = id;
! values = new Vector<>();
this.ordered = ordered;
}
/**
* Constructs a new instance of a possibly ordered attribute with a
*** 325,335 ****
}
// For finding first element that has a null in JDK1.1 Vector.
// In the Java 2 platform, can just replace this with Vector.indexOf(target);
private int find(Object target) {
! Class cl;
if (target == null) {
int ct = values.size();
for (int i = 0 ; i < ct ; i++) {
if (values.elementAt(i) == null)
return i;
--- 326,336 ----
}
// For finding first element that has a null in JDK1.1 Vector.
// In the Java 2 platform, can just replace this with Vector.indexOf(target);
private int find(Object target) {
! Class<?> cl;
if (target == null) {
int ct = values.size();
for (int i = 0 ; i < ct ; i++) {
if (values.elementAt(i) == null)
return i;
*** 512,530 ****
*/
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException {
s.defaultReadObject(); // read in the attrID
int n = s.readInt(); // number of values
! values = new Vector(n);
while (--n >= 0) {
values.addElement(s.readObject());
}
}
class ValuesEnumImpl implements NamingEnumeration<Object> {
! Enumeration list;
ValuesEnumImpl() {
list = values.elements();
}
--- 513,531 ----
*/
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException {
s.defaultReadObject(); // read in the attrID
int n = s.readInt(); // number of values
! values = new Vector<>(n);
while (--n >= 0) {
values.addElement(s.readObject());
}
}
class ValuesEnumImpl implements NamingEnumeration<Object> {
! Enumeration<Object> list;
ValuesEnumImpl() {
list = values.elements();
}