From: <pka...@us...> - 2009-01-30 06:30:34
|
Revision: 8540 http://exist.svn.sourceforge.net/exist/?rev=8540&view=rev Author: pkaminsk2 Date: 2009-01-30 06:30:15 +0000 (Fri, 30 Jan 2009) Log Message: ----------- Fixed NPE when calling function through util:eval called from a module. Modified Paths: -------------- trunk/eXist/src/org/exist/xquery/FunctionCall.java trunk/eXist/src/org/exist/xquery/ModuleContext.java Modified: trunk/eXist/src/org/exist/xquery/FunctionCall.java =================================================================== --- trunk/eXist/src/org/exist/xquery/FunctionCall.java 2009-01-29 11:06:09 UTC (rev 8539) +++ trunk/eXist/src/org/exist/xquery/FunctionCall.java 2009-01-30 06:30:15 UTC (rev 8540) @@ -96,7 +96,10 @@ private void updateFunction() { if (functionDef.getContext() instanceof ModuleContext) { ModuleContext modContext = (ModuleContext) functionDef.getContext(); - if (modContext.getParentContext() != context) { + // util:eval will stuff non-module function declarations into a module context sometimes, + // so watch out for those and ignore them. + if (functionDef.getName().getNamespaceURI().equals(modContext.getModuleNamespace()) && + modContext.getParentContext() != context) { UserDefinedFunction replacementFunctionDef = ((ExternalModule) context.getModule(functionDef.getName().getNamespaceURI())) .getFunction(functionDef.getName(), getArgumentCount()); Modified: trunk/eXist/src/org/exist/xquery/ModuleContext.java =================================================================== --- trunk/eXist/src/org/exist/xquery/ModuleContext.java 2009-01-29 11:06:09 UTC (rev 8539) +++ trunk/eXist/src/org/exist/xquery/ModuleContext.java 2009-01-30 06:30:15 UTC (rev 8540) @@ -55,6 +55,10 @@ loadDefaults(broker.getConfiguration()); } + String getModuleNamespace() { + return moduleNamespace; + } + void setModulesChanged() { parentContext.setModulesChanged(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |