e.printStackTrace();
throw new XPathException(getASTNode(), e.getMessage(), e);
	public Sequence eval(Sequence contextSequence, Item contextItem)			throws XPathException {		if (contextItem != null)			contextSequence = contextItem.toSequence();		Sequence inSeq = select.eval(contextSequence);		if (inSeq.getLength() == 0)			return Sequence.EMPTY_SEQUENCE;		if (!Type.subTypeOf(inSeq.getItemType(), Type.NODE))			throw new XPathException(getASTNode(), Messages.getMessage(Error.UPDATE_SELECT_TYPE));				Sequence contentSeq = value.eval(contextSequence);		if (contentSeq.getLength() == 0)			throw new XPathException(getASTNode(), Messages.getMessage(Error.UPDATE_EMPTY_CONTENT));		String newName = contentSeq.itemAt(0).getStringValue();		try {            NodeImpl[] ql = selectAndLock(inSeq.toNodeSet());            DocumentImpl doc = null;            Collection collection = null, prevCollection = null;            DocumentSet modifiedDocs = new DocumentSet();            NodeImpl node;            NodeImpl parent;            IndexListener listener = new IndexListener(ql);            for (int i = 0; i < ql.length; i++) {                node = ql[i];                doc = (DocumentImpl) node.getOwnerDocument();                collection = doc.getCollection();                if (prevCollection != null && collection != prevCollection)                        doc.getBroker().saveCollection(prevCollection);                if (!collection.getPermissions().validate(context.getUser(),                        Permission.UPDATE))                        throw new XPathException(getASTNode(),                                "write access to collection denied; user="                                        + context.getUser().getName());                if (!doc.getPermissions().validate(context.getUser(),                        Permission.UPDATE))                        throw new XPathException(getASTNode(),                                "permission denied to update document");                doc.setIndexListener(listener);                modifiedDocs.add(doc);                parent = (NodeImpl) node.getParentNode();                switch (node.getNodeType()) {                    case Node.ELEMENT_NODE:                        ((ElementImpl) node).setNodeName(new QName(newName, "",                                null));                        parent.updateChild(node, node);                        break;                    case Node.ATTRIBUTE_NODE:                        ((AttrImpl) node).setNodeName(new QName(newName, "",                                null));                        parent.updateChild(node, node);                        break;                    default:                        throw new XPathException(getASTNode(), "unsupported node-type");                }                doc.clearIndexListener();                doc.setLastModified(System.currentTimeMillis());                prevCollection = collection;            }            if (doc != null) doc.getBroker().saveCollection(collection);            checkFragmentation(modifiedDocs);        } catch (PermissionDeniedException e) {			// TODO Auto-generated catch block			e.printStackTrace();		} catch (EXistException e) {			// TODO Auto-generated catch block			e.printStackTrace();		} catch (LockException e) {			// TODO Auto-generated catch block			e.printStackTrace();		} catch (XPathException e) {			// TODO Auto-generated catch block			e.printStackTrace();		} finally {            unlockDocuments();        }		return Sequence.EMPTY_SEQUENCE;	}