if (parameters.length < 2) {
throw parametersMissing(context, "rebind");
}
Context ctx = getContext();
Any param;
Object value = parameters[1].toObject();
Attributes attrs = null;
if (parameters.length > 2) {
param = parameters[2];
if (param instanceof AnyAttributes) {
attrs = (Attributes)param.toObject();
}
}
try {
if ((attrs != null) && (ctx instanceof DirContext)) {
DirContext dirctx = (DirContext)ctx;
param = parameters[0];
if (param instanceof AnyName) {
dirctx.rebind((Name)param.toObject(), value, attrs);
} else {
dirctx.rebind(param.toString(), value, attrs);
}
return this;
}
param = parameters[0];
if (param instanceof AnyName) {
ctx.rebind((Name)param.toObject(), value);
} else {
ctx.rebind(param.toString(), value);
}
} catch (NamingException e) {
throw context.exception(e);
}