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

Proposed by Matthias Brantner
Status: Superseded
Proposed branch: lp:~zorba-coders/zorba/bug-955135
Merge into: lp:zorba
Diff against target: 168 lines (+51/-21)
8 files modified
ChangeLog (+2/-0)
src/compiler/translator/translator.cpp (+17/-8)
src/runtime/core/constructors.cpp (+26/-13)
src/runtime/core/constructors.h (+2/-0)
test/rbkt/ExpQueryResults/zorba/trycatch/trycatch12.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/trycatch/trycatch13.xml.res (+1/-0)
test/rbkt/Queries/zorba/trycatch/trycatch12.xq (+1/-0)
test/rbkt/Queries/zorba/trycatch/trycatch13.xq (+1/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-955135
Reviewer Review Type Date Requested Status
Matthias Brantner Pending
Ghislain Fourny Pending
Review via email: mp+97470@code.launchpad.net

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

Commit message

fixed bug 955135 (err:XQDY0044 not caught by try-catch expressions)

Description of the change

fixed bug 955135 (err:XQDY0044 not caught by try-catch expressions)

To post a comment you must log in.
lp:~zorba-coders/zorba/bug-955135 updated
10722. By Matthias Brantner

fixes bug #955170 (Catch clause with URILiteral-based wilcard NameTest)

10723. By Matthias Brantner

optimization to prevent checking for error scenarios on every nextImpl call

10724. By Matthias Brantner

fixed a bug that occurred in the AttributeIterator if used together with the plan serializer

10725. By Matthias Brantner

merge with trunk

10726. By Ghislain Fourny

Merged trunk back.

10727. By Ghislain Fourny

Extraneous merge line.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-03-12 20:01:39 +0000
3+++ ChangeLog 2012-03-14 17:59:20 +0000
4@@ -39,6 +39,8 @@
5 of the annotations map in expressions.
6
7 Bug Fixes/Other Changes:
8+ * Fixed bug 955170 (Catch clause with URILiteral-based wilcard NameTest)
9+ * Fixed bug 955135 (err:XQDY0044 not caught by try-catch expressions)
10 * Fixed bug 923015 (clone() not implemented for full-text expressions)
11 * Fixed bug 917923 (bug in copying outer var values into the eval dynamic context)
12 * Fixed bug 867509 (Can not handle largest xs:unsignedLong values)
13
14=== modified file 'src/compiler/translator/translator.cpp'
15--- src/compiler/translator/translator.cpp 2012-03-07 14:22:29 +0000
16+++ src/compiler/translator/translator.cpp 2012-03-14 17:59:20 +0000
17@@ -9044,16 +9044,25 @@
18 case ParseConstants::wild_all:
19 cc->add_nametest_h(new NodeNameTest(zstring(), zstring()));
20 break;
21- case ParseConstants::wild_elem: {
22+ case ParseConstants::wild_elem:
23+ {
24 // bugfix #3138633; expand the qname and use the namespace instead of the prefix
25 zstring localname(":wildcard");
26- store::Item_t qnItem;
27- theSctx->expand_qname(qnItem,
28- theSctx->default_elem_type_ns(),
29- wildcard->getNsOrPrefix(),
30- localname,
31- wildcard->get_location());
32- cc->add_nametest_h(new NodeNameTest(qnItem->getNamespace(), zstring()));
33+
34+ if (wildcard->isEQnameMatch())
35+ {
36+ cc->add_nametest_h(new NodeNameTest(wildcard->getNsOrPrefix(), zstring()));
37+ }
38+ else
39+ {
40+ store::Item_t qnItem;
41+ theSctx->expand_qname(qnItem,
42+ theSctx->default_elem_type_ns(),
43+ wildcard->getNsOrPrefix(),
44+ localname,
45+ wildcard->get_location());
46+ cc->add_nametest_h(new NodeNameTest(qnItem->getNamespace(), zstring()));
47+ }
48 break;
49 }
50 case ParseConstants::wild_prefix:
51
52=== modified file 'src/runtime/core/constructors.cpp'
53--- src/runtime/core/constructors.cpp 2012-02-15 10:25:02 +0000
54+++ src/runtime/core/constructors.cpp 2012-03-14 17:59:20 +0000
55@@ -543,22 +543,22 @@
56 BinaryBaseIterator<AttributeIterator, PlanIteratorState>(sctx, loc, qnameIte, valueIte),
57 theQName(qname),
58 theIsId(false),
59- theIsRoot(isRoot)
60+ theIsRoot(isRoot),
61+ theRaiseXQDY0074(false),
62+ theRaiseXQDY0044(false)
63 {
64- if (theQName != NULL)
65+ if (theQName)
66 {
67 if (theQName->getLocalName().empty())
68 {
69- RAISE_ERROR(err::XQDY0074, loc,
70- ERROR_PARAMS("", ZED(NoEmptyLocalname)));
71+ theRaiseXQDY0074 = true;
72 }
73
74 if (ZSTREQ(theQName->getNamespace(), "http://www.w3.org/2000/xmlns/") ||
75 (theQName->getNamespace().empty() &&
76 ZSTREQ(theQName->getLocalName(), "xmlns")))
77 {
78- RAISE_ERROR(err::XQDY0044, loc,
79- ERROR_PARAMS(theQName->getStringValue()));
80+ theRaiseXQDY0044 = true;
81 }
82
83 if ((ZSTREQ(theQName->getNamespace(), "http://www.w3.org/XML/1998/namespace") &&
84@@ -567,8 +567,7 @@
85 (ZSTREQ(theQName->getPrefix(), "xml") &&
86 !ZSTREQ(theQName->getNamespace(), "http://www.w3.org/XML/1998/namespace")))
87 {
88- RAISE_ERROR(err::XQDY0044, loc,
89- ERROR_PARAMS(theQName->getStringValue()));
90+ theRaiseXQDY0044 = true;
91 }
92
93 if ((ZSTREQ(theQName->getNamespace(), "http://www.w3.org/2000/xmlns/") &&
94@@ -577,11 +576,7 @@
95 (ZSTREQ(theQName->getPrefix(), "xmlns") &&
96 !ZSTREQ(theQName->getNamespace(), "http://www.w3.org/2000/xmlns/")))
97 {
98- throw XQUERY_EXCEPTION(
99- err::XQDY0044,
100- ERROR_PARAMS( theQName->getStringValue() ),
101- ERROR_LOC( loc )
102- );
103+ theRaiseXQDY0044 = true;
104 }
105
106 if (ZSTREQ(theQName->getPrefix(), "xml") &&
107@@ -616,6 +611,24 @@
108 PlanIteratorState* state;
109 DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
110
111+ if (theQName != NULL)
112+ {
113+ // need to raise those errors here and not in the constructor
114+ // because they are dynamic errors and might be caught by try-catch
115+ // (bug 955135)
116+ if (theRaiseXQDY0074)
117+ {
118+ RAISE_ERROR(err::XQDY0074, loc,
119+ ERROR_PARAMS("", ZED(NoEmptyLocalname)));
120+ }
121+
122+ if (theRaiseXQDY0044)
123+ {
124+ RAISE_ERROR(err::XQDY0044, loc,
125+ ERROR_PARAMS(theQName->getStringValue()));
126+ }
127+ }
128+
129 if (theChild0 != NULL)
130 {
131 // Compute the attribute name. Note: we don't have to check that itemQName
132
133=== modified file 'src/runtime/core/constructors.h'
134--- src/runtime/core/constructors.h 2012-01-11 17:30:25 +0000
135+++ src/runtime/core/constructors.h 2012-03-14 17:59:20 +0000
136@@ -170,6 +170,8 @@
137 store::Item_t theQName;
138 bool theIsId;
139 bool theIsRoot;
140+ bool theRaiseXQDY0074;
141+ bool theRaiseXQDY0044;
142
143 public:
144 SERIALIZABLE_CLASS(AttributeIterator);
145
146=== added file 'test/rbkt/ExpQueryResults/zorba/trycatch/trycatch12.xml.res'
147--- test/rbkt/ExpQueryResults/zorba/trycatch/trycatch12.xml.res 1970-01-01 00:00:00 +0000
148+++ test/rbkt/ExpQueryResults/zorba/trycatch/trycatch12.xml.res 2012-03-14 17:59:20 +0000
149@@ -0,0 +1,1 @@
150+Invalid attribute.
151
152=== added file 'test/rbkt/ExpQueryResults/zorba/trycatch/trycatch13.xml.res'
153--- test/rbkt/ExpQueryResults/zorba/trycatch/trycatch13.xml.res 1970-01-01 00:00:00 +0000
154+++ test/rbkt/ExpQueryResults/zorba/trycatch/trycatch13.xml.res 2012-03-14 17:59:20 +0000
155@@ -0,0 +1,1 @@
156+Message
157
158=== added file 'test/rbkt/Queries/zorba/trycatch/trycatch12.xq'
159--- test/rbkt/Queries/zorba/trycatch/trycatch12.xq 1970-01-01 00:00:00 +0000
160+++ test/rbkt/Queries/zorba/trycatch/trycatch12.xq 2012-03-14 17:59:20 +0000
161@@ -0,0 +1,1 @@
162+try { attribute xmlns {} } catch *:XQDY0044 { "Invalid attribute." }
163
164=== added file 'test/rbkt/Queries/zorba/trycatch/trycatch13.xq'
165--- test/rbkt/Queries/zorba/trycatch/trycatch13.xq 1970-01-01 00:00:00 +0000
166+++ test/rbkt/Queries/zorba/trycatch/trycatch13.xq 2012-03-14 17:59:20 +0000
167@@ -0,0 +1,1 @@
168+try { 1 div 0 } catch "http://www.w3.org/2005/xqt-errors":* { "Message"}

Subscribers

People subscribed via source and target branches