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

Proposed by Till Westmann on 2012-06-06
Status: Superseded
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 2012-06-06 Pending
Markos Zaharioudakis 2012-06-06 Pending
Review via email: mp+108894@code.launchpad.net

This proposal has been superseded by a proposal from 2012-06-14.

Description of the Change

add location information to ZXQP0029_URI_ACCESS_DENIED

To post a comment you must log in.
Markos Zaharioudakis (markos-za) wrote :

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

lp:~zorba-coders/zorba/bug-1009366 updated on 2012-06-09
10868. By Paul J. Lucas on 2012-06-08

s/ZORBA_ASSERT/if/ Approved: Matthias Brantner, Paul J. Lucas

10869. By Paul J. Lucas on 2012-06-09

1. Fixed return type of ft:thesaurus-lookup().
2. Added a test to ensure that a look-up of a non-existant word works. Approved: Matthias Brantner, Paul J. Lucas

Chris Hillery (ceejatec) wrote :

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.

lp:~zorba-coders/zorba/bug-1009366 updated on 2012-06-14
10870. By Rodolfo Ochoa on 2012-06-12

- Install added for XQJ bindings and documentation
- more documentation for all SWIG generated language bindings
- other installer related cleanups Approved: Matthias Brantner, Chris Hillery, Juan Zacarias

10871. By Markos Zaharioudakis on 2012-06-14

fixed bug #1006166 Approved: Markos Zaharioudakis

10872. By Markos Zaharioudakis on 2012-06-14

fixed bug 960083$ (improper error handling of NaN comparisons) + small optimization of comparison operations Approved: Markos Zaharioudakis

10873. By Carlos Manuel Lopez on 2012-06-14

Implements new group by syntax, as defined in the XQuery 3.0 Spec since September 2011 Approved: Markos Zaharioudakis

10874. By Markos Zaharioudakis on 2012-06-14

Fixed bug #1003023$ (optimizer problems due to common subexpression after var folding into if-then-else) Approved: Markos Zaharioudakis

10875. By Markos Zaharioudakis on 2012-06-14

fixed bug #854506 and partial fix for bug #867008 Approved: Markos Zaharioudakis

10876. By Markos Zaharioudakis on 2012-06-14

Improved hoist rule: tighter hoisting of expressions (also fixes bug #967428) Approved: Markos Zaharioudakis

10877. By Markos Zaharioudakis on 2012-06-14

Fixed bug #991088$ (raise XUST0001 in trycatch with mixed updating and simple clauses)
 Approved: Markos Zaharioudakis

10878. By Till Westmann on 2012-06-14

add location information to ZXQP0029_URI_ACCESS_DENIED

Till Westmann (tillw) wrote :

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.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/compiler/translator/translator.cpp'
2--- src/compiler/translator/translator.cpp 2012-06-14 15:20:15 +0000
3+++ src/compiler/translator/translator.cpp 2012-06-14 20:32:20 +0000
4@@ -2967,13 +2967,24 @@
5 // rather than using compURI directly, because we want the version
6 // fragment to be passed to the mappers.
7 zstring lErrorMessage;
8- std::auto_ptr<internal::Resource> lResource =
9- theSctx->resolve_uri(compModVer.versioned_uri(),
10- internal::EntityData::MODULE,
11- lErrorMessage);
12-
13- internal::StreamResource* lStreamResource =
14- dynamic_cast<internal::StreamResource*> (lResource.get());
15+ std::auto_ptr<internal::Resource> lResource;
16+ internal::StreamResource* lStreamResource = NULL;
17+
18+ try
19+ {
20+ lResource =
21+ theSctx->resolve_uri(compModVer.versioned_uri(),
22+ internal::EntityData::MODULE,
23+ lErrorMessage);
24+
25+ lStreamResource =
26+ dynamic_cast<internal::StreamResource*> (lResource.get());
27+ }
28+ catch (ZorbaException& e)
29+ {
30+ set_source(e, loc);
31+ throw;
32+ }
33
34 if (lStreamResource != NULL)
35 {
36
37=== modified file 'test/api/userdefined_uri_resolution.cpp'
38--- test/api/userdefined_uri_resolution.cpp 2012-06-14 15:20:15 +0000
39+++ test/api/userdefined_uri_resolution.cpp 2012-06-14 20:32:20 +0000
40@@ -21,6 +21,7 @@
41 #include <zorba/zorba.h>
42 #include <zorba/store_manager.h>
43 #include <zorba/zorba_exception.h>
44+#include <zorba/xquery_exception.h>
45 #include <zorba/uri_resolvers.h>
46 #include <zorba/diagnostic_list.h>
47
48@@ -297,12 +298,16 @@
49 "'http://expath.org/ns/file'; "
50 "1 + 1", lContext);
51 std::cout << lQuery << std::endl;
52- } catch (ZorbaException& e) {
53+ } catch (XQueryException& e) {
54 std::cout << "Caught exception: " << e.what() << std::endl;
55- if (e.diagnostic() == zerr::ZXQP0029_URI_ACCESS_DENIED) {
56+ if (e.diagnostic() == zerr::ZXQP0029_URI_ACCESS_DENIED
57+ && e.has_source()
58+ && e.source_line() == 1) {
59 std::cout << "...the correct exception!" << std::endl;
60 return true;
61 }
62+ } catch (ZorbaException& e) {
63+ std::cout << "Caught unexpected exception: " << e.what() << std::endl;
64 }
65 return false;
66 }

Subscribers

People subscribed via source and target branches