if (parameters.length < 1) {
throw parametersMissing(context, "create");
}
Context ctx = getContext();
Any param;
Attributes attrs = null;
if (parameters.length > 1) {
param = parameters[1];
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) {
return new AnyNamingContext(
dirctx.createSubcontext((Name)param.toObject(), attrs));
} else {
return new AnyNamingContext(
dirctx.createSubcontext(param.toString(), attrs));
}
}
param = parameters[0];
if (param instanceof AnyName) {
return new AnyNamingContext(
ctx.createSubcontext((Name)param.toObject()));
} else {
return new AnyNamingContext(
ctx.createSubcontext(param.toString()));
}
} catch (NamingException e) {
throw context.exception(e);
}