XPathTreeParser2 treeParser = new XPathTreeParser2(brokerPool, context);
XPathTreeParser2 treeParser = new XPathTreeParser2(context);
	protected ResourceSet doQuery(String query, DocumentSet docs, 		NodeSet contextSet, String sortExpr)		throws XMLDBException {		try {			XPathLexer2 lexer = new XPathLexer2(new StringReader(query));			XPathParser2 parser = new XPathParser2(lexer);			XPathTreeParser2 treeParser = new XPathTreeParser2(brokerPool, context);						parser.xpath();			if(parser.foundErrors()) {				throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR,					parser.getErrorMessage());			}			AST ast = parser.getAST();			LOG.debug("generated AST: " + ast.toStringTree());						PathExpr expr = new PathExpr(brokerPool);			treeParser.xpath(ast, expr);			if(treeParser.foundErrors()) {				throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR,					treeParser.getErrorMessage());			}									LOG.info("query: " + expr.pprint());			long start = System.currentTimeMillis();			//if (parser.foundErrors())			//	throw new XMLDBException(ErrorCodes.VENDOR_ERROR, parser.getErrorMsg());			Value resultValue = null;			docs = (docs == null ? expr.preselect() : expr.preselect(docs));			if (docs.getLength() == 0)				resultValue = new ValueNodeSet(NodeSet.EMPTY_SET);			else 				resultValue = expr.eval(context, docs, contextSet, null);			LOG.info(				expr.pprint()					+ " found: "					+ resultValue.getLength()					+ " in "					+ (System.currentTimeMillis() - start)					+ "ms.");			LocalResourceSet result =				new LocalResourceSet(					user,					brokerPool,					collection,					resultValue,					properties,					sortExpr);			return result;		} catch (antlr.RecognitionException re) {			throw new XMLDBException(ErrorCodes.VENDOR_ERROR, re.getMessage(), re);		} catch (antlr.TokenStreamException te) {			throw new XMLDBException(ErrorCodes.VENDOR_ERROR, te.getMessage(), te);		} catch (IllegalArgumentException e) {			throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e);		} catch (XPathException e) {			throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e);		}	}