Merge lp:~zorba-coders/zorba/jsoniq-error-code-fixes into lp:zorba

Proposed by Till Westmann
Status: Merged
Approved by: Till Westmann
Approved revision: 11062
Merged at revision: 11064
Proposed branch: lp:~zorba-coders/zorba/jsoniq-error-code-fixes
Merge into: lp:zorba
Diff against target: 359 lines (+51/-67)
19 files modified
include/zorba/pregenerated/diagnostic_list.h (+5/-7)
modules/org/jsoniq/www/functions.xq (+4/-4)
modules/org/jsoniq/www/pregenerated/errors.xq (+3/-8)
src/diagnostics/diagnostic_en.xml (+3/-10)
src/diagnostics/pregenerated/diagnostic_list.cpp (+7/-10)
src/diagnostics/pregenerated/dict_en.cpp (+9/-12)
src/runtime/json/jsoniq_functions_impl.cpp (+4/-4)
src/store/naive/json_items.cpp (+2/-2)
src/store/naive/json_loader.cpp (+4/-4)
test/rbkt/Queries/zorba/jsoniq/parse_json-02.spec (+1/-1)
test/rbkt/Queries/zorba/jsoniq/parse_json-02.xq (+1/-1)
test/rbkt/Queries/zorba/jsoniq/parse_json-03.spec (+1/-1)
test/rbkt/Queries/zorba/jsoniq/parse_json-03.xq (+1/-1)
test/rbkt/Queries/zorba/jsoniq/parse_json-04.spec (+1/-1)
test/rbkt/Queries/zorba/jsoniq/parse_json-04.xq (+1/-1)
test/rbkt/Queries/zorba/jsoniq/parse_json-07.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/parse_json-07.xq (+1/-0)
test/rbkt/Queries/zorba/jsoniq/parse_json-08.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/parse_json-08.xq (+1/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/jsoniq-error-code-fixes
Reviewer Review Type Date Requested Status
Ghislain Fourny Approve
Till Westmann Approve
Review via email: mp+126060@code.launchpad.net

Commit message

s/JNTY0003/JNTY0024/
s/JSDY0020/JNTY0020/
s/JSDY0021/JNDY0021/
removed JSDY0040
doc fixes for jn:parse-json

Description of the change

s/JNTY0003/JNTY0024/
s/JSDY0020/JNTY0020/
s/JSDY0021/JNDY0021/
removed JSDY0040
doc fixes for jn:parse-json

To post a comment you must log in.
Revision history for this message
Till Westmann (tillw) :
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 jsoniq-error-code-fixes-2012-09-24T17-47-49.386Z 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, 1 Pending.

Revision history for this message
Ghislain Fourny (gislenius) wrote :

Hi Till,

JNDY0040 does not exist in the spec. The error for parse-json if the supplied string is not valid JSON or if there is more than one object/array when it's forbidden, is JNDY0021.

Does it make sense?

Revision history for this message
Till Westmann (tillw) wrote :

> JNDY0040 does not exist in the spec. The error for parse-json if the supplied
> string is not valid JSON or if there is more than one object/array when it's
> forbidden, is JNDY0021.
>
> Does it make sense?

Yes, it does. I've removed JNDY0040 completely and replaced references to it with JNDY0021.

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 jsoniq-error-code-fixes-2012-09-25T17-45-49.152Z 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, 1 Pending.

Revision history for this message
Ghislain Fourny (gislenius) wrote :

Hi Till,

Thanks! Perhaps a test on non-valid JSON would be nice?

11061. By Till Westmann

add tests for JNDY0021

11062. By Till Westmann

merge trunk

Revision history for this message
Till Westmann (tillw) wrote :

> Thanks! Perhaps a test on non-valid JSON would be nice?

Yes, they're in now.

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

Thanks!

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

Validation queue job jsoniq-error-code-fixes-2012-09-26T15-21-45.457Z 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 'include/zorba/pregenerated/diagnostic_list.h'
2--- include/zorba/pregenerated/diagnostic_list.h 2012-09-26 13:26:44 +0000
3+++ include/zorba/pregenerated/diagnostic_list.h 2012-09-26 15:21:26 +0000
4@@ -859,13 +859,11 @@
5
6 extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNTY0023;
7
8-extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNTY0003;
9-
10-extern ZORBA_DLL_PUBLIC JSONiqErrorCode JSDY0040;
11-
12-extern ZORBA_DLL_PUBLIC JSONiqErrorCode JSDY0020;
13-
14-extern ZORBA_DLL_PUBLIC JSONiqErrorCode JSDY0021;
15+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNTY0024;
16+
17+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNTY0020;
18+
19+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNDY0021;
20 #endif
21
22 } // namespace jerr
23
24=== modified file 'modules/org/jsoniq/www/functions.xq'
25--- modules/org/jsoniq/www/functions.xq 2012-09-25 15:03:46 +0000
26+++ modules/org/jsoniq/www/functions.xq 2012-09-26 15:21:26 +0000
27@@ -157,7 +157,7 @@
28 :
29 : @return A sequence of JSON Object or Array item.
30 :
31- : @error jerr:JSDY0040 if the given string is not valid JSON.
32+ : @error jerr:JNDY0021 if the given string is not valid JSON.
33 :)
34 declare function jn:parse-json($j as xs:string?) as json-item()* external;
35
36@@ -172,10 +172,10 @@
37 : <li>jsoniq-multiple-top-level-items: allow parsing of sequences of JSON Objects and Arrays (boolean; default: true)</li>
38 : </ul>
39 :
40- : @error jerr:JSDY0040 if the given string is not valid JSON or
41- : if jsoniq-multiple-top-level-items is false and there is additionalx
42+ : @error jerr:JNDY0021 if the given string is not valid JSON or
43+ : if jsoniq-multiple-top-level-items is false and there is additional
44 : content after the first JSON Object or Array.
45- : @error jerr:JSDY0041 if the value for the option
46+ : @error jerr:JNTY0020 if the value for the option
47 : jsoniq-multiple-top-level-items is not of type xs:boolean.
48 :
49 : @return a sequence of JSON Object or Array item.
50
51=== modified file 'modules/org/jsoniq/www/pregenerated/errors.xq'
52--- modules/org/jsoniq/www/pregenerated/errors.xq 2012-09-25 15:03:46 +0000
53+++ modules/org/jsoniq/www/pregenerated/errors.xq 2012-09-26 15:21:26 +0000
54@@ -141,19 +141,14 @@
55 (:~
56 :objects or arrays don't have a string value
57 :)
58-declare variable $jerr:JNTY0003 as xs:QName := fn:QName($jerr:NS, "jerr:JNTY0003");
59-
60-(:~
61- :parser errors raised by the JSONIQLoader
62-:)
63-declare variable $jerr:JSDY0040 as xs:QName := fn:QName($jerr:NS, "jerr:JSDY0040");
64+declare variable $jerr:JNTY0024 as xs:QName := fn:QName($jerr:NS, "jerr:JNTY0024");
65
66 (:~
67 :parser error for invalid option type
68 :)
69-declare variable $jerr:JSDY0020 as xs:QName := fn:QName($jerr:NS, "jerr:JSDY0020");
70+declare variable $jerr:JNTY0020 as xs:QName := fn:QName($jerr:NS, "jerr:JNTY0020");
71
72 (:~
73 :parser error raised by jn:parse-json
74 :)
75-declare variable $jerr:JSDY0021 as xs:QName := fn:QName($jerr:NS, "jerr:JSDY0021");
76\ No newline at end of file
77+declare variable $jerr:JNDY0021 as xs:QName := fn:QName($jerr:NS, "jerr:JNDY0021");
78\ No newline at end of file
79
80=== modified file 'src/diagnostics/diagnostic_en.xml'
81--- src/diagnostics/diagnostic_en.xml 2012-09-26 13:26:44 +0000
82+++ src/diagnostics/diagnostic_en.xml 2012-09-26 15:21:26 +0000
83@@ -2726,24 +2726,17 @@
84
85 <!--////////// JSONIQ ///////////////////////////////////////////-->
86
87- <diagnostic code="JNTY0003" if="defined(ZORBA_WITH_JSON)">
88+ <diagnostic code="JNTY0024" if="defined(ZORBA_WITH_JSON)">
89 <comment>objects or arrays don't have a string value</comment>
90-
91 <value>$1 items do not have string value</value>
92 </diagnostic>
93
94- <diagnostic code="JSDY0040" if="defined(ZORBA_WITH_JSON)">
95- <comment>parser errors raised by the JSONIQLoader</comment>
96- <value>$1</value>
97- </diagnostic>
98-
99- <diagnostic code="JSDY0020" if="defined(ZORBA_WITH_JSON)">
100+ <diagnostic code="JNTY0020" if="defined(ZORBA_WITH_JSON)">
101 <comment>parser error for invalid option type</comment>
102 <value>$1: invalid option type for option $2 (expected $3)</value>
103 </diagnostic>
104
105-
106- <diagnostic code="JSDY0021" if="defined(ZORBA_WITH_JSON)">
107+ <diagnostic code="JNDY0021" if="defined(ZORBA_WITH_JSON)">
108 <comment>parser error raised by jn:parse-json</comment>
109 <value>$1</value>
110 </diagnostic>
111
112=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
113--- src/diagnostics/pregenerated/diagnostic_list.cpp 2012-09-26 13:26:44 +0000
114+++ src/diagnostics/pregenerated/diagnostic_list.cpp 2012-09-26 15:21:26 +0000
115@@ -1264,16 +1264,13 @@
116 JSONiqErrorCode JNTY0023( "JNTY0023" );
117
118
119-JSONiqErrorCode JNTY0003( "JNTY0003" );
120-
121-
122-JSONiqErrorCode JSDY0040( "JSDY0040" );
123-
124-
125-JSONiqErrorCode JSDY0020( "JSDY0020" );
126-
127-
128-JSONiqErrorCode JSDY0021( "JSDY0021" );
129+JSONiqErrorCode JNTY0024( "JNTY0024" );
130+
131+
132+JSONiqErrorCode JNTY0020( "JNTY0020" );
133+
134+
135+JSONiqErrorCode JNDY0021( "JNDY0021" );
136 #endif
137
138
139
140=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
141--- src/diagnostics/pregenerated/dict_en.cpp 2012-09-26 13:26:44 +0000
142+++ src/diagnostics/pregenerated/dict_en.cpp 2012-09-26 15:21:26 +0000
143@@ -101,6 +101,9 @@
144 { "JNDY0003", "\"$1\": pair with the same name already exists in object." },
145 #endif
146 #if defined(ZORBA_WITH_JSON)
147+ { "JNDY0021", "$1" },
148+#endif
149+#if defined(ZORBA_WITH_JSON)
150 { "JNSE0012", "can not serialize multiple top-level items as JSON" },
151 #endif
152 #if defined(ZORBA_WITH_JSON)
153@@ -113,9 +116,6 @@
154 { "JNTY0002", "Pair value returns no, or more than one, item." },
155 #endif
156 #if defined(ZORBA_WITH_JSON)
157- { "JNTY0003", "$1 items do not have string value" },
158-#endif
159-#if defined(ZORBA_WITH_JSON)
160 { "JNTY0004", "Cannot atomize an $1 item. An $1 has probably been passed where an atomic value is expected (e.g., as a key, or to a function expecting an atomic item)." },
161 #endif
162 #if defined(ZORBA_WITH_JSON)
163@@ -125,9 +125,15 @@
164 { "JNTY0018", "Object or array selection needs exactly one parameter." },
165 #endif
166 #if defined(ZORBA_WITH_JSON)
167+ { "JNTY0020", "$1: invalid option type for option $2 (expected $3)" },
168+#endif
169+#if defined(ZORBA_WITH_JSON)
170 { "JNTY0023", "$1: value of \"$2\" is not a $3" },
171 #endif
172 #if defined(ZORBA_WITH_JSON)
173+ { "JNTY0024", "$1 items do not have string value" },
174+#endif
175+#if defined(ZORBA_WITH_JSON)
176 { "JNUP0005", "\"$1\": duplicate pair to insert" },
177 #endif
178 #if defined(ZORBA_WITH_JSON)
179@@ -154,15 +160,6 @@
180 #if defined(ZORBA_WITH_JSON)
181 { "JNUP0019", "The content of an insert expression must evaluate to a sequence of objects." },
182 #endif
183-#if defined(ZORBA_WITH_JSON)
184- { "JSDY0020", "$1: invalid option type for option $2 (expected $3)" },
185-#endif
186-#if defined(ZORBA_WITH_JSON)
187- { "JSDY0021", "$1" },
188-#endif
189-#if defined(ZORBA_WITH_JSON)
190- { "JSDY0040", "$1" },
191-#endif
192 { "SENR0001", "\"$1\": can not serialize $2" },
193 { "SEPM0004", "doctype-system parameter, or standalone parameter with a value other than \"omit\", specified" },
194 { "SEPM0009", "omit-xml-declaration parameter is \"yes\" and $1" },
195
196=== modified file 'src/runtime/json/jsoniq_functions_impl.cpp'
197--- src/runtime/json/jsoniq_functions_impl.cpp 2012-09-21 18:25:49 +0000
198+++ src/runtime/json/jsoniq_functions_impl.cpp 2012-09-26 15:21:26 +0000
199@@ -669,7 +669,7 @@
200 {
201 const TypeManager* tm = theSctx->get_typemanager();
202 xqtref_t lType = tm->create_value_type(lOptionValue, loc);
203- RAISE_ERROR(jerr::JSDY0020, loc,
204+ RAISE_ERROR(jerr::JNTY0020, loc,
205 ERROR_PARAMS(lType->toSchemaString(), s, "xs:boolean"));
206 }
207 aAllowMultiple = lOptionValue->getBooleanValue();
208@@ -727,9 +727,9 @@
209 }
210 catch (zorba::XQueryException& e)
211 {
212- // rethrow with JSDY0021
213+ // rethrow with JNDY0021
214 XQueryException xq = XQUERY_EXCEPTION(
215- jerr::JSDY0021,
216+ jerr::JNDY0021,
217 ERROR_PARAMS(e.what()),
218 ERROR_LOC(loc));
219
220@@ -742,7 +742,7 @@
221 {
222 if (!state->theAllowMultiple && state->theGotOne)
223 {
224- RAISE_ERROR(jerr::JSDY0021, loc,
225+ RAISE_ERROR(jerr::JNDY0021, loc,
226 ERROR_PARAMS(ZED(JSON_UNEXPECTED_EXTRA_CONTENT)));
227 }
228 state->theGotOne = true;
229
230=== modified file 'src/store/naive/json_items.cpp'
231--- src/store/naive/json_items.cpp 2012-09-24 16:09:47 +0000
232+++ src/store/naive/json_items.cpp 2012-09-26 15:21:26 +0000
233@@ -523,7 +523,7 @@
234 zstring SimpleJSONObject::getStringValue() const
235 {
236 ASSERT_INVARIANT();
237- throw ZORBA_EXCEPTION(jerr::JNTY0003, ERROR_PARAMS("object"));
238+ throw ZORBA_EXCEPTION(jerr::JNTY0024, ERROR_PARAMS("object"));
239 }
240
241
242@@ -1080,7 +1080,7 @@
243 zstring SimpleJSONArray::getStringValue() const
244 {
245 ASSERT_INVARIANT();
246- throw ZORBA_EXCEPTION(jerr::JNTY0003, ERROR_PARAMS("array"));
247+ throw ZORBA_EXCEPTION(jerr::JNTY0024, ERROR_PARAMS("array"));
248 }
249
250
251
252=== modified file 'src/store/naive/json_loader.cpp'
253--- src/store/naive/json_loader.cpp 2012-09-17 00:36:37 +0000
254+++ src/store/naive/json_loader.cpp 2012-09-26 15:21:26 +0000
255@@ -57,7 +57,7 @@
256 if (theRelativeLoc) \
257 { \
258 throw XQUERY_EXCEPTION( \
259- jerr::JSDY0040, \
260+ jerr::JNDY0021, \
261 ERROR_PARAMS( \
262 ZED(msg), \
263 "" \
264@@ -68,7 +68,7 @@
265 else \
266 { \
267 throw ZORBA_EXCEPTION( \
268- jerr::JSDY0040, \
269+ jerr::JNDY0021, \
270 ERROR_PARAMS( \
271 ZED(msg), \
272 BUILD_STRING(e.get_loc().line(), ", ", e.get_loc().column()) \
273@@ -80,7 +80,7 @@
274 if (theRelativeLoc) \
275 { \
276 throw XQUERY_EXCEPTION( \
277- jerr::JSDY0040, \
278+ jerr::JNDY0021, \
279 ERROR_PARAMS( \
280 ZED(msg), \
281 param, \
282@@ -92,7 +92,7 @@
283 else \
284 { \
285 throw ZORBA_EXCEPTION( \
286- jerr::JSDY0040, \
287+ jerr::JNDY0021, \
288 ERROR_PARAMS( \
289 ZED(msg), \
290 param, \
291
292=== modified file 'test/rbkt/Queries/zorba/jsoniq/parse_json-02.spec'
293--- test/rbkt/Queries/zorba/jsoniq/parse_json-02.spec 2012-09-25 15:03:46 +0000
294+++ test/rbkt/Queries/zorba/jsoniq/parse_json-02.spec 2012-09-26 15:21:26 +0000
295@@ -1,1 +1,1 @@
296-Error: http://jsoniq.org/errors:JSDY0021
297+Error: http://jsoniq.org/errors:JNDY0021
298
299=== modified file 'test/rbkt/Queries/zorba/jsoniq/parse_json-02.xq'
300--- test/rbkt/Queries/zorba/jsoniq/parse_json-02.xq 2012-09-10 16:37:03 +0000
301+++ test/rbkt/Queries/zorba/jsoniq/parse_json-02.xq 2012-09-26 15:21:26 +0000
302@@ -1,2 +1,2 @@
303-(: test for jerr:JSDY0021 because multiple top-level items are not allowed :)
304+(: test for jerr:JNDY0021 because multiple top-level items are not allowed :)
305 jn:parse-json('{ "a" : true }{ "b" : false }', { "jsoniq-multiple-top-level-items" : false })
306
307=== modified file 'test/rbkt/Queries/zorba/jsoniq/parse_json-03.spec'
308--- test/rbkt/Queries/zorba/jsoniq/parse_json-03.spec 2012-09-25 15:03:46 +0000
309+++ test/rbkt/Queries/zorba/jsoniq/parse_json-03.spec 2012-09-26 15:21:26 +0000
310@@ -1,1 +1,1 @@
311-Error: http://jsoniq.org/errors:JSDY0021
312+Error: http://jsoniq.org/errors:JNDY0021
313
314=== modified file 'test/rbkt/Queries/zorba/jsoniq/parse_json-03.xq'
315--- test/rbkt/Queries/zorba/jsoniq/parse_json-03.xq 2012-09-10 16:37:03 +0000
316+++ test/rbkt/Queries/zorba/jsoniq/parse_json-03.xq 2012-09-26 15:21:26 +0000
317@@ -1,2 +1,2 @@
318-(: test for parser error jerr:JSDY0021 :)
319+(: test for parser error jerr:JNDY0021 :)
320 jn:parse-json('"a" : true }{ "b" : false }')
321
322=== modified file 'test/rbkt/Queries/zorba/jsoniq/parse_json-04.spec'
323--- test/rbkt/Queries/zorba/jsoniq/parse_json-04.spec 2012-09-25 15:03:46 +0000
324+++ test/rbkt/Queries/zorba/jsoniq/parse_json-04.spec 2012-09-26 15:21:26 +0000
325@@ -1,1 +1,1 @@
326-Error: http://jsoniq.org/errors:JSDY0020
327+Error: http://jsoniq.org/errors:JNTY0020
328
329=== modified file 'test/rbkt/Queries/zorba/jsoniq/parse_json-04.xq'
330--- test/rbkt/Queries/zorba/jsoniq/parse_json-04.xq 2012-09-10 16:37:03 +0000
331+++ test/rbkt/Queries/zorba/jsoniq/parse_json-04.xq 2012-09-26 15:21:26 +0000
332@@ -1,2 +1,2 @@
333-(: test for invalid type (jerr:JSDY0020) of jsoniq-multiple-top-level-items option :)
334+(: test for invalid type (jerr:JNTY0020) of jsoniq-multiple-top-level-items option :)
335 jn:parse-json('{ "a" : true }{ "b" : false }', { "jsoniq-multiple-top-level-items" : 1 })
336
337=== added file 'test/rbkt/Queries/zorba/jsoniq/parse_json-07.spec'
338--- test/rbkt/Queries/zorba/jsoniq/parse_json-07.spec 1970-01-01 00:00:00 +0000
339+++ test/rbkt/Queries/zorba/jsoniq/parse_json-07.spec 2012-09-26 15:21:26 +0000
340@@ -0,0 +1,1 @@
341+Error: http://jsoniq.org/errors:JNDY0021
342
343=== added file 'test/rbkt/Queries/zorba/jsoniq/parse_json-07.xq'
344--- test/rbkt/Queries/zorba/jsoniq/parse_json-07.xq 1970-01-01 00:00:00 +0000
345+++ test/rbkt/Queries/zorba/jsoniq/parse_json-07.xq 2012-09-26 15:21:26 +0000
346@@ -0,0 +1,1 @@
347+jn:parse-json('{ "a" : true }{ "b" : false }', { "jsoniq-multiple-top-level-items" : false })
348
349=== added file 'test/rbkt/Queries/zorba/jsoniq/parse_json-08.spec'
350--- test/rbkt/Queries/zorba/jsoniq/parse_json-08.spec 1970-01-01 00:00:00 +0000
351+++ test/rbkt/Queries/zorba/jsoniq/parse_json-08.spec 2012-09-26 15:21:26 +0000
352@@ -0,0 +1,1 @@
353+Error: http://jsoniq.org/errors:JNDY0021
354
355=== added file 'test/rbkt/Queries/zorba/jsoniq/parse_json-08.xq'
356--- test/rbkt/Queries/zorba/jsoniq/parse_json-08.xq 1970-01-01 00:00:00 +0000
357+++ test/rbkt/Queries/zorba/jsoniq/parse_json-08.xq 2012-09-26 15:21:26 +0000
358@@ -0,0 +1,1 @@
359+jn:parse-json('{ "a" : true { "b" : false }')

Subscribers

People subscribed via source and target branches