base/common/src/main/com/thesett/common/jndi/SimpleContext.java
public void rename(String oldname, String newname) throws NamingException
    {
        if ("".equals(oldname) || "".equals(newname))
        {
            throw new InvalidNameException("Cannot rename empty name");
        }

        // Check if new name exists
        if (bindings.get(newname) != null)
        {
            throw new NameAlreadyBoundException(newname + " is already bound");
        }

        // Check if old name is bound
        Object oldBinding = bindings.remove(oldname);

        if (oldBinding == null)
        {
            throw new NameNotFoundException(oldname + " not bound");
        }

        bindings.put(newname, oldBinding);
    }
public void rename(String oldname, String newname) throws NamingException
    {
        if ("".equals(oldname) || "".equals(newname))
        {
            throw new InvalidNameException("Cannot rename empty name");
        }

        // Check if new name exists
        if (bindings.get(newname) != null)
        {
            throw new NameAlreadyBoundException(newname + " is already bound");
        }

        // Check if old name is bound
        Object oldBinding = bindings.remove(oldname);

        if (oldBinding == null)
        {
            throw new NameNotFoundException(oldname + " not bound");
        }

        bindings.put(newname, oldBinding);
    }
public void rename ( String oldname , String newname ) throws NamingException { if ( "" . equals ( oldname ) || "" . equals ( newname ) ) { throw new InvalidNameException ( "Cannot rename empty name" ) ; } // Check if new name exists if ( bindings . get ( newname ) != null ) { throw new NameAlreadyBoundException ( newname + " is already bound" ) ; } // Check if old name is bound Object oldBinding = bindings . remove ( oldname ) ; if ( oldBinding == null ) { throw new NameNotFoundException ( oldname + " not bound" ) ; } bindings . put ( newname , oldBinding ) ; }
Binds a new name to the object bound to an old name, and unbinds the old name. Both names are relative to this
context. Any attributes associated with the old name become associated with the new name. Intermediate contexts
of the old name are not changed.

@param  oldname The name of the existing binding; may not be empty.
@param  newname The new name of the binding; may not be empty.

@throws NamingException If newname is bound, oldname cannot be found or one of the names is illegal.
Binds a new name to the object bound to an old name and unbinds the old name . Both names are relative to this context . Any attributes associated with the old name become associated with the new name . Intermediate contexts of the old name are not changed .