Chris Hillery has proposed merging lp:~zorba-coders/zorba/bug-992304-compile-only into lp:zorba.
Requested reviews: Chris Hillery (ceejatec) Related bugs: Bug #992304 in Zorba: "Executing lib_only query invokes URI resolution process" https://bugs.launchpad.net/zorba/+bug/992304 For more details, see: https://code.launchpad.net/~zorba-coders/zorba/bug-992304-compile-only/+merge/104194 -- https://code.launchpad.net/~zorba-coders/zorba/bug-992304-compile-only/+merge/104194 Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog' --- ChangeLog 2012-04-30 15:09:53 +0000 +++ ChangeLog 2012-05-01 01:02:21 +0000 @@ -44,7 +44,8 @@ * Fixed bug #949910 (has-children may be invoked on all nodes). Internally, zorba::store::Item::getChildren() now returns NULL on node classes without offspring (instead of raising an error). * Fixed Bug #933490: Error ItemFactoryImpl::createBase64Binary with istream * Fixed bug #867112 (Diagnostic Handler was not working on external APIs) - + * Fixed bug #992304 (Compiling library modules could load data from + wrong source) version 2.2 === modified file 'bin/test/mymod.xq' --- bin/test/mymod.xq 2012-04-30 23:31:06 +0000 +++ bin/test/mymod.xq 2012-05-01 01:02:21 +0000 @@ -14,7 +14,7 @@ : limitations under the License. :) -module namespace foo = "http://www.zorba-xquery.com/foo"; +module namespace foo = "http://www.28msec.com/foo"; declare function foo:test() { if (fn:true()) === modified file 'src/compiler/api/compiler_api.cpp' --- src/compiler/api/compiler_api.cpp 2012-04-24 12:39:38 +0000 +++ src/compiler/api/compiler_api.cpp 2012-05-01 01:02:21 +0000 @@ -338,10 +338,8 @@ { public: FakeLibraryModuleURLResolver - (zstring const& aLibraryModuleNamespace, - zstring const& aLibraryModuleFilename, std::istream& aStream) - : theLibraryModuleNamespace(aLibraryModuleNamespace), - theLibraryModuleFilename(aLibraryModuleFilename), + (zstring const& aLibraryModuleFilename, std::istream& aStream) + : theLibraryModuleFilename(aLibraryModuleFilename), theStream(aStream) {} virtual ~FakeLibraryModuleURLResolver() @@ -350,9 +348,14 @@ virtual internal::Resource* resolveURL (zstring const& aUrl, internal::EntityData const* aEntityData) { - if (aUrl != theLibraryModuleNamespace) { - return NULL; - } + // Since we know this URL resolver will only be used when compiling the + // stub query, and the only URI that query will contain is the one we're + // interested in, then we don't actually need to check the URL at all - + // just return the stream. This is a good thing, because due to URI + // mapping, aUrl will probably be different than the one we're expecting. + // If we returned NULL here, Zorba's built-in URL Resolvers would attempt + // to load the resource from somewhere else, and that may result in the + // wrong information being compiled. See bug 992304. assert (theStream.good()); // Pass a nullptr StreamReleaser; memory ownership of the istream remains // with the caller of this method. @@ -362,7 +365,6 @@ } private: - zstring theLibraryModuleNamespace; zstring theLibraryModuleFilename; std::istream& theStream; }; @@ -400,7 +402,7 @@ aXQuery.clear(); aXQuery.seekg(0); FakeLibraryModuleURLResolver* aFakeResolver = - new FakeLibraryModuleURLResolver(lib_namespace.str(), aFileName, aXQuery); + new FakeLibraryModuleURLResolver(aFileName, aXQuery); theCompilerCB->theRootSctx->add_url_resolver(aFakeResolver); // create a dummy main module and parse it
-- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp