Merge lp:~paul-lucas/zorba/bug-1108515 into lp:zorba

Proposed by Paul J. Lucas
Status: Merged
Approved by: Matthias Brantner
Approved revision: 11218
Merged at revision: 11217
Proposed branch: lp:~paul-lucas/zorba/bug-1108515
Merge into: lp:zorba
Diff against target: 363 lines (+119/-46)
7 files modified
src/diagnostics/diagnostic_en.xml (+7/-1)
src/diagnostics/pregenerated/dict_en.cpp (+3/-1)
src/diagnostics/pregenerated/dict_zed_keys.h (+2/-0)
src/store/naive/json_items.cpp (+5/-3)
src/store/naive/pul_primitives.cpp (+28/-12)
src/store/naive/simple_lazy_temp_seq.cpp (+45/-17)
src/store/naive/simple_temp_seq.cpp (+29/-12)
To merge this branch: bzr merge lp:~paul-lucas/zorba/bug-1108515
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Paul J. Lucas Approve
Review via email: mp+146316@code.launchpad.net

Commit message

Fixed incorrect error reporting

Description of the change

Fixed incorrect error reporting

To post a comment you must log in.
Revision history for this message
Paul J. Lucas (paul-lucas) :
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-1108515-2013-02-03T19-06-33.908Z 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: 1 Approve.

lp:~paul-lucas/zorba/bug-1108515 updated
11218. By Paul J. Lucas

Tweaked braces to make Markos happy.

Revision history for this message
Matthias Brantner (matthias-brantner) :
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-1108515-2013-02-04T05-11-25.912Z 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
1=== modified file 'src/diagnostics/diagnostic_en.xml'
2--- src/diagnostics/diagnostic_en.xml 2013-01-30 15:19:38 +0000
3+++ src/diagnostics/diagnostic_en.xml 2013-02-04 00:33:24 +0000
4@@ -2735,7 +2735,13 @@
5 </diagnostic>
6
7 <diagnostic code="ZSTR0060" name="RANGE_EXCEPTION">
8- <value>out of range: $1</value>
9+ <value>"$1": value out of range${ 2}</value>
10+ <entry key="ForCollection_3">
11+ <value>for collection "$3"</value>
12+ </entry>
13+ <entry key="ForSequence">
14+ <value>for sequence</value>
15+ </entry>
16 </diagnostic>
17
18 <diagnostic code="ZSTR0065" name="STRINGS_IN_POOL">
19
20=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
21--- src/diagnostics/pregenerated/dict_en.cpp 2013-01-30 16:43:55 +0000
22+++ src/diagnostics/pregenerated/dict_en.cpp 2013-02-04 00:33:24 +0000
23@@ -469,7 +469,7 @@
24 { "ZSTR0045", "duplicate node found in sequence" },
25 { "ZSTR0050", "\"$1\" not implemented for item type \"$2\"" },
26 { "ZSTR0055", "streamable string has already been consumed" },
27- { "ZSTR0060", "out of range: $1" },
28+ { "ZSTR0060", "\"$1\": value out of range${ 2}" },
29 { "ZSTR0065", "Zorba did not close properly, objects may still in memory.\\n$1 referenced URI(s) remain in the string pool.\\nFor help avoiding this message please refer to http://www.zorba-xquery.com/html/documentation in section General Architecture -> Memory Leaks." },
30 { "ZSTR0066", "$1: does not reference a node in collection $2" },
31 { "ZWST0002", "\"$1\": unknown or unsupported annotation" },
32@@ -935,6 +935,8 @@
33 { "~ZDST0027_NO_KEY_TYPE_DECL", "value index missing key type declaration" },
34 { "~ZDST0060_unknown_localname", "unknown localname ($3)" },
35 { "~ZDST0060_unknown_namespace", "unknown namespace ($3)" },
36+ { "~ZSTR0060_ForCollection_3", "for collection \"$3\"" },
37+ { "~ZSTR0060_ForSequence", "for sequence" },
38 { "~ZWST0005_PARAM_TYPE", "type of parameter $3 is $4 which is not a subtype of xs:anyAtomicType" },
39 { "~ZWST0005_RETURN_TYPE", "return type ($3) is not subtype of xs:anyAtomicType" },
40 { "~ZWST0005_UPDATING", "function is updating" },
41
42=== modified file 'src/diagnostics/pregenerated/dict_zed_keys.h'
43--- src/diagnostics/pregenerated/dict_zed_keys.h 2013-01-23 17:24:44 +0000
44+++ src/diagnostics/pregenerated/dict_zed_keys.h 2013-02-04 00:33:24 +0000
45@@ -90,6 +90,8 @@
46 #define ZED_ZDST0027_NON_ORDERED_KEY_TYPE "~ZDST0027_NON_ORDERED_KEY_TYPE"
47 #define ZED_ZDST0060_unknown_namespace "~ZDST0060_unknown_namespace"
48 #define ZED_ZDST0060_unknown_localname "~ZDST0060_unknown_localname"
49+#define ZED_ZSTR0060_ForCollection_3 "~ZSTR0060_ForCollection_3"
50+#define ZED_ZSTR0060_ForSequence "~ZSTR0060_ForSequence"
51 #define ZED_JNUP0007_Object "~JNUP0007_Object"
52 #define ZED_JNUP0007_Array "~JNUP0007_Array"
53 #define ZED_JNUP0007_ObjectArray "~JNUP0007_ObjectArray"
54
55=== modified file 'src/store/naive/json_items.cpp'
56--- src/store/naive/json_items.cpp 2013-01-08 05:02:54 +0000
57+++ src/store/naive/json_items.cpp 2013-02-04 00:33:24 +0000
58@@ -1014,10 +1014,12 @@
59 {
60 return to_xs_unsignedLong(i);
61 }
62- catch (std::range_error& e)
63+ catch (std::range_error const&)
64 {
65- throw ZORBA_EXCEPTION(zerr::ZSTR0060_RANGE_EXCEPTION,
66- ERROR_PARAMS(BUILD_STRING("access out of bounds " << e.what() << ")")));
67+ throw ZORBA_EXCEPTION(
68+ zerr::ZSTR0060_RANGE_EXCEPTION,
69+ ERROR_PARAMS( i )
70+ );
71 }
72 }
73
74
75=== modified file 'src/store/naive/pul_primitives.cpp'
76--- src/store/naive/pul_primitives.cpp 2013-01-22 11:07:53 +0000
77+++ src/store/naive/pul_primitives.cpp 2013-02-04 00:33:24 +0000
78@@ -1024,11 +1024,15 @@
79 {
80 size = to_xs_unsignedLong(collection->size());
81 }
82- catch (std::range_error& e)
83+ catch (std::range_error const&)
84 {
85 RAISE_ERROR(zerr::ZSTR0060_RANGE_EXCEPTION, theLoc,
86- ERROR_PARAMS(BUILD_STRING("collection too big ("
87- << e.what() << "; " << theName << ")")));
88+ ERROR_PARAMS(
89+ collection->size(),
90+ ZED( ZSTR0060_ForCollection_3 ),
91+ theName
92+ )
93+ );
94 }
95
96 for (uint64_t i = 0; i < size; ++i)
97@@ -1101,11 +1105,15 @@
98 {
99 lastPos = to_xs_unsignedLong(lColl->size()) - 1;
100 }
101- catch (std::range_error& e)
102+ catch (std::range_error const&)
103 {
104 RAISE_ERROR(zerr::ZSTR0060_RANGE_EXCEPTION, theLoc,
105- ERROR_PARAMS(BUILD_STRING("collection too big ("
106- << e.what() << "; " << theName << ")")));
107+ ERROR_PARAMS(
108+ lColl->size(),
109+ ZED( ZSTR0060_ForCollection_3 ),
110+ theName
111+ )
112+ );
113 }
114
115 for (long i = theNumApplied-1; i >= 0; --i)
116@@ -1192,11 +1200,15 @@
117 {
118 lastPos = to_xs_unsignedLong(lColl->size()) - 1;
119 }
120- catch (std::range_error& e)
121+ catch (std::range_error const&)
122 {
123 RAISE_ERROR(zerr::ZSTR0060_RANGE_EXCEPTION, theLoc,
124- ERROR_PARAMS(BUILD_STRING("collection too big ("
125- << e.what() << "; " << theName << ")")));
126+ ERROR_PARAMS(
127+ lColl->size(),
128+ ZED( ZSTR0060_ForCollection_3 ),
129+ theName
130+ )
131+ );
132 }
133
134 xs_integer const xs_lastPos( lastPos );
135@@ -1291,11 +1303,15 @@
136 {
137 size = to_xs_unsignedLong(coll->size());
138 }
139- catch (std::range_error& e)
140+ catch (std::range_error const&)
141 {
142 RAISE_ERROR(zerr::ZSTR0060_RANGE_EXCEPTION, theLoc,
143- ERROR_PARAMS(BUILD_STRING("collection too big ("
144- << e.what() << "; " << theName << ")")));
145+ ERROR_PARAMS(
146+ coll->size(),
147+ ZED( ZSTR0060_ForCollection_3 ),
148+ theName
149+ )
150+ );
151 }
152
153 csize numNodes = theNodes.size();
154
155=== modified file 'src/store/naive/simple_lazy_temp_seq.cpp'
156--- src/store/naive/simple_lazy_temp_seq.cpp 2012-09-19 21:16:15 +0000
157+++ src/store/naive/simple_lazy_temp_seq.cpp 2013-02-04 00:33:24 +0000
158@@ -16,9 +16,11 @@
159 #include "stdafx.h"
160 #include <limits>
161
162-#include "diagnostics/xquery_exception.h"
163+#include <zorba/diagnostic_list.h>
164 #include "diagnostics/assert.h"
165+#include "diagnostics/dict.h"
166 #include "diagnostics/util_macros.h"
167+#include "diagnostics/xquery_exception.h"
168
169 #include "store/api/item.h"
170 #include "simple_lazy_temp_seq.h"
171@@ -170,10 +172,10 @@
172 {
173 pos = to_xs_long(position);
174 }
175- catch (std::range_error& e)
176+ catch (std::range_error const&)
177 {
178 throw ZORBA_EXCEPTION(zerr::ZSTR0060_RANGE_EXCEPTION,
179- ERROR_PARAMS(BUILD_STRING("sequence too big (" << e.what() << ")")));
180+ ERROR_PARAMS(position,ZED(ZSTR0060_ForSequence)));
181 }
182
183 ZORBA_ASSERT(pos >= thePurgedUpTo);
184@@ -202,10 +204,10 @@
185 {
186 pos = to_xs_long(position);
187 }
188- catch (std::range_error& e)
189+ catch (std::range_error const&)
190 {
191 RAISE_ERROR_NO_LOC(zerr::ZSTR0060_RANGE_EXCEPTION,
192- ERROR_PARAMS(BUILD_STRING("access out of bounds " << e.what() << ")")));
193+ ERROR_PARAMS(position,ZED(ZSTR0060_ForSequence)));
194 }
195
196 ZORBA_ASSERT(pos > thePurgedUpTo);
197@@ -255,10 +257,10 @@
198 {
199 pos = to_xs_long(position);
200 }
201- catch (std::range_error& e)
202+ catch (std::range_error const&)
203 {
204 RAISE_ERROR_NO_LOC(zerr::ZSTR0060_RANGE_EXCEPTION,
205- ERROR_PARAMS(BUILD_STRING("access out of bounds " << e.what() << ")")));
206+ ERROR_PARAMS(position,ZED(ZSTR0060_ForSequence)));
207 }
208
209 ZORBA_ASSERT(pos > thePurgedUpTo);
210@@ -317,17 +319,30 @@
211 :
212 theTempSeq(const_cast<SimpleLazyTempSeq*>(tempSeq))
213 {
214- try
215+ try
216 {
217 theStartPos = to_xs_long(startPos);
218+ }
219+ catch ( std::range_error const& )
220+ {
221+ throw ZORBA_EXCEPTION(
222+ zerr::ZSTR0060_RANGE_EXCEPTION,
223+ ERROR_PARAMS( startPos, ZED( ZSTR0060_ForSequence ) )
224+ );
225+ }
226+ try
227+ {
228 theEndPos = to_xs_long(endPos);
229- theCurPos = theStartPos - 1;
230 }
231- catch (std::range_error& e)
232+ catch ( std::range_error const& )
233 {
234- RAISE_ERROR_NO_LOC(zerr::ZSTR0060_RANGE_EXCEPTION,
235- ERROR_PARAMS(BUILD_STRING("sequence too big (" << e.what() << ")")));
236+ throw ZORBA_EXCEPTION(
237+ zerr::ZSTR0060_RANGE_EXCEPTION,
238+ ERROR_PARAMS( endPos, ZED( ZSTR0060_ForSequence ) )
239+ );
240 }
241+
242+ theCurPos = theStartPos - 1;
243 }
244
245
246@@ -360,17 +375,30 @@
247
248 theTempSeq = static_cast<SimpleLazyTempSeq*>(seq.getp());
249
250- try
251+ try
252 {
253 theStartPos = to_xs_long(startPos);
254+ }
255+ catch ( std::range_error const& )
256+ {
257+ throw ZORBA_EXCEPTION(
258+ zerr::ZSTR0060_RANGE_EXCEPTION,
259+ ERROR_PARAMS( startPos, ZED( ZSTR0060_ForSequence ) )
260+ );
261+ }
262+ try
263+ {
264 theEndPos = to_xs_long(endPos);
265- theCurPos = theStartPos - 1;
266 }
267- catch (std::range_error& e)
268+ catch ( std::range_error const& )
269 {
270- RAISE_ERROR_NO_LOC(zerr::ZSTR0060_RANGE_EXCEPTION,
271- ERROR_PARAMS(BUILD_STRING("sequence too big (" << e.what() << ")")));
272+ throw ZORBA_EXCEPTION(
273+ zerr::ZSTR0060_RANGE_EXCEPTION,
274+ ERROR_PARAMS( endPos, ZED( ZSTR0060_ForSequence ) )
275+ );
276 }
277+
278+ theCurPos = theStartPos - 1;
279 }
280
281
282
283=== modified file 'src/store/naive/simple_temp_seq.cpp'
284--- src/store/naive/simple_temp_seq.cpp 2012-09-19 21:16:15 +0000
285+++ src/store/naive/simple_temp_seq.cpp 2013-02-04 00:33:24 +0000
286@@ -15,10 +15,11 @@
287 */
288 #include "stdafx.h"
289
290-#include "diagnostics/xquery_exception.h"
291-#include "zorba/diagnostic_list.h"
292+#include <zorba/diagnostic_list.h>
293 #include "diagnostics/diagnostic.h"
294+#include "diagnostics/dict.h"
295 #include "diagnostics/util_macros.h"
296+#include "diagnostics/zorba_exception.h"
297
298 #include "store/api/item.h"
299 #include "simple_temp_seq.h"
300@@ -167,10 +168,12 @@
301 {
302 pos = to_xs_long(position);
303 }
304- catch (std::range_error& e)
305+ catch (std::range_error const&)
306 {
307- RAISE_ERROR_NO_LOC(zerr::ZSTR0060_RANGE_EXCEPTION,
308- ERROR_PARAMS(BUILD_STRING("access out of bounds " << e.what() << ")")));
309+ throw ZORBA_EXCEPTION(
310+ zerr::ZSTR0060_RANGE_EXCEPTION,
311+ ERROR_PARAMS( position, ZED(ZSTR0060_ForSequence) )
312+ );
313 }
314
315 if (0 < pos && pos <= theItems.size())
316@@ -194,10 +197,12 @@
317 {
318 pos = to_xs_long(position);
319 }
320- catch (std::range_error& e)
321+ catch (std::range_error const&)
322 {
323- RAISE_ERROR_NO_LOC(zerr::ZSTR0060_RANGE_EXCEPTION,
324- ERROR_PARAMS(BUILD_STRING("access out of bounds " << e.what() << ")")));
325+ throw ZORBA_EXCEPTION(
326+ zerr::ZSTR0060_RANGE_EXCEPTION,
327+ ERROR_PARAMS( position, ZED(ZSTR0060_ForSequence) )
328+ );
329 }
330
331 return 0 < pos && pos <= theItems.size();
332@@ -260,15 +265,27 @@
333 xs_long start;
334 xs_long end;
335
336- try
337+ try
338 {
339 start = to_xs_long(startPos);
340+ }
341+ catch ( std::range_error const& )
342+ {
343+ throw ZORBA_EXCEPTION(
344+ zerr::ZSTR0060_RANGE_EXCEPTION,
345+ ERROR_PARAMS( start, ZED(ZSTR0060_ForSequence) )
346+ );
347+ }
348+ try
349+ {
350 end = to_xs_long(endPos);
351 }
352- catch (std::range_error& e)
353+ catch ( std::range_error const& )
354 {
355- RAISE_ERROR_NO_LOC(zerr::ZSTR0060_RANGE_EXCEPTION,
356- ERROR_PARAMS(BUILD_STRING("access out of bounds " << e.what() << ")")));
357+ throw ZORBA_EXCEPTION(
358+ zerr::ZSTR0060_RANGE_EXCEPTION,
359+ ERROR_PARAMS( end, ZED(ZSTR0060_ForSequence) )
360+ );
361 }
362
363 if (start > 0 && end > 0)

Subscribers

People subscribed via source and target branches