summaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/naming
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/javax/naming')
-rw-r--r--libjava/classpath/javax/naming/CompositeName.java28
-rw-r--r--libjava/classpath/javax/naming/CompoundName.java34
-rw-r--r--libjava/classpath/javax/naming/InitialContext.java9
-rw-r--r--libjava/classpath/javax/naming/Reference.java14
-rw-r--r--libjava/classpath/javax/naming/directory/BasicAttribute.java8
-rw-r--r--libjava/classpath/javax/naming/directory/BasicAttributes.java59
-rw-r--r--libjava/classpath/javax/naming/ldap/InitialLdapContext.java6
-rw-r--r--libjava/classpath/javax/naming/spi/Resolver.java13
8 files changed, 98 insertions, 73 deletions
diff --git a/libjava/classpath/javax/naming/CompositeName.java b/libjava/classpath/javax/naming/CompositeName.java
index 612932152da..7227f9d78e4 100644
--- a/libjava/classpath/javax/naming/CompositeName.java
+++ b/libjava/classpath/javax/naming/CompositeName.java
@@ -58,16 +58,16 @@ public class CompositeName implements Name, Cloneable, Serializable
{
private static final long serialVersionUID = 1667768148915813118L;
- private transient Vector elts;
+ private transient Vector<String> elts;
public CompositeName ()
{
- elts = new Vector ();
+ elts = new Vector<String> ();
}
protected CompositeName (Enumeration<String> comps)
{
- elts = new Vector ();
+ elts = new Vector<String> ();
try
{
while (comps.hasMoreElements ())
@@ -80,7 +80,7 @@ public class CompositeName implements Name, Cloneable, Serializable
public CompositeName (String n) throws InvalidNameException
{
- elts = new Vector ();
+ elts = new Vector<String> ();
// Parse the string into its components.
final char no_quote = 'x'; // Use 'x' to mean no quoting.
char quote = no_quote;
@@ -151,7 +151,7 @@ public class CompositeName implements Name, Cloneable, Serializable
public Name addAll (int posn, Name n) throws InvalidNameException
{
- Enumeration e = n.getAll ();
+ Enumeration<String> e = n.getAll ();
try
{
while (e.hasMoreElements ())
@@ -168,7 +168,7 @@ public class CompositeName implements Name, Cloneable, Serializable
public Name addAll (Name suffix) throws InvalidNameException
{
- Enumeration e = suffix.getAll ();
+ Enumeration<String> e = suffix.getAll ();
try
{
while (e.hasMoreElements ())
@@ -193,8 +193,8 @@ public class CompositeName implements Name, Cloneable, Serializable
int last = Math.min (cn.elts.size (), elts.size ());
for (int i = 0; i < last; ++i)
{
- String f = (String) elts.get (i);
- int comp = f.compareTo ((String) cn.elts.get (i));
+ String f = elts.get (i);
+ int comp = f.compareTo (cn.elts.get (i));
if (comp != 0)
return comp;
}
@@ -227,7 +227,7 @@ public class CompositeName implements Name, Cloneable, Serializable
public String get (int posn)
{
- return (String) elts.get (posn);
+ return elts.get (posn);
}
public Enumeration<String> getAll ()
@@ -239,7 +239,7 @@ public class CompositeName implements Name, Cloneable, Serializable
{
CompositeName cn = new CompositeName ();
for (int i = 0; i < posn; ++i)
- cn.elts.add ((String) elts.get (i));
+ cn.elts.add (elts.get (i));
return cn;
}
@@ -249,7 +249,7 @@ public class CompositeName implements Name, Cloneable, Serializable
throw new ArrayIndexOutOfBoundsException (posn);
CompositeName cn = new CompositeName ();
for (int i = posn; i < elts.size (); ++i)
- cn.elts.add ((String) elts.get (i));
+ cn.elts.add (elts.get (i));
return cn;
}
@@ -299,7 +299,7 @@ public class CompositeName implements Name, Cloneable, Serializable
{
// For simplicity we choose to always quote using escapes and
// never quotes.
- String elt = (String) elts.get (i);
+ String elt = elts.get (i);
if (i > 0
|| (i == elts.size () - 1 && elt.equals ("")))
result.append ('/');
@@ -327,9 +327,9 @@ public class CompositeName implements Name, Cloneable, Serializable
throws IOException, ClassNotFoundException
{
int size = s.readInt();
- elts = new Vector(size);
+ elts = new Vector<String>(size);
for (int i = 0; i < size; i++)
- elts.add(s.readObject());
+ elts.add((String) s.readObject());
}
private void writeObject(ObjectOutputStream s) throws IOException
diff --git a/libjava/classpath/javax/naming/CompoundName.java b/libjava/classpath/javax/naming/CompoundName.java
index 703d44e4700..f345d3efd50 100644
--- a/libjava/classpath/javax/naming/CompoundName.java
+++ b/libjava/classpath/javax/naming/CompoundName.java
@@ -68,14 +68,14 @@ public class CompoundName implements Name, Cloneable, Serializable
private CompoundName (Properties syntax)
{
- elts = new Vector ();
+ elts = new Vector<String> ();
mySyntax = syntax;
initializeSyntax ();
}
protected CompoundName (Enumeration<String> comps, Properties syntax)
{
- elts = new Vector ();
+ elts = new Vector<String> ();
mySyntax = syntax;
initializeSyntax ();
try
@@ -91,7 +91,7 @@ public class CompoundName implements Name, Cloneable, Serializable
public CompoundName (String n, Properties syntax)
throws InvalidNameException
{
- elts = new Vector ();
+ elts = new Vector<String> ();
mySyntax = syntax;
initializeSyntax ();
@@ -186,7 +186,7 @@ public class CompoundName implements Name, Cloneable, Serializable
int len = elts.size ();
for (i = 0; i < len / 2; ++i)
{
- Object t = elts.set (i, elts.get (len - i - 1));
+ String t = elts.set (i, elts.get (len - i - 1));
elts.set (len - i - 1, t);
}
}
@@ -210,7 +210,7 @@ public class CompoundName implements Name, Cloneable, Serializable
public Name addAll (int posn, Name n) throws InvalidNameException
{
- Enumeration e = n.getAll ();
+ Enumeration<String> e = n.getAll ();
try
{
while (e.hasMoreElements ())
@@ -227,7 +227,7 @@ public class CompoundName implements Name, Cloneable, Serializable
public Name addAll (Name suffix) throws InvalidNameException
{
- Enumeration e = suffix.getAll ();
+ Enumeration<String> e = suffix.getAll ();
try
{
while (e.hasMoreElements ())
@@ -252,8 +252,8 @@ public class CompoundName implements Name, Cloneable, Serializable
int last = Math.min (cn.elts.size (), elts.size ());
for (int i = 0; i < last; ++i)
{
- String f = canonicalize ((String) elts.get (i));
- int comp = f.compareTo (canonicalize ((String) cn.elts.get (i)));
+ String f = canonicalize (elts.get (i));
+ int comp = f.compareTo (canonicalize (cn.elts.get (i)));
if (comp != 0)
return comp;
}
@@ -270,8 +270,8 @@ public class CompoundName implements Name, Cloneable, Serializable
int delta = elts.size () - cn.elts.size ();
for (int i = 0; i < cn.elts.size (); ++i)
{
- String f = canonicalize ((String) elts.get (delta + i));
- if (! f.equals (canonicalize ((String) cn.elts.get (i))))
+ String f = canonicalize (elts.get (delta + i));
+ if (! f.equals (canonicalize (cn.elts.get (i))))
return false;
}
return true;
@@ -286,7 +286,7 @@ public class CompoundName implements Name, Cloneable, Serializable
public String get (int posn)
{
- return (String) elts.get (posn);
+ return elts.get (posn);
}
public Enumeration<String> getAll ()
@@ -316,7 +316,7 @@ public class CompoundName implements Name, Cloneable, Serializable
{
int h = 0;
for (int i = 0; i < elts.size (); ++i)
- h += canonicalize ((String) elts.get (i)).hashCode ();
+ h += canonicalize (elts.get (i)).hashCode ();
return h;
}
@@ -344,8 +344,8 @@ public class CompoundName implements Name, Cloneable, Serializable
return false;
for (int i = 0; i < cn.elts.size (); ++i)
{
- String f = canonicalize ((String) elts.get (i));
- if (! f.equals (canonicalize ((String) cn.elts.get (i))))
+ String f = canonicalize (elts.get (i));
+ if (! f.equals (canonicalize (cn.elts.get (i))))
return false;
}
return true;
@@ -383,7 +383,7 @@ public class CompoundName implements Name, Cloneable, Serializable
// Find the appropriate element. FIXME: not clear what FLAT
// means.
int offset = (direction == RIGHT_TO_LEFT) ? (size - i - 1) : i;
- String element = (String) elts.get (offset);
+ String element = elts.get (offset);
if (i > 0
|| (i == size - 1 && element.equals ("")))
result.append (separator);
@@ -478,7 +478,7 @@ public class CompoundName implements Name, Cloneable, Serializable
{
mySyntax = (Properties) s.readObject();
int count = s.readInt();
- elts = new Vector(count);
+ elts = new Vector<String>(count);
for (int i = 0; i < count; i++)
elts.addElement((String) s.readObject());
}
@@ -499,7 +499,7 @@ public class CompoundName implements Name, Cloneable, Serializable
protected transient Properties mySyntax;
// The actual elements.
- private transient Vector elts;
+ private transient Vector<String> elts;
// The following are all used for syntax.
private transient int direction;
diff --git a/libjava/classpath/javax/naming/InitialContext.java b/libjava/classpath/javax/naming/InitialContext.java
index 1a3b1e38b03..a5fe5f0cf3a 100644
--- a/libjava/classpath/javax/naming/InitialContext.java
+++ b/libjava/classpath/javax/naming/InitialContext.java
@@ -80,14 +80,14 @@ public class InitialContext implements Context
* be appended after the colon to the first possible value. Used in
* {@link #merge(Hashtable, Hashtable)}
*/
- static final HashSet colon_list;
+ static final HashSet<String> colon_list;
static
{
- colon_list = new HashSet();
+ colon_list = new HashSet<String>();
colon_list.add(Context.OBJECT_FACTORIES);
colon_list.add(Context.URL_PKG_PREFIXES);
colon_list.add(Context.STATE_FACTORIES);
- };
+ }
/**
* The properties that are searched in the agreed places in the
@@ -262,7 +262,8 @@ public class InitialContext implements Context
* in this table.
* @param additional the second table, from where additional values are taken
*/
- static void merge (Hashtable primary, Hashtable additional)
+ static void merge (Hashtable<Object, Object> primary,
+ Hashtable<Object, Object> additional)
{
Enumeration en = additional.keys();
diff --git a/libjava/classpath/javax/naming/Reference.java b/libjava/classpath/javax/naming/Reference.java
index 3379bd5a837..fedbf589b83 100644
--- a/libjava/classpath/javax/naming/Reference.java
+++ b/libjava/classpath/javax/naming/Reference.java
@@ -83,7 +83,7 @@ public class Reference implements Cloneable, Serializable
public Reference (String className)
{
this.className = className;
- addrs = new Vector ();
+ addrs = new Vector<RefAddr> ();
}
/**
@@ -93,7 +93,7 @@ public class Reference implements Cloneable, Serializable
public Reference (String className, RefAddr addr)
{
this.className = className;
- addrs = new Vector ();
+ addrs = new Vector<RefAddr> ();
addrs.add (addr);
}
@@ -112,7 +112,7 @@ public class Reference implements Cloneable, Serializable
this.className = className;
this.classFactory = factoryClassName;
this.classFactoryLocation = factoryLocation;
- addrs = new Vector ();
+ addrs = new Vector<RefAddr> ();
}
/**
@@ -131,7 +131,7 @@ public class Reference implements Cloneable, Serializable
this.className = className;
this.classFactory = factoryClassName;
this.classFactoryLocation = factoryLocation;
- addrs = new Vector ();
+ addrs = new Vector<RefAddr> ();
addrs.add (addr);
}
@@ -164,7 +164,7 @@ public class Reference implements Cloneable, Serializable
{
Reference r = new Reference (className, classFactory,
classFactoryLocation);
- r.addrs = (Vector) addrs.clone ();
+ r.addrs = (Vector<RefAddr>) addrs.clone ();
return r;
}
@@ -193,7 +193,7 @@ public class Reference implements Cloneable, Serializable
*/
public RefAddr get (int posn)
{
- return (RefAddr) addrs.get (posn);
+ return addrs.get (posn);
}
/**
@@ -208,7 +208,7 @@ public class Reference implements Cloneable, Serializable
{
for (int i = 0; i < addrs.size (); ++i)
{
- RefAddr r = (RefAddr) addrs.get (i);
+ RefAddr r = addrs.get (i);
if (addrType.equals (r.getType ()))
return r;
}
diff --git a/libjava/classpath/javax/naming/directory/BasicAttribute.java b/libjava/classpath/javax/naming/directory/BasicAttribute.java
index 5a1bb0e881f..2715c9672ba 100644
--- a/libjava/classpath/javax/naming/directory/BasicAttribute.java
+++ b/libjava/classpath/javax/naming/directory/BasicAttribute.java
@@ -78,7 +78,7 @@ public class BasicAttribute implements Attribute
{
attrID = id;
this.ordered = ordered;
- values = new Vector ();
+ values = new Vector<Object> ();
}
public BasicAttribute (String id, Object value)
@@ -90,7 +90,7 @@ public class BasicAttribute implements Attribute
{
attrID = id;
this.ordered = ordered;
- values = new Vector ();
+ values = new Vector<Object> ();
values.add (value);
}
@@ -118,7 +118,7 @@ public class BasicAttribute implements Attribute
BasicAttribute c = new BasicAttribute ();
c.attrID = attrID;
c.ordered = ordered;
- c.values = (Vector) values.clone ();
+ c.values = (Vector<Object>) values.clone ();
return c;
}
@@ -307,7 +307,7 @@ public class BasicAttribute implements Attribute
{
s.defaultReadObject();
int size = s.readInt();
- values = new Vector(size);
+ values = new Vector<Object>(size);
for (int i=0; i < size; i++)
values.add(s.readObject());
}
diff --git a/libjava/classpath/javax/naming/directory/BasicAttributes.java b/libjava/classpath/javax/naming/directory/BasicAttributes.java
index 6880f5b3362..54b1f197b0e 100644
--- a/libjava/classpath/javax/naming/directory/BasicAttributes.java
+++ b/libjava/classpath/javax/naming/directory/BasicAttributes.java
@@ -63,7 +63,7 @@ public class BasicAttributes implements Attributes
public BasicAttributes (boolean ignoreCase)
{
this.ignoreCase = ignoreCase;
- this.attributes = new Vector ();
+ this.attributes = new Vector<Attribute>();
}
public BasicAttributes (String attrID, Object val)
@@ -74,7 +74,7 @@ public class BasicAttributes implements Attributes
public BasicAttributes (String attrID, Object val, boolean ignoreCase)
{
this.ignoreCase = ignoreCase;
- attributes = new Vector ();
+ attributes = new Vector<Attribute>();
attributes.add (new BasicAttribute (attrID, val));
}
@@ -82,7 +82,7 @@ public class BasicAttributes implements Attributes
{
// Slightly inefficient as we make a garbage Vector here.
BasicAttributes ba = new BasicAttributes (ignoreCase);
- ba.attributes = (Vector) attributes.clone ();
+ ba.attributes = (Vector<Attribute>) attributes.clone ();
return ba;
}
@@ -117,7 +117,7 @@ public class BasicAttributes implements Attributes
{
for (int i = 0; i < attributes.size (); ++i)
{
- Attribute at = (Attribute) attributes.get (i);
+ Attribute at = attributes.get (i);
if ((ignoreCase && attrID.equalsIgnoreCase (at.getID ()))
|| (! ignoreCase && attrID.equals (at.getID ())))
return at;
@@ -128,12 +128,38 @@ public class BasicAttributes implements Attributes
public NamingEnumeration<Attribute> getAll ()
{
- return new BasicAttributesEnumeration (false);
+ return new BasicAttributesEnumeration();
}
public NamingEnumeration<String> getIDs ()
{
- return new BasicAttributesEnumeration (true);
+ final NamingEnumeration<Attribute> attrs = getAll();
+ return new NamingEnumeration<String>() {
+ public boolean hasMore() throws NamingException
+ {
+ return attrs.hasMore();
+ }
+
+ public boolean hasMoreElements()
+ {
+ return attrs.hasMoreElements();
+ }
+
+ public String next() throws NamingException
+ {
+ return attrs.next().getID();
+ }
+
+ public String nextElement()
+ {
+ return attrs.nextElement().getID();
+ }
+
+ public void close() throws NamingException
+ {
+ attrs.close();
+ }
+ };
}
public int hashCode ()
@@ -197,16 +223,16 @@ public class BasicAttributes implements Attributes
// This is set by the serialization spec.
private boolean ignoreCase;
// Package-private to avoid a trampoline.
- transient Vector attributes;
+ transient Vector<Attribute> attributes;
private void readObject(ObjectInputStream s) throws IOException,
ClassNotFoundException
{
s.defaultReadObject();
int size = s.readInt();
- attributes = new Vector(size);
+ attributes = new Vector<Attribute>(size);
for (int i = 0; i < size; i++)
- attributes.add(s.readObject());
+ attributes.add((Attribute) s.readObject());
}
private void writeObject(ObjectOutputStream s) throws IOException
@@ -218,14 +244,13 @@ public class BasicAttributes implements Attributes
}
// Used when enumerating.
- private class BasicAttributesEnumeration implements NamingEnumeration
+ private class BasicAttributesEnumeration
+ implements NamingEnumeration<Attribute>
{
int where = 0;
- boolean id;
- public BasicAttributesEnumeration (boolean id)
+ public BasicAttributesEnumeration ()
{
- this.id = id;
}
public void close () throws NamingException
@@ -237,7 +262,7 @@ public class BasicAttributes implements Attributes
return hasMoreElements ();
}
- public Object next () throws NamingException
+ public Attribute next () throws NamingException
{
return nextElement ();
}
@@ -247,13 +272,13 @@ public class BasicAttributes implements Attributes
return where < attributes.size ();
}
- public Object nextElement () throws NoSuchElementException
+ public Attribute nextElement () throws NoSuchElementException
{
if (where >= attributes.size ())
throw new NoSuchElementException ("no more elements");
- Attribute at = (Attribute) attributes.get (where);
+ Attribute at = attributes.get (where);
++where;
- return id ? (Object) at.getID () : (Object) at;
+ return at;
}
}
}
diff --git a/libjava/classpath/javax/naming/ldap/InitialLdapContext.java b/libjava/classpath/javax/naming/ldap/InitialLdapContext.java
index f9493c3b29c..1a29c6ae840 100644
--- a/libjava/classpath/javax/naming/ldap/InitialLdapContext.java
+++ b/libjava/classpath/javax/naming/ldap/InitialLdapContext.java
@@ -66,13 +66,13 @@ public class InitialLdapContext
{
super (false);
- Hashtable myenv = null;
+ Hashtable<Object, Object> myenv = null;
if (connControls != null)
{
if (environment == null)
- myenv = new Hashtable ();
+ myenv = new Hashtable<Object, Object> ();
else
- myenv = (Hashtable) environment.clone ();
+ myenv = (Hashtable<Object, Object>) environment.clone ();
myenv.put ("java.naming.ldap.control.connect",
connControls);
}
diff --git a/libjava/classpath/javax/naming/spi/Resolver.java b/libjava/classpath/javax/naming/spi/Resolver.java
index f01790502ed..67174cfa5a5 100644
--- a/libjava/classpath/javax/naming/spi/Resolver.java
+++ b/libjava/classpath/javax/naming/spi/Resolver.java
@@ -41,15 +41,14 @@ package javax.naming.spi;
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.NamingException;
-import javax.naming.NotContextException;
/**
-+ * <p>Represents the object, capable for the at least partial name resolution.
-+ * The object is not necessay capable for the complete name resolution and
-+ * need not implement the {@link Context}.</p>
-+ * <p>
-+ * Both passed parameters and returned results are owned by the caller.</p>
-+ *
+ * <p>Represents the object, capable for the at least partial name resolution.
+ * The object is not necessay capable for the complete name resolution and
+ * need not implement the {@link Context}.</p>
+ * <p>
+ * Both passed parameters and returned results are owned by the caller.</p>
+ *
* @author Warren Levy (warrenl@redhat.com)
*/
public interface Resolver