throw new NamingException ("This context is immutable");
{ NamingException ne = new NamingException ("This context is immutable"); ne.setRemainingName(name); throw ne; }
    public Context createSubcontext (Name name)        throws NamingException    {        if (null != _env.get(IMMUTABLE_PROPERTY))            throw new NamingException ("This context is immutable");                        Name cname = toCanonicalName (name);        if (cname == null)            throw new NamingException ("Name is null");        if (cname.size() == 0)            throw new NamingException ("Name is empty");        if (cname.size() == 1)        {            //not permitted to bind if something already bound at that name            Binding binding = getBinding (cname);            if (binding != null)                throw new NameAlreadyBoundException (cname.toString());            Context ctx = new NamingContext ((Hashtable)_env.clone(), cname.get(0), this, _parser);            addBinding (cname, ctx);            return ctx;        }                            //If the name has multiple subcontexts, walk the hierarchy by        //fetching the first one. All intermediate subcontexts in the         //name must already exist.        String firstComponent = cname.get(0);        Object ctx = null;        if (firstComponent.equals(""))            ctx = this;        else        {            Binding binding = getBinding (firstComponent);            if (binding == null)                throw new NameNotFoundException (firstComponent + " is not bound");                        ctx = binding.getObject();                        if (ctx instanceof Reference)            {                  //deference the object                if(Log.isDebugEnabled())Log.debug("Object bound at "+firstComponent +" is a Reference");                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)        {            return ((Context)ctx).createSubcontext (cname.getSuffix(1));        }        else            throw new NotContextException (firstComponent +" is not a Context");    }