if(destination != null) collection.release();
if(destination != null) destination.release();
	public void copy(String collectionPath, String destinationPath, String newName)			throws XMLDBException {		if(!collectionPath.startsWith("/db"))            collectionPath = parent.getPath() + '/' + collectionPath;        if(!destinationPath.startsWith("/db"))            destinationPath = parent.getPath() + '/' + destinationPath;        DBBroker broker = null;        org.exist.collections.Collection collection = null;        org.exist.collections.Collection destination = null;        try {            broker = brokerPool.get(user);            collection = broker.openCollection(collectionPath, Lock.READ_LOCK);            if(collection == null)                throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION, "Collection " + collectionPath + " not found");            destination = broker.openCollection(destinationPath, Lock.WRITE_LOCK);            if(destination == null)                throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION, "Collection " + destinationPath + " not found");            broker.copyCollection(collection, destination, newName);        } catch ( EXistException e ) {        	e.printStackTrace();            throw new XMLDBException( ErrorCodes.VENDOR_ERROR,                "failed to move collection " + collectionPath, e );        } catch ( PermissionDeniedException e ) {            throw new XMLDBException( ErrorCodes.PERMISSION_DENIED,                e.getMessage(), e );        } catch (LockException e) {            throw new XMLDBException( ErrorCodes.PERMISSION_DENIED,                    e.getMessage(), e );        } finally {        	if(collection != null) collection.release();        	if(destination != null) collection.release();            brokerPool.release( broker );        }	}