DBBroker broker = brokerPool.get();
DBBroker broker = null;
	public String getDocument(		User user,		String name,		boolean prettyPrint,		String encoding,		String stylesheet)		throws Exception {		long start = System.currentTimeMillis();		DBBroker broker = brokerPool.get();		try {			DocumentImpl doc = (DocumentImpl) broker.getDocument(user, name);			if (doc == null) {				LOG.debug("document " + name + " not found!");				throw new EXistException("document not found");			}			Serializer serializer = broker.getSerializer();			Map properties = new TreeMap();			properties.put(Serializer.ENCODING, encoding);			properties.put(				Serializer.PRETTY_PRINT,				Boolean.toString(prettyPrint));			serializer.setProperties(properties);			if (stylesheet != null) {				if (!stylesheet.startsWith("/")) {					// make path relative to current collection					String collection;					if (doc.getCollection() != null)						collection = doc.getCollection().getName();					else {						int cp = doc.getFileName().lastIndexOf("/");						collection =							(cp > 0) ? doc.getFileName().substring(0, cp) : "/";					}					stylesheet =						(collection.equals("/")							? '/' + stylesheet							: collection + '/' + stylesheet);				}				serializer.setStylesheet(stylesheet);			}			String xml = serializer.serialize(doc);			return xml;		} catch (NoSuchMethodError nsme) {			nsme.printStackTrace();			return null;		} finally {			brokerPool.release(broker);		}	}