Merge lp:~zorba-coders/zorba/bug-1009366 into lp:zorba

Proposed by Till Westmann
Status: Merged
Approved by: Chris Hillery
Approved revision: 10878
Merged at revision: 10878
Proposed branch: lp:~zorba-coders/zorba/bug-1009366
Merge into: lp:zorba
Diff against target: 66 lines (+25/-9)
2 files modified
src/compiler/translator/translator.cpp (+18/-7)
test/api/userdefined_uri_resolution.cpp (+7/-2)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1009366
Reviewer Review Type Date Requested Status
Chris Hillery Approve
Markos Zaharioudakis Approve
Review via email: mp+110410@code.launchpad.net

This proposal supersedes a proposal from 2012-06-06.

Commit message

add location information to ZXQP0029_URI_ACCESS_DENIED

Description of the change

add location information to ZXQP0029_URI_ACCESS_DENIED

To post a comment you must log in.
Revision history for this message
Markos Zaharioudakis (markos-za) wrote : Posted in a previous version of this proposal

It is better (more robust) if the catch in translator.cpp catches ZorbaException instead of XQueryException.

Revision history for this message
Chris Hillery (ceejatec) wrote : Posted in a previous version of this proposal

Please add the "correct exception" message back in test_userdefined_uri_resolvers, so that it is clear when the test passes. Also, as it is, if the test fails you will report the exception twice; that's probably not necessary.

Other than that and Markos' comment, looks fine.

Revision history for this message
Till Westmann (tillw) wrote : Posted in a previous version of this proposal

I've changed the catch(...) in translator.cpp and I've put the "correct exception" message back into the test.
However, I don't see why the exception is reported twice, if the test fails.

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-1009366-2012-06-14T20-56-11.007Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 2 Approve, 1 Pending.

Revision history for this message
Chris Hillery (ceejatec) wrote :

I think I mis-read the diff last time when I mentioned the double output of exceptions (I didn't see it as two separate catch() clauses). Latest changes look fine.

review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-1009366-2012-06-14T23-40-03.247Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp 2012-06-14 15:20:15 +0000
+++ src/compiler/translator/translator.cpp 2012-06-14 20:36:35 +0000
@@ -2967,13 +2967,24 @@
2967 // rather than using compURI directly, because we want the version2967 // rather than using compURI directly, because we want the version
2968 // fragment to be passed to the mappers.2968 // fragment to be passed to the mappers.
2969 zstring lErrorMessage;2969 zstring lErrorMessage;
2970 std::auto_ptr<internal::Resource> lResource =2970 std::auto_ptr<internal::Resource> lResource;
2971 theSctx->resolve_uri(compModVer.versioned_uri(),2971 internal::StreamResource* lStreamResource = NULL;
2972 internal::EntityData::MODULE,2972
2973 lErrorMessage);2973 try
29742974 {
2975 internal::StreamResource* lStreamResource =2975 lResource =
2976 dynamic_cast<internal::StreamResource*> (lResource.get());2976 theSctx->resolve_uri(compModVer.versioned_uri(),
2977 internal::EntityData::MODULE,
2978 lErrorMessage);
2979
2980 lStreamResource =
2981 dynamic_cast<internal::StreamResource*> (lResource.get());
2982 }
2983 catch (ZorbaException& e)
2984 {
2985 set_source(e, loc);
2986 throw;
2987 }
29772988
2978 if (lStreamResource != NULL)2989 if (lStreamResource != NULL)
2979 {2990 {
29802991
=== modified file 'test/api/userdefined_uri_resolution.cpp'
--- test/api/userdefined_uri_resolution.cpp 2012-06-14 15:20:15 +0000
+++ test/api/userdefined_uri_resolution.cpp 2012-06-14 20:36:35 +0000
@@ -21,6 +21,7 @@
21#include <zorba/zorba.h>21#include <zorba/zorba.h>
22#include <zorba/store_manager.h>22#include <zorba/store_manager.h>
23#include <zorba/zorba_exception.h>23#include <zorba/zorba_exception.h>
24#include <zorba/xquery_exception.h>
24#include <zorba/uri_resolvers.h>25#include <zorba/uri_resolvers.h>
25#include <zorba/diagnostic_list.h>26#include <zorba/diagnostic_list.h>
2627
@@ -297,12 +298,16 @@
297 "'http://expath.org/ns/file'; "298 "'http://expath.org/ns/file'; "
298 "1 + 1", lContext);299 "1 + 1", lContext);
299 std::cout << lQuery << std::endl;300 std::cout << lQuery << std::endl;
300 } catch (ZorbaException& e) {301 } catch (XQueryException& e) {
301 std::cout << "Caught exception: " << e.what() << std::endl;302 std::cout << "Caught exception: " << e.what() << std::endl;
302 if (e.diagnostic() == zerr::ZXQP0029_URI_ACCESS_DENIED) {303 if (e.diagnostic() == zerr::ZXQP0029_URI_ACCESS_DENIED
304 && e.has_source()
305 && e.source_line() == 1) {
303 std::cout << "...the correct exception!" << std::endl;306 std::cout << "...the correct exception!" << std::endl;
304 return true;307 return true;
305 }308 }
309 } catch (ZorbaException& e) {
310 std::cout << "Caught unexpected exception: " << e.what() << std::endl;
306 }311 }
307 return false;312 return false;
308}313}

Subscribers

People subscribed via source and target branches