throw new NameNotFoundException();
{ NameNotFoundException nnfe = new NameNotFoundException(); nnfe.setRemainingName(cname); throw nnfe; }
    public Object lookup(Name name)        throws NamingException    {        if(Log.isDebugEnabled())Log.debug("Looking up name=\""+name+"\"");        Name cname = toCanonicalName(name);        if ((cname == null) || (cname.size() == 0))        {            Log.debug("Null or empty name, returning copy of this context");            NamingContext ctx = new NamingContext (_env, _name, _parent, _parser);            ctx._bindings = _bindings;            return ctx;        }                  if (cname.size() == 1)        {            Binding binding = getBinding (cname);            if (binding == null)                throw new NameNotFoundException();            Object o = binding.getObject();            //handle links by looking up the link            if (o instanceof LinkRef)            {                //if link name starts with ./ it is relative to current context                String linkName = ((LinkRef)o).getLinkName();                if (linkName.startsWith("./"))                    return this.lookup (linkName.substring(2));                else                {                    //link name is absolute                    InitialContext ictx = new InitialContext();                    return ictx.lookup (linkName);                }            }            else if (o instanceof Reference)            {                //deference the object                try                {                    return NamingManager.getObjectInstance(o, cname, this, _env);                }                catch (NamingException e)                {                    throw e;                }                catch (Exception e)                {                    Log.warn("",e);                    throw new NamingException (e.getMessage());                }            }            else                return o;        }        //it is a multipart name, recurse to the first subcontext           String firstComponent = cname.get(0);        Object ctx = null;        if (firstComponent.equals(""))            ctx = this;        else        {                        Binding binding = getBinding (firstComponent);            if (binding == null)                throw new NameNotFoundException ();                        //as we have bound a reference to an object factory             //for the component specific contexts            //at "comp" we need to resolve the reference            ctx = binding.getObject();                        if (ctx instanceof Reference)            {                  //deference the object                try                {                    ctx = NamingManager.getObjectInstance(ctx, getNameParser("").parse(firstComponent), this, _env);                }                catch (NamingException e)                {                    throw e;                }                catch (Exception e)                {                    Log.warn("",e);                    throw new NamingException (e.getMessage());                }            }        }        if (!(ctx instanceof Context))            throw new NotContextException();        return ((Context)ctx).lookup (cname.getSuffix(1));    }