Name fullName = new CompositeName(name);
Context currentContext = ic;
while (fullName.size() > 1) {
// Make contexts that are not already present
try {
currentContext = currentContext
.createSubcontext(fullName.get(0));
} catch (NamingException err) {
currentContext = (Context) currentContext
.lookup(fullName.get(0));
}