} long startTime = System.currentTimeMillis(); IndexInfo info = collection.validate(txn, broker, path, new InputSource(new ByteArrayInputStream(data)));
} long startTime = System.currentTimeMillis();   IndexInfo info = collection.validateXMLResource(txn, broker, path, new InputSource(new ByteArrayInputStream(data)));
    public void store(java.lang.String sessionId, byte[] data, java.lang.String encoding, java.lang.String path, boolean replace) throws java.rmi.RemoteException {		Session session = getSession(sessionId);		DBBroker broker = null;        TransactionManager transact = pool.getTransactionManager();        Txn txn = transact.beginTransaction();		try {			broker = pool.get(session.getUser());            ///TODO : use dedicated function in XmldbURI			int p = path.lastIndexOf("/");			if (p == Constants.STRING_NOT_FOUND || p == path.length() - 1) {                transact.abort(txn);				throw new RemoteException("Illegal document path");            }			String collectionName = path.substring(0, p);			path = path.substring(p + 1);			Collection collection = broker.getCollection(collectionName);			if (collection == null) {                transact.abort(txn);				throw new EXistException("Collection " + collectionName + " not found");            }			if(!replace) {				DocumentImpl old = collection.getDocument(broker, path);				if(old != null) {                    transact.abort(txn);					throw new RemoteException("Document exists and overwrite is not allowed");                }			}			long startTime = System.currentTimeMillis();            IndexInfo info = collection.validate(txn, broker, path, new InputSource(new ByteArrayInputStream(data)));//??            IndexInfo info = collection.validateXMLResource(txn, broker, path, new InputSource(new ByteArrayInputStream(data)));            info.getDocument().getMetadata().setMimeType("text/xml");            collection.store(txn, broker, info, new InputSource(new ByteArrayInputStream(data)), false);            transact.commit(txn);			LOG.debug(				"parsing "					+ path					+ " took "					+ (System.currentTimeMillis() - startTime)					+ "ms.");		} catch (Exception e) {            transact.abort(txn);			LOG.debug(e);			throw new RemoteException(e.getMessage(), e);		} finally {			pool.release(broker);		}	}