List of usage examples for javax.naming NameAlreadyBoundException NameAlreadyBoundException
public NameAlreadyBoundException()
From source file:org.olat.core.util.servlets.VFSDirContext.java
/** * 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. * //from w w w. j ava 2 s . com * @param oldName the name of the existing binding; may not be empty * @param newName the name of the new binding; may not be empty * @exception NameAlreadyBoundException if newName is already bound * @exception NamingException if a naming exception is encountered */ @Override public void rename(String oldName, String newName) throws NamingException { VFSItem oldFile = resolveFile(oldName); if (oldFile == null) throw new NamingException(smgr.getString("resources.notFound", oldName)); VFSItem newFile = resolveFile(newName); if (newFile != null) throw new NameAlreadyBoundException(); VFSStatus status = oldFile.rename(newName); if (status == VFSConstants.NO) throw new NameAlreadyBoundException(); }