From: Wolfgang M. M. <wol...@us...> - 2004-07-17 10:01:08
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6205/src/org/exist/xquery Modified Files: ModuleContext.java XQueryContext.java Log Message: Exception thrown when resolving global module variables. Index: XQueryContext.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/XQueryContext.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** XQueryContext.java 16 Jul 2004 12:39:04 -0000 1.20 --- XQueryContext.java 17 Jul 2004 10:00:44 -0000 1.21 *************** *** 117,121 **** private DocumentSet staticDocuments = null; ! private DBBroker broker; private String baseURI = ""; --- 117,121 ---- private DocumentSet staticDocuments = null; ! protected DBBroker broker; private String baseURI = ""; *************** *** 157,168 **** private boolean exclusive = false; ! public XQueryContext(DBBroker broker) { ! this.broker = broker; this.watchdog = new XQueryWatchDog(this); - loadDefaults(); builder = new MemTreeBuilder(this); builder.startDocument(); } /** * Called from the XQuery compiler to set the root expression --- 157,172 ---- private boolean exclusive = false; ! protected XQueryContext() { this.watchdog = new XQueryWatchDog(this); builder = new MemTreeBuilder(this); builder.startDocument(); } + public XQueryContext(DBBroker broker) { + this(); + this.broker = broker; + loadDefaults(); + } + /** * Called from the XQuery compiler to set the root expression *************** *** 403,407 **** */ public Module loadBuiltInModule(String namespaceURI, String moduleClass) { ! Module module = (Module)modules.get(namespaceURI); if (module != null) { LOG.debug("module " + namespaceURI + " is already present"); --- 407,411 ---- */ public Module loadBuiltInModule(String namespaceURI, String moduleClass) { ! Module module = getModule(namespaceURI); if (module != null) { LOG.debug("module " + namespaceURI + " is already present"); *************** *** 542,546 **** Variable var; // first, check if the variable is declared in a module ! Module module = (Module) modules.get(qname.getNamespaceURI()); if(module != null) { var = module.resolveVariable(qname); --- 546,550 ---- Variable var; // first, check if the variable is declared in a module ! Module module = getModule(qname.getNamespaceURI()); if(module != null) { var = module.resolveVariable(qname); *************** *** 770,774 **** public void importModule(String namespaceURI, String prefix, String location) throws XPathException { ! Module module = (Module)modules.get(namespaceURI); if(module != null) { LOG.debug("Module " + namespaceURI + " already present."); --- 774,778 ---- public void importModule(String namespaceURI, String prefix, String location) throws XPathException { ! Module module = getModule(namespaceURI); if(module != null) { LOG.debug("Module " + namespaceURI + " already present."); *************** *** 889,893 **** * internal functions. */ ! private void loadDefaults() { SymbolTable syms = broker.getSymbols(); String[] pfx = syms.defaultPrefixList(); --- 893,897 ---- * internal functions. */ ! protected void loadDefaults() { SymbolTable syms = broker.getSymbols(); String[] pfx = syms.defaultPrefixList(); Index: ModuleContext.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/ModuleContext.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ModuleContext.java 15 Jul 2004 19:43:23 -0000 1.1 --- ModuleContext.java 17 Jul 2004 10:00:44 -0000 1.2 *************** *** 10,13 **** --- 10,14 ---- import org.exist.dom.DocumentSet; + import org.exist.memtree.MemTreeBuilder; *************** *** 26,31 **** */ public ModuleContext(XQueryContext parentContext) { ! super(parentContext.getBroker()); this.parentContext = parentContext; } --- 27,34 ---- */ public ModuleContext(XQueryContext parentContext) { ! super(); this.parentContext = parentContext; + this.broker = parentContext.getBroker(); + loadDefaults(); } |