Merge lp:~zorba-coders/zorba/markos-scratch into lp:zorba

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 11008
Merged at revision: 11180
Proposed branch: lp:~zorba-coders/zorba/markos-scratch
Merge into: lp:zorba
Diff against target: 2677 lines (+606/-457)
14 files modified
src/api/base64impl.cpp (+11/-10)
src/api/itemfactoryimpl.cpp (+38/-23)
src/diagnostics/diagnostic_en.xml (+64/-30)
src/diagnostics/pregenerated/dict_en.cpp (+17/-9)
src/diagnostics/pregenerated/dict_zed_keys.h (+15/-7)
src/runtime/qnames/qnames_impl.cpp (+19/-16)
src/store/naive/atomic_items.cpp (+23/-11)
src/store/naive/node_items.cpp (+1/-1)
src/types/casting.cpp (+278/-182)
src/types/schema/XercesParseUtils.cpp (+96/-128)
src/types/schema/schema.cpp (+11/-9)
src/zorbatypes/URI.cpp (+18/-14)
src/zorbatypes/binary.cpp (+14/-16)
test/rbkt/ExpQueryResults/zorba/trycatch/trycatch4.xml.res (+1/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/markos-scratch
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+142760@code.launchpad.net

Commit message

fixed error messages for FORG0001 and FOCA0002 + removed uses of XQUERY_EXCEPTION_VAR macros

Description of the change

fixed error messages for FORG0001 and FOCA0002 + removed uses of XQUERY_EXCEPTION_VAR macros

To post a comment you must log in.
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 :

The attempt to merge lp:~zorba-coders/zorba/markos-scratch into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job markos-scratch-2013-01-10T19-34-59.262Z is finished.
  The final status was:

  2 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

11008. By Markos Zaharioudakis

fixed error messages for FORG0001 and FOCA0002 + removed uses of XQUERY_EXCEPTION_VAR macros

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 markos-scratch-2013-01-11T09-13-19.538Z 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/api/base64impl.cpp'
2--- src/api/base64impl.cpp 2012-09-19 21:16:15 +0000
3+++ src/api/base64impl.cpp 2013-01-11 00:47:24 +0000
4@@ -26,18 +26,19 @@
5 #include "diagnostics/xquery_exception.h"
6 #include "util/base64_util.h"
7
8-#define CATCH_BASE64_EXCEPTION() \
9- catch ( base64::exception const &e ) { \
10- throw XQUERY_EXCEPTION( \
11- err::FORG0001, ERROR_PARAMS( e.invalid_char(), ZED( Base64BadChar ) ) \
12- ); \
13- } \
14- catch ( std::invalid_argument const& ) { \
15- throw XQUERY_EXCEPTION( \
16- err::FORG0001, ERROR_PARAMS( "", ZED( Base64Multiple4 ) ) \
17- ); \
18+#define CATCH_BASE64_EXCEPTION() \
19+ catch (const base64::exception& e) \
20+ { \
21+ throw XQUERY_EXCEPTION(err::FORG0001, \
22+ ERROR_PARAMS(ZED(FORG0001_Base64BadChar_2), e.invalid_char())); \
23+ } \
24+ catch (const std::invalid_argument&) \
25+ { \
26+ throw XQUERY_EXCEPTION(err::FORG0001, \
27+ ERROR_PARAMS(ZED(FORG0001_Base64Multiple4))); \
28 }
29
30+
31 namespace zorba {
32 namespace encoding {
33
34
35=== modified file 'src/api/itemfactoryimpl.cpp'
36--- src/api/itemfactoryimpl.cpp 2012-10-08 12:09:36 +0000
37+++ src/api/itemfactoryimpl.cpp 2013-01-11 00:47:24 +0000
38@@ -16,21 +16,29 @@
39 #include "stdafx.h"
40
41 #define __STDC_LIMIT_MACROS
42+
43 #include <zorba/item.h>
44 #include <zorba/zorba_string.h>
45+
46 #include "diagnostics/xquery_diagnostics.h"
47+#include "diagnostics/util_macros.h"
48+
49 #include "api/itemfactoryimpl.h"
50
51 #include "zorbatypes/duration.h"
52+
53 #include "system/globalenv.h"
54+
55 #include "store/api/item_factory.h"
56-#include <store/api/store.h>
57+#include "store/api/store.h"
58 #include "store/api/copymode.h"
59+#include "store/api/item.h"
60+
61 #include "api/unmarshaller.h"
62+
63 #include "types/casting.h"
64
65-#include "store/api/item.h"
66-#include <runtime/util/item_iterator.h>
67+#include "runtime/util/item_iterator.h"
68
69
70 namespace zorba {
71@@ -112,14 +120,16 @@
72 zstring const &lLocalname = Unmarshaller::getInternalString( aLocalname );
73
74 if (!GenericCast::instance()->castableToNCName(lLocalname.c_str()))
75- throw XQUERY_EXCEPTION(
76- err::FORG0001, ERROR_PARAMS( lLocalname, ZED( MustBeNCName ) )
77- );
78+ {
79+ RAISE_ERROR_NO_LOC(err::FORG0001,
80+ ERROR_PARAMS(ZED(FORG0001_LocalNotNCName_2), lLocalname));
81+ }
82
83 if (lPrefix.size() && !GenericCast::instance()->castableToNCName(lPrefix.c_str()))
84- throw XQUERY_EXCEPTION(
85- err::FORG0001, ERROR_PARAMS( lPrefix, ZED( MustBeNCName ) )
86- );
87+ {
88+ RAISE_ERROR_NO_LOC(err::FORG0001,
89+ ERROR_PARAMS(ZED(FORG0001_PrefixNotNCName_2), lPrefix));
90+ }
91
92 store::Item_t lItem;
93 theItemFactory->createQName(lItem, lNamespace, lPrefix, lLocalname);
94@@ -135,44 +145,51 @@
95 zstring const &lLocalname = Unmarshaller::getInternalString( aLocalname );
96
97 if (!GenericCast::instance()->castableToNCName(lLocalname.c_str()))
98- throw XQUERY_EXCEPTION(
99- err::FORG0001, ERROR_PARAMS( lLocalname, ZED( MustBeNCName ) )
100- );
101+ {
102+ RAISE_ERROR_NO_LOC(err::FORG0001,
103+ ERROR_PARAMS(ZED(FORG0001_LocalNotNCName_2), lLocalname));
104+ }
105
106 store::Item_t lItem;
107 theItemFactory->createQName(lItem, lNamespace, zstring(), lLocalname);
108 return &*lItem;
109 }
110
111+
112 Item
113 ItemFactoryImpl::createQName(const String& aQNameString)
114 {
115- zstring const &lQNameString = Unmarshaller::getInternalString( aQNameString );
116+ const zstring& lQNameString = Unmarshaller::getInternalString( aQNameString );
117 store::Item_t lItem;
118
119 size_t lOpen = lQNameString.find("{");
120 size_t lClose = lQNameString.find("}");
121
122- if (lOpen == 0 && lClose != std::string::npos) {
123+ if (lOpen == 0 && lClose != std::string::npos)
124+ {
125 zstring const &lNamespace = lQNameString.substr(1, lClose - 1);
126 zstring const &lLocalname = lQNameString.substr(lClose+1);
127 theItemFactory->createQName(lItem, lNamespace, zstring(), lLocalname);
128+
129 if (!GenericCast::instance()->castableToNCName(lLocalname.c_str()))
130- throw XQUERY_EXCEPTION(
131- err::FORG0001, ERROR_PARAMS( lLocalname, ZED( MustBeNCName ) )
132- );
133+ {
134+ RAISE_ERROR_NO_LOC(err::FORG0001,
135+ ERROR_PARAMS(ZED(FORG0001_LocalNotNCName_2), lLocalname));
136+ }
137 }
138 return &*lItem;
139 }
140
141+
142 Item ItemFactoryImpl::createNCName(const String& aValue)
143 {
144 zstring lString = Unmarshaller::getInternalString(aValue);
145
146 if (!GenericCast::instance()->castableToNCName(lString.c_str()))
147- throw XQUERY_EXCEPTION(
148- err::FORG0001, ERROR_PARAMS( lString, ZED( MustBeNCName ) )
149- );
150+ {
151+ RAISE_ERROR_NO_LOC(err::FORG0001,
152+ ERROR_PARAMS(ZED(FORG0001_NameNotNCName_2), lString));
153+ }
154
155 store::Item_t lItem;
156 theItemFactory->createNCName(lItem, lString);
157@@ -191,9 +208,7 @@
158 }
159 else
160 {
161- throw ZORBA_EXCEPTION(
162- zerr::ZSTR0040_TYPE_ERROR, ERROR_PARAMS( lMessage )
163- );
164+ throw ZORBA_EXCEPTION(zerr::ZSTR0040_TYPE_ERROR, ERROR_PARAMS(lMessage));
165 }
166 return &*lItem;
167 }
168
169=== modified file 'src/diagnostics/diagnostic_en.xml'
170--- src/diagnostics/diagnostic_en.xml 2013-01-08 08:34:08 +0000
171+++ src/diagnostics/diagnostic_en.xml 2013-01-11 00:47:24 +0000
172@@ -455,6 +455,10 @@
173 is of nonzero length and is not in the lexical space of \c xs:anyURI.
174 </comment>
175 <value>${"1": }invalid URI literal${: 2}</value>
176+
177+ <entry key="BadHexDigit_3">
178+ <value>'$3': invalid hexedecimal digit</value>
179+ </entry>
180 </diagnostic>
181
182 <diagnostic code="XQST0047">
183@@ -1020,7 +1024,20 @@
184 <comment>
185 Invalid lexical value.
186 </comment>
187- <value>"$1": invalid lexical value${: 2}</value>
188+ <value>$1</value>
189+
190+ <entry key="BadLexicalQName_2">
191+ <value>"$2": value is not a valid lexical QName</value>
192+ </entry>
193+
194+ <entry key="NoURIforPrefix_2">
195+ <value>no namespace URI provided for prefix in lexical QName "$2"</value>
196+ </entry>
197+
198+ <entry key="NoCastTo_234">
199+ <value>"$2": value of type $3 is not castable to type $4</value>
200+ </entry>
201+
202 </diagnostic>
203
204 <diagnostic code="FOCA0003">
205@@ -1188,7 +1205,52 @@
206 <comment>
207 Invalid value for cast/constructor.
208 </comment>
209- <value>${"1": }invalid value for cast/constructor${: 2}</value>
210+
211+ <value>$1</value>
212+
213+ <entry key="NoCastTo_234">
214+ <value>"$2": value of type $3 is not castable to type $4</value>
215+ </entry>
216+
217+ <entry key="NoCastTo_234o">
218+ <value>"$2": value is not castable to type $3${: 4}</value>
219+ </entry>
220+
221+ <entry key="LocalNotNCName_2">
222+ <value>"$2": local name in qname is not an xs:NCName</value>
223+ </entry>
224+
225+ <entry key="PrefixNotNCName_2">
226+ <value>"$2": prefix in qname is not an xs:NCName</value>
227+ </entry>
228+
229+ <entry key="NameNotNCName_2">
230+ <value>"$2": name is not an xs:NCName</value>
231+ </entry>
232+
233+ <entry key="PrefixNotBound_2">
234+ <value>"$2": prefix has no known namespace binding</value>
235+ </entry>
236+
237+ <entry key="Base64BadChar_2">
238+ <value>"$2": invalid Base64 character</value>
239+ </entry>
240+
241+ <entry key="Base64Multiple4">
242+ <value>Base64 data must be a multiple of 4 characters</value>
243+ </entry>
244+
245+ <entry key="HexBinaryMustBeEven">
246+ <value>HexBinary value must contain an even number of characters</value>
247+ </entry>
248+
249+ <entry key="BadHexDigit_2">
250+ <value>'$2': invalid hexedecimal digit</value>
251+ </entry>
252+
253+ <entry key="NoTypeInCtx_2">
254+ <value>"$2": type no defined in current context</value>
255+ </entry>
256 </diagnostic>
257
258 <diagnostic code="FORG0002">
259@@ -3029,10 +3091,6 @@
260 <value>"$2": invalid authority for "file" scheme</value>
261 </entry>
262
263- <entry key="BadHexDigit_3">
264- <value>'$3': invalid hexedecimal digit</value>
265- </entry>
266-
267 <entry key="BadHexSequence">
268 <value>invalid hexedecimal sequence</value>
269 </entry>
270@@ -3113,14 +3171,6 @@
271 <value>unsupported XQuery version</value>
272 </entry>
273
274- <entry key="Base64BadChar">
275- <value>invalid Base64 character</value>
276- </entry>
277-
278- <entry key="Base64Multiple4">
279- <value>Base64 data must be a multiple of 4 characters</value>
280- </entry>
281-
282 <entry key="BaseURI">
283 <value>base URI</value>
284 </entry>
285@@ -3129,10 +3179,6 @@
286 <value>box condition has more columns than index</value>
287 </entry>
288
289- <entry key="CastFromToFailed_34">
290- <value>$3 to $4 cast failed</value>
291- </entry>
292-
293 <entry key="CharExpected_3">
294 <value>'$3' expected</value>
295 </entry>
296@@ -3285,10 +3331,6 @@
297 <value>valid values are: yes, no, omit</value>
298 </entry>
299
300- <entry key="HexBinaryMustBeEven">
301- <value>HexBinary value must contain an even number of characters</value>
302- </entry>
303-
304 <entry key="IncompleteKeyInIndexBuild">
305 <value>incomplete key during index build</value>
306 </entry>
307@@ -3309,10 +3351,6 @@
308 <value>must be absolute</value>
309 </entry>
310
311- <entry key="MustBeNCName">
312- <value>must be an xs:NCName</value>
313- </entry>
314-
315 <entry key="NoAttrNodesInDocument">
316 <value>document node must not contain attribute nodes</value>
317 </entry>
318@@ -3445,10 +3483,6 @@
319 <value>can not treat as "$4"</value>
320 </entry>
321
322- <entry key="NoTypeInCtx">
323- <value>undefined type in current context</value>
324- </entry>
325-
326 <entry key="NoTypeInMainModule_4">
327 <value>type of variable "$4" is not among the in-scope types of the main module</value>
328 </entry>
329
330=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
331--- src/diagnostics/pregenerated/dict_en.cpp 2013-01-08 08:34:08 +0000
332+++ src/diagnostics/pregenerated/dict_en.cpp 2013-01-11 00:47:24 +0000
333@@ -31,7 +31,7 @@
334 { "FOAR0001", "division by zero" },
335 { "FOAR0002", "numeric operation overflow/underflow${: 1}" },
336 { "FOCA0001", "\"$1\": value too large for decimal" },
337- { "FOCA0002", "\"$1\": invalid lexical value${: 2}" },
338+ { "FOCA0002", "$1" },
339 { "FOCA0003", "\"$1\": value too large for integer" },
340 { "FOCA0005", "NaN supplied as float/double value" },
341 { "FOCA0006", "\"$1\": string to be cast to decimal has too many digits of precision" },
342@@ -56,7 +56,7 @@
343 { "FOFI0002", "invalid argument in format-integer: $1" },
344 { "FONS0004", "\"$1\": no namespace found for prefix" },
345 { "FONS0005", "base-URI not defined in the static context" },
346- { "FORG0001", "${\"1\": }invalid value for cast/constructor${: 2}" },
347+ { "FORG0001", "$1" },
348 { "FORG0002", "\"$1\": invalid argument to fn:resolve-uri()${: 2}" },
349 { "FORG0003", "fn:zero-or-one() called with a sequnce containing more than one item" },
350 { "FORG0004", "fn:one-or-more() called with a sequence containing no items" },
351@@ -537,7 +537,6 @@
352 { "~BadCharInBraces_3", "'$3': illegal character within { }" },
353 { "~BadDecDigit_3", "'$3': invalid decimal digit" },
354 { "~BadFileURIAuthority_2", "\"$2\": invalid authority for \"file\" scheme" },
355- { "~BadHexDigit_3", "'$3': invalid hexedecimal digit" },
356 { "~BadHexSequence", "invalid hexedecimal sequence" },
357 { "~BadItem", "invalid item" },
358 { "~BadIterator", "invalid iterator" },
359@@ -560,11 +559,8 @@
360 { "~BadXMLForXQDoc_3", "can not parse as XML for xqdoc: $3" },
361 { "~BadXMLNoOpeningTag", "closing tag without matching opening tag" },
362 { "~BadXQueryVersion", "unsupported XQuery version" },
363- { "~Base64BadChar", "invalid Base64 character" },
364- { "~Base64Multiple4", "Base64 data must be a multiple of 4 characters" },
365 { "~BaseURI", "base URI" },
366 { "~BoxCondTooManyColumns", "box condition has more columns than index" },
367- { "~CastFromToFailed_34", "$3 to $4 cast failed" },
368 { "~CharExpected_3", "'$3' expected" },
369 { "~CloneNotImplemented", "clone() not implemented for expression" },
370 { "~ClosingBraceWithoutOpen", "'}' encountered without '{' first" },
371@@ -592,6 +588,20 @@
372 { "~ExprReturnsTooManyUpdateLists", "expression does not return a pending update list" },
373 { "~ExternFnDeterministic", "only external functions may be declared deterministic" },
374 { "~ExternFnNondeterministic", "only external functions may be declared nondeterministic" },
375+ { "~FOCA0002_BadLexicalQName_2", "\"$2\": value is not a valid lexical QName" },
376+ { "~FOCA0002_NoCastTo_234", "\"$2\": value of type $3 is not castable to type $4" },
377+ { "~FOCA0002_NoURIforPrefix_2", "no namespace URI provided for prefix in lexical QName \"$2\"" },
378+ { "~FORG0001_BadHexDigit_2", "'$2': invalid hexedecimal digit" },
379+ { "~FORG0001_Base64BadChar_2", "\"$2\": invalid Base64 character" },
380+ { "~FORG0001_Base64Multiple4", "Base64 data must be a multiple of 4 characters" },
381+ { "~FORG0001_HexBinaryMustBeEven", "HexBinary value must contain an even number of characters" },
382+ { "~FORG0001_LocalNotNCName_2", "\"$2\": local name in qname is not an xs:NCName" },
383+ { "~FORG0001_NameNotNCName_2", "\"$2\": name is not an xs:NCName" },
384+ { "~FORG0001_NoCastTo_234", "\"$2\": value of type $3 is not castable to type $4" },
385+ { "~FORG0001_NoCastTo_234o", "\"$2\": value is not castable to type $3${: 4}" },
386+ { "~FORG0001_NoTypeInCtx_2", "\"$2\": type no defined in current context" },
387+ { "~FORG0001_PrefixNotBound_2", "\"$2\": prefix has no known namespace binding" },
388+ { "~FORG0001_PrefixNotNCName_2", "\"$2\": prefix in qname is not an xs:NCName" },
389 { "~FTST0009_BadStemmerLang", "for current stemmer" },
390 { "~FTST0009_BadStopWordsLang", "for current stop words" },
391 { "~FTST0009_BadThesaurusLang", "for given thesaurus" },
392@@ -614,7 +624,6 @@
393 { "~GoodValuesAreXMLEtc", "valid values are: xml, html, xhtml, text, binary, json, jsoniq" },
394 { "~GoodValuesAreYesNo", "valid values are: yes, no" },
395 { "~GoodValuesAreYesNoOmit", "valid values are: yes, no, omit" },
396- { "~HexBinaryMustBeEven", "HexBinary value must contain an even number of characters" },
397 { "~IncompleteKeyInIndexBuild", "incomplete key during index build" },
398 { "~IncompleteKeyInIndexRefresh", "incomplete key during index refresh" },
399 { "~JNDY0021_IllegalCharacter_2", "'$2': illegal JSON character" },
400@@ -648,7 +657,6 @@
401 { "~LibModVersionMismatch_3", "XQuery library version can not be imported by a $3 version module" },
402 { "~ModuleNotFound", "module not found" },
403 { "~MustBeAbsoluteURI", "must be absolute" },
404- { "~MustBeNCName", "must be an xs:NCName" },
405 { "~NoAttrNodesInDocument", "document node must not contain attribute nodes" },
406 { "~NoBindURI", "namespace URI can not be bound to prefix" },
407 { "~NoCastToCInt_2", "\"$2\": 2nd operand can not be cast from \"xs:integer\" to C++ \"int\"" },
408@@ -682,7 +690,6 @@
409 { "~NoSerializationCallbackForTraceStream", "no SerializationCallback for required trace stream" },
410 { "~NoSourceURI", "no URI" },
411 { "~NoTreatAs_4", "can not treat as \"$4\"" },
412- { "~NoTypeInCtx", "undefined type in current context" },
413 { "~NoTypeInMainModule_4", "type of variable \"$4\" is not among the in-scope types of the main module" },
414 { "~NoTypeInModule_45", "type of variable \"$4\" is not among the in-scope types module \"$5\"" },
415 { "~NoURIAuthority", "no authority" },
416@@ -897,6 +904,7 @@
417 { "~XPTY0004_NoTypePromote_23", "$2 can not be promoted to type $3" },
418 { "~XPTY0117_NodeCast", "Cannot cast node to xs:QName" },
419 { "~XPTY0117_NotationParam_23", "$2 can not be promoted to parameter type xs:NOTATION of function $3()" },
420+ { "~XQST0046_BadHexDigit_3", "'$3': invalid hexedecimal digit" },
421 { "~XQST0106_CONFLICTING", "conflicting" },
422 { "~XQST0106_THE_SAME", "the same" },
423 { "~XUDY0021_AttributeName", "\"$3\": attribute with the same name already exists" },
424
425=== modified file 'src/diagnostics/pregenerated/dict_zed_keys.h'
426--- src/diagnostics/pregenerated/dict_zed_keys.h 2013-01-08 08:34:08 +0000
427+++ src/diagnostics/pregenerated/dict_zed_keys.h 2013-01-11 00:47:24 +0000
428@@ -46,6 +46,7 @@
429 #define ZED_XPTY0004_MultiValuedGroupingKey "~XPTY0004_MultiValuedGroupingKey"
430 #define ZED_XPTY0117_NodeCast "~XPTY0117_NodeCast"
431 #define ZED_XPTY0117_NotationParam_23 "~XPTY0117_NotationParam_23"
432+#define ZED_XQST0046_BadHexDigit_3 "~XQST0046_BadHexDigit_3"
433 #define ZED_XQST0106_THE_SAME "~XQST0106_THE_SAME"
434 #define ZED_XQST0106_CONFLICTING "~XQST0106_CONFLICTING"
435 #define ZED_XPDY0002_VariableHasNoValue_2 "~XPDY0002_VariableHasNoValue_2"
436@@ -55,6 +56,20 @@
437 #define ZED_FTST0009_BadStemmerLang "~FTST0009_BadStemmerLang"
438 #define ZED_FTST0009_BadThesaurusLang "~FTST0009_BadThesaurusLang"
439 #define ZED_FTST0009_BadTokenizerLang "~FTST0009_BadTokenizerLang"
440+#define ZED_FOCA0002_BadLexicalQName_2 "~FOCA0002_BadLexicalQName_2"
441+#define ZED_FOCA0002_NoURIforPrefix_2 "~FOCA0002_NoURIforPrefix_2"
442+#define ZED_FOCA0002_NoCastTo_234 "~FOCA0002_NoCastTo_234"
443+#define ZED_FORG0001_NoCastTo_234 "~FORG0001_NoCastTo_234"
444+#define ZED_FORG0001_NoCastTo_234o "~FORG0001_NoCastTo_234o"
445+#define ZED_FORG0001_LocalNotNCName_2 "~FORG0001_LocalNotNCName_2"
446+#define ZED_FORG0001_PrefixNotNCName_2 "~FORG0001_PrefixNotNCName_2"
447+#define ZED_FORG0001_NameNotNCName_2 "~FORG0001_NameNotNCName_2"
448+#define ZED_FORG0001_PrefixNotBound_2 "~FORG0001_PrefixNotBound_2"
449+#define ZED_FORG0001_Base64BadChar_2 "~FORG0001_Base64BadChar_2"
450+#define ZED_FORG0001_Base64Multiple4 "~FORG0001_Base64Multiple4"
451+#define ZED_FORG0001_HexBinaryMustBeEven "~FORG0001_HexBinaryMustBeEven"
452+#define ZED_FORG0001_BadHexDigit_2 "~FORG0001_BadHexDigit_2"
453+#define ZED_FORG0001_NoTypeInCtx_2 "~FORG0001_NoTypeInCtx_2"
454 #define ZED_XUST0001_CONCAT "~XUST0001_CONCAT"
455 #define ZED_XUST0001_TRYCATCH "~XUST0001_TRYCATCH"
456 #define ZED_XUST0001_Generic "~XUST0001_Generic"
457@@ -107,7 +122,6 @@
458 #define ZED_BadCharInBraces_3 "~BadCharInBraces_3"
459 #define ZED_BadDecDigit_3 "~BadDecDigit_3"
460 #define ZED_BadFileURIAuthority_2 "~BadFileURIAuthority_2"
461-#define ZED_BadHexDigit_3 "~BadHexDigit_3"
462 #define ZED_BadHexSequence "~BadHexSequence"
463 #define ZED_BadItem "~BadItem"
464 #define ZED_BadIterator "~BadIterator"
465@@ -128,11 +142,8 @@
466 #define ZED_BadXMLNoOpeningTag "~BadXMLNoOpeningTag"
467 #define ZED_BadXMLForXQDoc_3 "~BadXMLForXQDoc_3"
468 #define ZED_BadXQueryVersion "~BadXQueryVersion"
469-#define ZED_Base64BadChar "~Base64BadChar"
470-#define ZED_Base64Multiple4 "~Base64Multiple4"
471 #define ZED_BaseURI "~BaseURI"
472 #define ZED_BoxCondTooManyColumns "~BoxCondTooManyColumns"
473-#define ZED_CastFromToFailed_34 "~CastFromToFailed_34"
474 #define ZED_CharExpected_3 "~CharExpected_3"
475 #define ZED_CloneNotImplemented "~CloneNotImplemented"
476 #define ZED_ClosingBraceWithoutOpen "~ClosingBraceWithoutOpen"
477@@ -171,13 +182,11 @@
478 #define ZED_GoodValuesAreXMLEtc "~GoodValuesAreXMLEtc"
479 #define ZED_GoodValuesAreYesNo "~GoodValuesAreYesNo"
480 #define ZED_GoodValuesAreYesNoOmit "~GoodValuesAreYesNoOmit"
481-#define ZED_HexBinaryMustBeEven "~HexBinaryMustBeEven"
482 #define ZED_IncompleteKeyInIndexBuild "~IncompleteKeyInIndexBuild"
483 #define ZED_IncompleteKeyInIndexRefresh "~IncompleteKeyInIndexRefresh"
484 #define ZED_LibModVersionMismatch_3 "~LibModVersionMismatch_3"
485 #define ZED_ModuleNotFound "~ModuleNotFound"
486 #define ZED_MustBeAbsoluteURI "~MustBeAbsoluteURI"
487-#define ZED_MustBeNCName "~MustBeNCName"
488 #define ZED_NoAttrNodesInDocument "~NoAttrNodesInDocument"
489 #define ZED_NoBindURI "~NoBindURI"
490 #define ZED_NoCastToCInt_2 "~NoCastToCInt_2"
491@@ -211,7 +220,6 @@
492 #define ZED_NoSerializationCallbackForTraceStream "~NoSerializationCallbackForTraceStream"
493 #define ZED_NoSourceURI "~NoSourceURI"
494 #define ZED_NoTreatAs_4 "~NoTreatAs_4"
495-#define ZED_NoTypeInCtx "~NoTypeInCtx"
496 #define ZED_NoTypeInMainModule_4 "~NoTypeInMainModule_4"
497 #define ZED_NoTypeInModule_45 "~NoTypeInModule_45"
498 #define ZED_NoURIAuthority "~NoURIAuthority"
499
500=== modified file 'src/runtime/qnames/qnames_impl.cpp'
501--- src/runtime/qnames/qnames_impl.cpp 2012-09-19 21:16:15 +0000
502+++ src/runtime/qnames/qnames_impl.cpp 2013-01-11 00:47:24 +0000
503@@ -31,6 +31,8 @@
504 #include "store/api/item_factory.h"
505 #include "store/api/item.h"
506
507+#include "diagnostics/util_macros.h"
508+
509
510 namespace zorba {
511 #define GENV_GCAST (*GenericCast::instance ())
512@@ -66,19 +68,22 @@
513 resLocal = qname.substr(index+1, qname.size() - index);
514
515 // must check for FOCA0002 first
516- if (!GENV_GCAST.castableToNCName(resPre) || ! GENV_GCAST.castableToNCName(resLocal))
517- throw XQUERY_EXCEPTION(
518- err::FOCA0002, ERROR_PARAMS( qname ), ERROR_LOC(loc)
519- );
520+ if (!GENV_GCAST.castableToNCName(resPre) ||
521+ ! GENV_GCAST.castableToNCName(resLocal))
522+ {
523+ RAISE_ERROR(err::FOCA0002, loc,
524+ ERROR_PARAMS(ZED(FOCA0002_BadLexicalQName_2), qname));
525+ }
526 }
527 else
528 {
529 resLocal = qname;
530
531 if (! GENV_GCAST.castableToNCName(resLocal))
532- throw XQUERY_EXCEPTION(
533- err::FOCA0002, ERROR_PARAMS( qname ), ERROR_LOC(loc)
534- );
535+ {
536+ RAISE_ERROR(err::FOCA0002, loc,
537+ ERROR_PARAMS(ZED(FOCA0002_BadLexicalQName_2), qname));
538+ }
539 }
540
541 if (consumeNext(itemElem, theChild1, planState ))
542@@ -100,9 +105,7 @@
543 }
544
545 if (!found && !resPre.empty())
546- throw XQUERY_EXCEPTION(
547- err::FONS0004, ERROR_PARAMS( resPre ), ERROR_LOC( loc )
548- );
549+ RAISE_ERROR(err::FONS0004, loc, ERROR_PARAMS(resPre));
550 }
551
552 GENV_ITEMFACTORY->createQName(result, resNs, resPre, resLocal);
553@@ -146,9 +149,10 @@
554 if (index != zstring::npos)
555 {
556 if (resNs.empty())
557- throw XQUERY_EXCEPTION(
558- err::FOCA0002, ERROR_PARAMS( resNs ), ERROR_LOC(loc)
559- );
560+ {
561+ RAISE_ERROR(err::FOCA0002, loc,
562+ ERROR_PARAMS(ZED(FOCA0002_NoURIforPrefix_2), qname));
563+ }
564
565 resPre = qname.substr(0, index);
566 resLocal = qname.substr(index+1, qname.size() - index);
567@@ -161,9 +165,8 @@
568 if ((index != zstring::npos && ! GENV_GCAST.castableToNCName(resPre)) ||
569 ! GENV_GCAST.castableToNCName(resLocal))
570 {
571- throw XQUERY_EXCEPTION(
572- err::FOCA0002, ERROR_PARAMS( qname ), ERROR_LOC(loc)
573- );
574+ RAISE_ERROR(err::FOCA0002, loc,
575+ ERROR_PARAMS(ZED(FOCA0002_BadLexicalQName_2), qname));
576 }
577
578 GENV_ITEMFACTORY->createQName(result, resNs, resPre, resLocal);
579
580=== modified file 'src/store/naive/atomic_items.cpp'
581--- src/store/naive/atomic_items.cpp 2012-12-25 20:27:54 +0000
582+++ src/store/naive/atomic_items.cpp 2013-01-11 00:47:24 +0000
583@@ -2679,7 +2679,10 @@
584 catch ( std::range_error const& )
585 {
586 RAISE_ERROR_NO_LOC(err::FORG0001,
587- ERROR_PARAMS(theValue, ZED(CastFromToFailed_34), "integer", "long"));
588+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234),
589+ getStringValue(),
590+ "xs:integer",
591+ "xs:long"));
592 }
593 }
594
595@@ -2693,7 +2696,10 @@
596 catch ( std::range_error const& )
597 {
598 RAISE_ERROR_NO_LOC(err::FORG0001,
599- ERROR_PARAMS(theValue, ZED(CastFromToFailed_34), "integer", "unsignedInt"));
600+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234),
601+ getStringValue(),
602+ "xs:integer",
603+ "xs:unsignedInt"));
604 }
605 }
606
607@@ -2793,10 +2799,11 @@
608 }
609 catch ( std::range_error const& )
610 {
611- throw XQUERY_EXCEPTION(
612- err::FORG0001,
613- ERROR_PARAMS( theValue, ZED( CastFromToFailed_34 ), "integer", "long" )
614- );
615+ RAISE_ERROR_NO_LOC(err::FORG0001,
616+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234),
617+ getStringValue(),
618+ "xs:nonPositiveInteger",
619+ "xs:long"));
620 }
621 }
622
623@@ -2882,6 +2889,7 @@
624 }
625 }
626
627+
628 store::Item* NonNegativeIntegerItem::getType() const
629 {
630 return GET_STORE().theSchemaTypeNames[store::XS_NON_NEGATIVE_INTEGER];
631@@ -2893,26 +2901,30 @@
632 return xs_decimal(theValue);
633 }
634
635+
636 xs_integer NonNegativeIntegerItem::getIntegerValue() const
637 {
638 return xs_integer(theValue);
639 }
640
641+
642 xs_long NonNegativeIntegerItem::getLongValue() const
643 {
644 try
645 {
646 return to_xs_long(theValue);
647 }
648- catch ( std::range_error const& )
649+ catch (const std::range_error& )
650 {
651- throw XQUERY_EXCEPTION(
652- err::FORG0001,
653- ERROR_PARAMS( theValue, ZED( CastFromToFailed_34 ), "integer", "long" )
654- );
655+ RAISE_ERROR_NO_LOC(err::FORG0001,
656+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234),
657+ getStringValue(),
658+ "xs:nonNegativeInteger",
659+ "xs:long"));
660 }
661 }
662
663+
664 zstring NonNegativeIntegerItem::getStringValue() const
665 {
666 return theValue.toString();
667
668=== modified file 'src/store/naive/node_items.cpp'
669--- src/store/naive/node_items.cpp 2013-01-08 08:34:08 +0000
670+++ src/store/naive/node_items.cpp 2013-01-11 00:47:24 +0000
671@@ -3333,7 +3333,7 @@
672 if (!otherAttr->isHidden() && otherAttr->getNodeName()->equals(attrName))
673 {
674 throw XQUERY_EXCEPTION(err::XUDY0021,
675- ERROR_PARAMS(ZED(XUDY0021_AttributeName), "", attrName->getStringValue()));
676+ ERROR_PARAMS(ZED(XUDY0021_AttributeName), "", attrName->getStringValue()));
677 }
678 }
679 }
680
681=== modified file 'src/types/casting.cpp'
682--- src/types/casting.cpp 2013-01-10 13:14:51 +0000
683+++ src/types/casting.cpp 2013-01-11 00:47:24 +0000
684@@ -96,29 +96,89 @@
685 };
686
687
688-void throwTypeException(const Diagnostic& errcode, const ErrorInfo& info)
689-{
690- if (info.theSourceType)
691- {
692- throw XQUERY_EXCEPTION_VAR(errcode,
693- ERROR_PARAMS(*info.theSourceType, ZED(NoCastTo_34o), *info.theTargetType),
694- ERROR_LOC(info.theLoc));
695- }
696- else
697- {
698- TypeManager& tm = GENV_TYPESYSTEM;
699-
700- xqtref_t sourceType =
701- tm.create_builtin_atomic_type(info.theSourceTypeCode,
702- TypeConstants::QUANT_ONE);
703-
704- xqtref_t targetType =
705- tm.create_builtin_atomic_type(info.theTargetTypeCode,
706- TypeConstants::QUANT_ONE);
707-
708- throw XQUERY_EXCEPTION_VAR(errcode,
709- ERROR_PARAMS(*sourceType, ZED(NoCastTo_34o), *targetType),
710- ERROR_LOC(info.theLoc));
711+void throwXPTY0004Exception(const ErrorInfo& info)
712+{
713+ if (info.theSourceType)
714+ {
715+ RAISE_ERROR(err::XPTY0004, info.theLoc,
716+ ERROR_PARAMS(*info.theSourceType, ZED(NoCastTo_34o), *info.theTargetType));
717+ }
718+ else
719+ {
720+ TypeManager& tm = GENV_TYPESYSTEM;
721+
722+ xqtref_t sourceType =
723+ tm.create_builtin_atomic_type(info.theSourceTypeCode,
724+ TypeConstants::QUANT_ONE);
725+
726+ xqtref_t targetType =
727+ tm.create_builtin_atomic_type(info.theTargetTypeCode,
728+ TypeConstants::QUANT_ONE);
729+
730+ RAISE_ERROR(err::XPTY0004, info.theLoc,
731+ ERROR_PARAMS(*sourceType, ZED(NoCastTo_34o), *targetType));
732+ }
733+}
734+
735+
736+void throwFOCA0002Exception(const zstring& str, const ErrorInfo& info)
737+{
738+ if (info.theSourceType)
739+ {
740+ RAISE_ERROR(err::FOCA0002, info.theLoc,
741+ ERROR_PARAMS(ZED(FOCA0002_NoCastTo_234),
742+ str,
743+ info.theSourceType->toSchemaString(),
744+ info.theTargetType->toSchemaString()));
745+ }
746+ else
747+ {
748+ TypeManager& tm = GENV_TYPESYSTEM;
749+
750+ xqtref_t sourceType =
751+ tm.create_builtin_atomic_type(info.theSourceTypeCode,
752+ TypeConstants::QUANT_ONE);
753+
754+ xqtref_t targetType =
755+ tm.create_builtin_atomic_type(info.theTargetTypeCode,
756+ TypeConstants::QUANT_ONE);
757+
758+ RAISE_ERROR(err::FOCA0002, info.theLoc,
759+ ERROR_PARAMS(ZED(FOCA0002_NoCastTo_234),
760+ str,
761+ sourceType->toSchemaString(),
762+ targetType->toSchemaString()));
763+ }
764+}
765+
766+
767+void throwFORG0001Exception(const zstring& str, const ErrorInfo& info)
768+{
769+ if (info.theTargetType)
770+ {
771+ RAISE_ERROR(err::FORG0001, info.theLoc,
772+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234),
773+ str,
774+ info.theSourceType->toSchemaString(),
775+ info.theTargetType->toSchemaString()));
776+ }
777+ else
778+ {
779+ TypeManager& tm = GENV_TYPESYSTEM;
780+
781+ xqtref_t sourceType =
782+ tm.create_builtin_atomic_type(info.theSourceTypeCode,
783+ TypeConstants::QUANT_ONE);
784+
785+ xqtref_t targetType =
786+ tm.create_builtin_atomic_type(info.theTargetTypeCode,
787+ TypeConstants::QUANT_ONE);
788+
789+ RAISE_ERROR(err::FORG0001, info.theLoc,
790+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234),
791+ str,
792+ sourceType->toSchemaString(),
793+ targetType->toSchemaString()));
794 }
795 }
796
797@@ -134,7 +194,7 @@
798 zstring& strval, \
799 store::ItemFactory*, \
800 const namespace_context* nsCtx, \
801- const ErrorInfo& aErrorInfo) \
802+ const ErrorInfo& errInfo) \
803 { \
804 result = (aItem); \
805 } \
806@@ -175,7 +235,7 @@
807 zstring& strval, \
808 store::ItemFactory* aFactory, \
809 const namespace_context* nsCtx, \
810- const ErrorInfo& aErrorInfo) \
811+ const ErrorInfo& errInfo) \
812
813
814
815@@ -194,11 +254,11 @@
816 }
817 catch (std::invalid_argument const&)
818 {
819- throwTypeException(err::FORG0001, aErrorInfo);
820+ throwFORG0001Exception(strval, errInfo);
821 }
822- catch ( std::range_error const& )
823+ catch (const std::range_error& )
824 {
825- throw XQUERY_EXCEPTION(err::FOAR0002, ERROR_PARAMS(strval));
826+ RAISE_ERROR(err::FOAR0002, errInfo.theLoc, ERROR_PARAMS(strval));
827 }
828 }
829
830@@ -212,11 +272,11 @@
831 }
832 catch (std::invalid_argument const& )
833 {
834- throwTypeException(err::FORG0001, aErrorInfo);
835+ throwFORG0001Exception(strval, errInfo);
836 }
837- catch (std::range_error const& )
838+ catch (const std::range_error& )
839 {
840- throw XQUERY_EXCEPTION(err::FOAR0002, ERROR_PARAMS(strval));
841+ RAISE_ERROR(err::FOAR0002, errInfo.theLoc, ERROR_PARAMS(strval));
842 }
843 }
844
845@@ -228,9 +288,9 @@
846 xs_decimal const n(strval.c_str());
847 aFactory->createDecimal(result, n);
848 }
849- catch ( std::exception const& )
850+ catch (const std::exception& )
851 {
852- throwTypeException( err::FORG0001, aErrorInfo );
853+ throwFORG0001Exception(strval, errInfo);
854 }
855 }
856
857@@ -242,13 +302,31 @@
858 xs_integer const n(strval.c_str());
859 aFactory->createInteger(result, n);
860 }
861- catch ( std::invalid_argument const& )
862- {
863- throwTypeException( err::FORG0001, aErrorInfo );
864- }
865- catch ( std::range_error const& )
866- {
867- throwTypeException( err::FOAR0002, aErrorInfo );
868+ catch (const std::invalid_argument& )
869+ {
870+ throwFORG0001Exception(strval, errInfo);
871+ }
872+ catch (const std::range_error& )
873+ {
874+ RAISE_ERROR(err::FOAR0002, errInfo.theLoc, ERROR_PARAMS(strval));
875+ }
876+}
877+
878+
879+T1_TO_T2(str, uint)
880+{
881+ try
882+ {
883+ const xs_nonNegativeInteger n(strval.c_str());
884+ aFactory->createNonNegativeInteger(result, n);
885+ }
886+ catch (const std::invalid_argument& )
887+ {
888+ throwFORG0001Exception(strval, errInfo);
889+ }
890+ catch (const std::range_error& )
891+ {
892+ RAISE_ERROR(err::FOAR0002, errInfo.theLoc, ERROR_PARAMS(strval));
893 }
894 }
895
896@@ -263,7 +341,8 @@
897 aFactory->createDuration(result, &d);
898 return;
899 }
900- throwTypeException(err::FORG0001, aErrorInfo);
901+
902+ throwFORG0001Exception(strval, errInfo);
903 }
904
905
906@@ -277,7 +356,8 @@
907 aFactory->createYearMonthDuration(result, &d);
908 return;
909 }
910- throwTypeException( err::FORG0001, aErrorInfo );
911+
912+ throwFORG0001Exception(strval, errInfo);
913 }
914
915
916@@ -291,7 +371,8 @@
917 aFactory->createDayTimeDuration(result, &d);
918 return;
919 }
920- throwTypeException( err::FORG0001, aErrorInfo );
921+
922+ throwFORG0001Exception(strval, errInfo);
923 }
924
925
926@@ -303,7 +384,8 @@
927 aFactory->createDateTime(result, &dt);
928 return;
929 }
930- throwTypeException( err::FORG0001, aErrorInfo );
931+
932+ throwFORG0001Exception(strval, errInfo);
933 }
934
935
936@@ -315,7 +397,8 @@
937 aFactory->createTime(result, &t);
938 return;
939 }
940- throwTypeException( err::FORG0001, aErrorInfo );
941+
942+ throwFORG0001Exception(strval, errInfo);
943 }
944
945
946@@ -327,7 +410,8 @@
947 aFactory->createDate(result, &d);
948 return;
949 }
950- throwTypeException( err::FORG0001, aErrorInfo );
951+
952+ throwFORG0001Exception(strval, errInfo);
953 }
954
955
956@@ -339,7 +423,8 @@
957 aFactory->createGYearMonth(result, &ym);
958 return;
959 }
960- throwTypeException( err::FORG0001, aErrorInfo );
961+
962+ throwFORG0001Exception(strval, errInfo);
963 }
964
965
966@@ -351,7 +436,8 @@
967 aFactory->createGYear(result, &y);
968 return;
969 }
970- throwTypeException( err::FORG0001, aErrorInfo );
971+
972+ throwFORG0001Exception(strval, errInfo);
973 }
974
975
976@@ -364,7 +450,7 @@
977 return;
978 }
979
980- throwTypeException( err::FORG0001, aErrorInfo );
981+ throwFORG0001Exception(strval, errInfo);
982 }
983
984
985@@ -376,7 +462,8 @@
986 aFactory->createGDay(result, &d);
987 return;
988 }
989- throwTypeException( err::FORG0001, aErrorInfo );
990+
991+ throwFORG0001Exception(strval, errInfo);
992 }
993
994
995@@ -389,7 +476,7 @@
996 return;
997 }
998
999- throwTypeException( err::FORG0001, aErrorInfo );
1000+ throwFORG0001Exception(strval, errInfo);
1001 }
1002
1003
1004@@ -426,14 +513,16 @@
1005 }
1006 else
1007 {
1008- throwTypeException( err::FORG0001, aErrorInfo );
1009+ throwFORG0001Exception(strval, errInfo);
1010 }
1011
1012 pos = str - strval.c_str();
1013 ascii::skip_whitespace(strval.c_str(), len, &pos);
1014
1015 if (pos != len)
1016- throwTypeException( err::FORG0001, aErrorInfo );
1017+ {
1018+ throwFORG0001Exception(strval, errInfo);
1019+ }
1020
1021 aFactory->createBoolean(result, lRetValue);
1022 }
1023@@ -448,7 +537,7 @@
1024 return;
1025 }
1026
1027- throwTypeException( err::FORG0001, aErrorInfo );
1028+ throwFORG0001Exception(strval, errInfo);
1029 }
1030
1031
1032@@ -460,7 +549,8 @@
1033 aFactory->createHexBinary(result, n);
1034 return;
1035 }
1036- throwTypeException( err::FORG0001, aErrorInfo );
1037+
1038+ throwFORG0001Exception(strval, errInfo);
1039 }
1040
1041
1042@@ -474,7 +564,7 @@
1043 }
1044 catch (ZorbaException& e)
1045 {
1046- e.set_diagnostic( err::FORG0001 );
1047+ e.set_diagnostic(err::FORG0001);
1048 throw;
1049 }
1050 }
1051@@ -488,7 +578,7 @@
1052 zstring::size_type lidx = strval.rfind(":", strval.size(), 1);
1053
1054 if (idx != lidx)
1055- throwTypeException(err::FORG0001, aErrorInfo);
1056+ throwFORG0001Exception(strval, errInfo);
1057
1058 zstring nsuri;
1059 zstring prefix;
1060@@ -507,20 +597,26 @@
1061 {
1062 prefix = strval.substr(0, idx);
1063
1064- if (!GenericCast::instance()->castableToNCName(prefix))
1065- throwTypeException(err::FORG0001, aErrorInfo);
1066+ if (!GenericCast::castableToNCName(prefix))
1067+ {
1068+ RAISE_ERROR(err::FORG0001, errInfo.theLoc,
1069+ ERROR_PARAMS(ZED(FORG0001_PrefixNotNCName_2), prefix));
1070+ }
1071
1072 if (nsCtx)
1073 {
1074 if (!nsCtx->findBinding(prefix, nsuri))
1075- throw XQUERY_EXCEPTION(err::FONS0004, ERROR_PARAMS(prefix));
1076+ RAISE_ERROR(err::FONS0004, errInfo.theLoc, ERROR_PARAMS(prefix));
1077 }
1078
1079 local = strval.substr(idx + 1);
1080 }
1081
1082- if (!GenericCast::instance()->castableToNCName(local))
1083- throwTypeException( err::FORG0001, aErrorInfo );
1084+ if (!GenericCast::castableToNCName(local))
1085+ {
1086+ RAISE_ERROR(err::FORG0001, errInfo.theLoc,
1087+ ERROR_PARAMS(ZED(FORG0001_LocalNotNCName_2), local));
1088+ }
1089
1090 aFactory->createQName(result, nsuri, prefix, local);
1091 }
1092@@ -541,11 +637,15 @@
1093 local = strval.substr(pos+1, strval.size());
1094 }
1095 else
1096+ {
1097 local = strval;
1098+ }
1099
1100 if (!nsCtx->findBinding(prefix, uri))
1101- ZORBA_ERROR_DESC_OSS(err::FORG0001, "Prefix '" << prefix
1102- << "' not found in current namespace context.");
1103+ {
1104+ RAISE_ERROR(err::FORG0001, errInfo.theLoc,
1105+ ERROR_PARAMS(ZED(FORG0001_PrefixNotBound_2), prefix));
1106+ }
1107
1108 store::Item_t qname;
1109 aFactory->createQName(qname, uri, prefix, local);
1110@@ -565,7 +665,7 @@
1111 {
1112 zstring strval2;
1113 aItem->getStringValue2(strval2);
1114- str_flt(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1115+ str_flt(result, aItem, strval2, aFactory, nsCtx, errInfo);
1116 }
1117
1118
1119@@ -573,7 +673,7 @@
1120 {
1121 zstring strval2;
1122 aItem->getStringValue2(strval2);
1123- str_dbl(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1124+ str_dbl(result, aItem, strval2, aFactory, nsCtx, errInfo);
1125 }
1126
1127
1128@@ -581,7 +681,7 @@
1129 {
1130 zstring strval2;
1131 aItem->getStringValue2(strval2);
1132- str_dec(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1133+ str_dec(result, aItem, strval2, aFactory, nsCtx, errInfo);
1134 }
1135
1136
1137@@ -589,7 +689,7 @@
1138 {
1139 zstring strval2;
1140 aItem->getStringValue2(strval2);
1141- str_int(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1142+ str_int(result, aItem, strval2, aFactory, nsCtx, errInfo);
1143 }
1144
1145
1146@@ -597,7 +697,7 @@
1147 {
1148 zstring strval2;
1149 aItem->getStringValue2(strval2);
1150- str_dur(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1151+ str_dur(result, aItem, strval2, aFactory, nsCtx, errInfo);
1152 }
1153
1154
1155@@ -605,7 +705,7 @@
1156 {
1157 zstring strval2;
1158 aItem->getStringValue2(strval2);
1159- str_yMD(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1160+ str_yMD(result, aItem, strval2, aFactory, nsCtx, errInfo);
1161 }
1162
1163
1164@@ -613,7 +713,7 @@
1165 {
1166 zstring strval2;
1167 aItem->getStringValue2(strval2);
1168- str_dTD(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1169+ str_dTD(result, aItem, strval2, aFactory, nsCtx, errInfo);
1170 }
1171
1172
1173@@ -621,7 +721,7 @@
1174 {
1175 zstring strval2;
1176 aItem->getStringValue2(strval2);
1177- str_dT(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1178+ str_dT(result, aItem, strval2, aFactory, nsCtx, errInfo);
1179 }
1180
1181
1182@@ -629,7 +729,7 @@
1183 {
1184 zstring strval2;
1185 aItem->getStringValue2(strval2);
1186- str_tim(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1187+ str_tim(result, aItem, strval2, aFactory, nsCtx, errInfo);
1188 }
1189
1190
1191@@ -637,7 +737,7 @@
1192 {
1193 zstring strval2;
1194 aItem->getStringValue2(strval2);
1195- str_dat(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1196+ str_dat(result, aItem, strval2, aFactory, nsCtx, errInfo);
1197 }
1198
1199
1200@@ -645,7 +745,7 @@
1201 {
1202 zstring strval2;
1203 aItem->getStringValue2(strval2);
1204- str_gYM(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1205+ str_gYM(result, aItem, strval2, aFactory, nsCtx, errInfo);
1206 }
1207
1208
1209@@ -653,7 +753,7 @@
1210 {
1211 zstring strval2;
1212 aItem->getStringValue2(strval2);
1213- str_gYr(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1214+ str_gYr(result, aItem, strval2, aFactory, nsCtx, errInfo);
1215 }
1216
1217
1218@@ -661,7 +761,7 @@
1219 {
1220 zstring strval2;
1221 aItem->getStringValue2(strval2);
1222- str_gMD(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1223+ str_gMD(result, aItem, strval2, aFactory, nsCtx, errInfo);
1224 }
1225
1226
1227@@ -669,7 +769,7 @@
1228 {
1229 zstring strval2;
1230 aItem->getStringValue2(strval2);
1231- str_gDay(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1232+ str_gDay(result, aItem, strval2, aFactory, nsCtx, errInfo);
1233 }
1234
1235
1236@@ -677,7 +777,7 @@
1237 {
1238 zstring strval2;
1239 aItem->getStringValue2(strval2);
1240- str_gMon(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1241+ str_gMon(result, aItem, strval2, aFactory, nsCtx, errInfo);
1242 }
1243
1244
1245@@ -685,7 +785,7 @@
1246 {
1247 zstring strval2;
1248 aItem->getStringValue2(strval2);
1249- str_bool(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1250+ str_bool(result, aItem, strval2, aFactory, nsCtx, errInfo);
1251 }
1252
1253
1254@@ -693,7 +793,7 @@
1255 {
1256 zstring strval2;
1257 aItem->getStringValue2(strval2);
1258- str_b64(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1259+ str_b64(result, aItem, strval2, aFactory, nsCtx, errInfo);
1260 }
1261
1262
1263@@ -701,7 +801,7 @@
1264 {
1265 zstring strval2;
1266 aItem->getStringValue2(strval2);
1267- str_hxB(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1268+ str_hxB(result, aItem, strval2, aFactory, nsCtx, errInfo);
1269 }
1270
1271
1272@@ -709,7 +809,7 @@
1273 {
1274 zstring strval2;
1275 aItem->getStringValue2(strval2);
1276- str_aURI(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1277+ str_aURI(result, aItem, strval2, aFactory, nsCtx, errInfo);
1278 }
1279
1280
1281@@ -717,13 +817,13 @@
1282 {
1283 zstring strval2;
1284 aItem->getStringValue2(strval2);
1285- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1286+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1287 }
1288
1289
1290 T1_TO_T2(flt, str)
1291 {
1292- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1293+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1294 }
1295
1296
1297@@ -740,9 +840,9 @@
1298 xs_decimal const n( aItem->getFloatValue() );
1299 aFactory->createDecimal(result, n);
1300 }
1301- catch ( std::exception const& /*e*/ )
1302+ catch (const std::exception&)
1303 {
1304- throwTypeException( err::FOCA0002, aErrorInfo );
1305+ throwFOCA0002Exception(aItem->getStringValue(), errInfo);
1306 }
1307 }
1308
1309@@ -753,9 +853,9 @@
1310 {
1311 aFactory->createInteger(result, xs_integer(aItem->getFloatValue()));
1312 }
1313- catch ( std::exception const& )
1314+ catch (const std::exception&)
1315 {
1316- throwTypeException( err::FOCA0002, aErrorInfo );
1317+ throwFOCA0002Exception(aItem->getStringValue(), errInfo);
1318 }
1319 }
1320
1321@@ -770,13 +870,13 @@
1322 {
1323 zstring strval2;
1324 aItem->getStringValue2(strval2);
1325- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1326+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1327 }
1328
1329
1330 T1_TO_T2(dbl, str)
1331 {
1332- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1333+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1334 }
1335
1336
1337@@ -793,9 +893,9 @@
1338 xs_decimal const n( aItem->getDoubleValue() );
1339 aFactory->createDecimal(result, n);
1340 }
1341- catch ( std::exception const& )
1342+ catch (const std::exception&)
1343 {
1344- throwTypeException(err::FOCA0002, aErrorInfo);
1345+ throwFOCA0002Exception(aItem->getStringValue(), errInfo);
1346 }
1347 }
1348
1349@@ -806,9 +906,9 @@
1350 {
1351 aFactory->createInteger(result, xs_integer(aItem->getDoubleValue()));
1352 }
1353- catch ( std::exception const& )
1354+ catch (const std::exception& )
1355 {
1356- throwTypeException( err::FOCA0002, aErrorInfo );
1357+ throwFOCA0002Exception(aItem->getStringValue(), errInfo);
1358 }
1359 }
1360
1361@@ -823,13 +923,13 @@
1362 {
1363 zstring strval2;
1364 aItem->getStringValue2(strval2);
1365- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1366+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1367 }
1368
1369
1370 T1_TO_T2(dec, str)
1371 {
1372- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1373+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1374 }
1375
1376
1377@@ -861,13 +961,13 @@
1378 {
1379 zstring strval2;
1380 aItem->getStringValue2(strval2);
1381- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1382+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1383 }
1384
1385
1386 T1_TO_T2(int, str)
1387 {
1388- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1389+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1390 }
1391
1392
1393@@ -899,13 +999,13 @@
1394 {
1395 zstring strval2;
1396 aItem->getStringValue2(strval2);
1397- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1398+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1399 }
1400
1401
1402 T1_TO_T2(dur, str)
1403 {
1404- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1405+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1406 }
1407
1408
1409@@ -929,13 +1029,13 @@
1410 {
1411 zstring strval2;
1412 aItem->getStringValue2(strval2);
1413- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1414+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1415 }
1416
1417
1418 T1_TO_T2(yMD, str)
1419 {
1420- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1421+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1422 }
1423
1424
1425@@ -959,13 +1059,13 @@
1426 {
1427 zstring strval2;
1428 aItem->getStringValue2(strval2);
1429- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1430+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1431 }
1432
1433
1434 T1_TO_T2(dTD, str)
1435 {
1436- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1437+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1438 }
1439
1440
1441@@ -989,13 +1089,13 @@
1442 {
1443 zstring strval2;
1444 aItem->getStringValue2(strval2);
1445- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1446+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1447 }
1448
1449
1450 T1_TO_T2(dT, str)
1451 {
1452- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1453+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1454 }
1455
1456
1457@@ -1059,13 +1159,13 @@
1458 {
1459 zstring strval2;
1460 aItem->getStringValue2(strval2);
1461- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1462+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1463 }
1464
1465
1466 T1_TO_T2(tim, str)
1467 {
1468- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1469+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1470 }
1471
1472
1473@@ -1073,13 +1173,13 @@
1474 {
1475 zstring strval2;
1476 aItem->getStringValue2(strval2);
1477- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1478+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1479 }
1480
1481
1482 T1_TO_T2(dat, str)
1483 {
1484- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1485+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1486 }
1487
1488
1489@@ -1135,13 +1235,13 @@
1490 {
1491 zstring strval2;
1492 aItem->getStringValue2(strval2);
1493- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1494+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1495 }
1496
1497
1498 T1_TO_T2(gYM, str)
1499 {
1500- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1501+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1502 }
1503
1504
1505@@ -1149,13 +1249,13 @@
1506 {
1507 zstring strval2;
1508 aItem->getStringValue2(strval2);
1509- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1510+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1511 }
1512
1513
1514 T1_TO_T2(gYr, str)
1515 {
1516- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1517+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1518 }
1519
1520
1521@@ -1163,13 +1263,13 @@
1522 {
1523 zstring strval2;
1524 aItem->getStringValue2(strval2);
1525- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1526+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1527 }
1528
1529
1530 T1_TO_T2(gMD, str)
1531 {
1532- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1533+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1534 }
1535
1536
1537@@ -1177,13 +1277,13 @@
1538 {
1539 zstring strval2;
1540 aItem->getStringValue2(strval2);
1541- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1542+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1543 }
1544
1545
1546 T1_TO_T2(gDay, str)
1547 {
1548- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1549+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1550 }
1551
1552
1553@@ -1191,13 +1291,13 @@
1554 {
1555 zstring strval2;
1556 aItem->getStringValue2(strval2);
1557- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1558+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1559 }
1560
1561
1562 T1_TO_T2(gMon, str)
1563 {
1564- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1565+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1566 }
1567
1568
1569@@ -1205,13 +1305,13 @@
1570 {
1571 zstring strval2;
1572 aItem->getStringValue2(strval2);
1573- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1574+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1575 }
1576
1577
1578 T1_TO_T2(bool, str)
1579 {
1580- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1581+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1582 }
1583
1584
1585@@ -1255,13 +1355,13 @@
1586 {
1587 zstring strval2;
1588 aItem->getStringValue2(strval2);
1589- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1590+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1591 }
1592
1593
1594 T1_TO_T2(b64, str)
1595 {
1596- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1597+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1598 }
1599
1600
1601@@ -1286,13 +1386,13 @@
1602 {
1603 zstring strval2;
1604 aItem->getStringValue2(strval2);
1605- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1606+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1607 }
1608
1609
1610 T1_TO_T2(hxB, str)
1611 {
1612- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1613+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1614 }
1615
1616
1617@@ -1307,13 +1407,13 @@
1618 {
1619 zstring strval2;
1620 aItem->getStringValue2(strval2);
1621- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1622+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1623 }
1624
1625
1626 T1_TO_T2(aURI, str)
1627 {
1628- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1629+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1630 }
1631
1632
1633@@ -1321,13 +1421,13 @@
1634 {
1635 zstring strval2;
1636 aItem->getStringValue2(strval2);
1637- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1638+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1639 }
1640
1641
1642 T1_TO_T2(QN, str)
1643 {
1644- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1645+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1646 }
1647
1648
1649@@ -1335,13 +1435,13 @@
1650 {
1651 zstring strval2;
1652 aItem->getStringValue2(strval2);
1653- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1654+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1655 }
1656
1657
1658 T1_TO_T2(NOT, str)
1659 {
1660- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1661+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1662 }
1663
1664
1665@@ -1349,13 +1449,13 @@
1666 {
1667 zstring strval2;
1668 aItem->getStringValue2(strval2);
1669- str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1670+ str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1671 }
1672
1673
1674 T1_TO_T2(uint, str)
1675 {
1676- uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);
1677+ uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1678 }
1679
1680
1681@@ -1387,7 +1487,7 @@
1682 {
1683 zstring strval2;
1684 aItem->getStringValue2(strval2);
1685- str_int(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);
1686+ str_int(result, aItem, strval2, aFactory, nsCtx, errInfo);
1687 }
1688
1689
1690@@ -1398,9 +1498,9 @@
1691 xs_nonNegativeInteger const n(aItem->getFloatValue());
1692 aFactory->createNonNegativeInteger(result, n);
1693 }
1694- catch ( std::exception const& )
1695+ catch (const std::exception& )
1696 {
1697- throwTypeException( err::FOCA0002, aErrorInfo );
1698+ throwFOCA0002Exception(aItem->getStringValue(), errInfo);
1699 }
1700 }
1701
1702@@ -1412,9 +1512,9 @@
1703 xs_nonNegativeInteger const n(aItem->getIntegerValue());
1704 aFactory->createNonNegativeInteger(result, n);
1705 }
1706- catch ( std::exception const& )
1707+ catch (const std::exception& )
1708 {
1709- throwTypeException( err::FOCA0002, aErrorInfo );
1710+ throwFOCA0002Exception(aItem->getStringValue(), errInfo);
1711 }
1712 }
1713
1714@@ -1426,9 +1526,9 @@
1715 xs_integer const n(aItem->getIntegerValue());
1716 aFactory->createInteger(result, n);
1717 }
1718- catch ( std::exception const& )
1719+ catch (const std::exception& )
1720 {
1721- throwTypeException( err::FOCA0002, aErrorInfo );
1722+ throwFOCA0002Exception(aItem->getStringValue(), errInfo);
1723 }
1724 }
1725
1726@@ -1440,9 +1540,9 @@
1727 xs_nonNegativeInteger const n(aItem->getDoubleValue());
1728 aFactory->createInteger(result, n);
1729 }
1730- catch ( std::exception const& )
1731+ catch (const std::exception& )
1732 {
1733- throwTypeException( err::FOCA0002, aErrorInfo );
1734+ throwFOCA0002Exception(aItem->getStringValue(), errInfo);
1735 }
1736 }
1737
1738@@ -1463,24 +1563,6 @@
1739 }
1740
1741
1742-T1_TO_T2(str, uint)
1743-{
1744- try
1745- {
1746- xs_nonNegativeInteger const n(strval.c_str());
1747- aFactory->createNonNegativeInteger(result, n);
1748- }
1749- catch ( std::invalid_argument const& )
1750- {
1751- throwTypeException( err::FORG0001, aErrorInfo );
1752- }
1753- catch ( std::range_error const& )
1754- {
1755- throwTypeException( err::FOCA0002, aErrorInfo );
1756- }
1757-}
1758-
1759-
1760 T1_TO_T2(NUL, str)
1761 {
1762 zstring val("null");
1763@@ -1496,7 +1578,7 @@
1764 const store::Item* aItem,
1765 store::SchemaTypeCode aTargetAtomicType,
1766 store::ItemFactory* factory,
1767- const ErrorInfo& aErrorInfo)
1768+ const ErrorInfo& errInfo)
1769 {
1770 zstring strval;
1771 aItem->getStringValue2(strval);
1772@@ -1557,7 +1639,7 @@
1773 ascii::normalize_whitespace(strval);
1774 ascii::trim_whitespace(strval);
1775
1776- if (GenericCast::instance()->castableToNCName(strval))
1777+ if (GenericCast::castableToNCName(strval))
1778 {
1779 factory->createNCName(result, strval);
1780 return;
1781@@ -1566,7 +1648,7 @@
1782 }
1783 case store::XS_ID:
1784 {
1785- if (GenericCast::instance()->castableToNCName(strval))
1786+ if (GenericCast::castableToNCName(strval))
1787 {
1788 factory->createID(result, strval);
1789 return;
1790@@ -1575,7 +1657,7 @@
1791 }
1792 case store::XS_IDREF:
1793 {
1794- if (GenericCast::instance()->castableToNCName(strval))
1795+ if (GenericCast::castableToNCName(strval))
1796 {
1797 factory->createIDREF(result, strval);
1798 return;
1799@@ -1584,7 +1666,7 @@
1800 }
1801 case store::XS_ENTITY:
1802 {
1803- if (GenericCast::instance()->castableToNCName(strval))
1804+ if (GenericCast::castableToNCName(strval))
1805 {
1806 factory->createENTITY(result, strval);
1807 return;
1808@@ -1595,7 +1677,7 @@
1809 ZORBA_ASSERT(false);
1810 }
1811
1812- throwTypeException(err::FORG0001, aErrorInfo);
1813+ throwFORG0001Exception(strval, errInfo);
1814 }
1815
1816
1817@@ -1795,7 +1877,7 @@
1818 ZORBA_ASSERT(false);
1819 }
1820
1821- throwTypeException(err::FORG0001, errInfo);
1822+ throwFORG0001Exception(aItem->getStringValue(), errInfo);
1823 }
1824
1825
1826@@ -2047,6 +2129,7 @@
1827 const QueryLoc& loc)
1828 {
1829 const TypeManager* ttm = targetType->get_manager();
1830+
1831 if (ttm != tm && ttm != &GENV_TYPESYSTEM && !TypeOps::is_in_scope(tm, *targetType))
1832 {
1833 RAISE_ERROR(err::XPTY0004, loc,
1834@@ -2129,8 +2212,13 @@
1835 }
1836 }
1837
1838+ xqtref_t sourceType = tm->create_value_type(item);
1839+
1840 RAISE_ERROR(err::FORG0001, loc,
1841- ERROR_PARAMS(item->getStringValue(), ZED(NoCastTo_34o), udt->toSchemaString()));
1842+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234),
1843+ item->getStringValue(),
1844+ sourceType->toSchemaString(),
1845+ udt->toSchemaString()));
1846 } // union
1847 #endif // ZORBA_NO_XMLSCHEMA
1848 } // list or union
1849@@ -2195,7 +2283,7 @@
1850 CastFunc castFunc = theCastMatrix[theMapping[sourceTypeCode]]
1851 [theMapping[targetTypeCode]];
1852 if (castFunc == 0)
1853- throwTypeException(err::XPTY0004, errInfo);
1854+ throwXPTY0004Exception(errInfo);
1855
1856 (*castFunc)(result, item, str, factory, nsCtx, errInfo);
1857 }
1858@@ -2323,7 +2411,7 @@
1859
1860 if (sourceTypeCode == store::XS_ANY_ATOMIC)
1861 {
1862- throwTypeException(err::XPTY0004, errInfo);
1863+ throwXPTY0004Exception(errInfo);
1864 }
1865
1866 if (targetTypeCode == store::XS_NCNAME &&
1867@@ -2331,14 +2419,14 @@
1868 sourceTypeCode != store::XS_NCNAME &&
1869 sourceTypeCode != store::XS_UNTYPED_ATOMIC)
1870 {
1871- throwTypeException(err::XPTY0004, errInfo);
1872+ throwXPTY0004Exception(errInfo);
1873 }
1874
1875 CastFunc castFunc = theCastMatrix[theMapping[sourceTypeCode]]
1876 [theMapping[targetTypeCode]];
1877 if (castFunc == 0)
1878 {
1879- throwTypeException(err::XPTY0004, errInfo);
1880+ throwXPTY0004Exception(errInfo);
1881 }
1882
1883 if (theMapping[sourceTypeCode] == theMapping[store::XS_STRING])
1884@@ -2392,19 +2480,21 @@
1885 ERROR_PARAMS(ZED(BadType_23o), *sourceType, ZED(NoCastTo_45o), "QName"));
1886 }
1887
1888- ErrorInfo errorInfo(sourceType.getp(), rtm.QNAME_TYPE_ONE.getp(), loc);
1889+ ErrorInfo errInfo(sourceType.getp(), rtm.QNAME_TYPE_ONE.getp(), loc);
1890
1891 zstring strval;
1892 item->getStringValue2(strval);
1893+
1894 ascii::trim_whitespace(strval);
1895
1896 zstring::size_type idx = strval.find(":");
1897 zstring::size_type lidx = strval.rfind(":", strval.size(), 1);
1898+
1899 if (idx != lidx)
1900- throwTypeException(err::FORG0001, errorInfo);
1901+ throwFORG0001Exception(strval, errInfo);
1902
1903+ zstring nsuri;
1904 zstring prefix;
1905- zstring nsuri;
1906 zstring local;
1907
1908 if (idx == zstring::npos)
1909@@ -2420,20 +2510,26 @@
1910 {
1911 prefix = strval.substr(0, idx);
1912
1913- if (!GenericCast::instance()->castableToNCName(prefix))
1914- throwTypeException(err::FORG0001, errorInfo);
1915+ if (!GenericCast::castableToNCName(prefix))
1916+ {
1917+ RAISE_ERROR(err::FORG0001, errInfo.theLoc,
1918+ ERROR_PARAMS(ZED(FORG0001_PrefixNotNCName_2), prefix));
1919+ }
1920
1921 if (nsCtx)
1922 {
1923 if (!nsCtx->findBinding(prefix, nsuri))
1924- throw XQUERY_EXCEPTION(err::FONS0004, ERROR_PARAMS(prefix));
1925+ RAISE_ERROR(err::FONS0004, errInfo.theLoc, ERROR_PARAMS(prefix));
1926 }
1927
1928 local = strval.substr(idx + 1);
1929 }
1930
1931- if (!GenericCast::instance()->castableToNCName(local.c_str()))
1932- throwTypeException(err::FORG0001, errorInfo );
1933+ if (!GenericCast::castableToNCName(local))
1934+ {
1935+ RAISE_ERROR(err::FORG0001, errInfo.theLoc,
1936+ ERROR_PARAMS(ZED(FORG0001_LocalNotNCName_2), local));
1937+ }
1938
1939 return GENV_ITEMFACTORY->createQName(result, nsuri, prefix, local);
1940 }
1941
1942=== modified file 'src/types/schema/XercesParseUtils.cpp'
1943--- src/types/schema/XercesParseUtils.cpp 2012-09-19 21:16:15 +0000
1944+++ src/types/schema/XercesParseUtils.cpp 2013-01-11 00:47:24 +0000
1945@@ -67,9 +67,8 @@
1946 }
1947 else
1948 {
1949- throw XQUERY_EXCEPTION(
1950- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "boolean" )
1951- );
1952+ throw XQUERY_EXCEPTION(err::FORG0001,
1953+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:boolean"));
1954 }
1955 }
1956
1957@@ -96,9 +95,8 @@
1958 }
1959 else
1960 {
1961- throw XQUERY_EXCEPTION(
1962- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "integer" )
1963- );
1964+ throw XQUERY_EXCEPTION(err::FORG0001,
1965+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:integer"));
1966 }
1967 }
1968
1969@@ -125,10 +123,8 @@
1970 }
1971 else
1972 {
1973- throw XQUERY_EXCEPTION(
1974- err::FORG0001,
1975- ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "positiveInteger" )
1976- );
1977+ throw XQUERY_EXCEPTION(err::FORG0001,
1978+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:positiveInteger"));
1979 }
1980 }
1981
1982@@ -155,10 +151,8 @@
1983 }
1984 else
1985 {
1986- throw XQUERY_EXCEPTION(
1987- err::FORG0001,
1988- ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "nonPositiveInteger" )
1989- );
1990+ throw XQUERY_EXCEPTION(err::FORG0001,
1991+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:nonPositiveInteger"));
1992 }
1993 }
1994
1995@@ -185,13 +179,12 @@
1996 }
1997 else
1998 {
1999- throw XQUERY_EXCEPTION(
2000- err::FORG0001,
2001- ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "negativeInteger" )
2002- );
2003+ throw XQUERY_EXCEPTION(err::FORG0001,
2004+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:negativeInteger"));
2005 }
2006 }
2007
2008+
2009 bool XercesParseUtils::parseXSNonNegativeInteger(
2010 const zstring& textValue,
2011 store::Item_t &result)
2012@@ -214,13 +207,12 @@
2013 }
2014 else
2015 {
2016- throw XQUERY_EXCEPTION(
2017- err::FORG0001,
2018- ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "nonNegativeInteger" )
2019- );
2020+ throw XQUERY_EXCEPTION(err::FORG0001,
2021+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:nonNegativeInteger"));
2022 }
2023 }
2024
2025+
2026 bool XercesParseUtils::parseXSUnsignedByte(
2027 const zstring& textValue,
2028 store::Item_t &result)
2029@@ -243,13 +235,12 @@
2030 }
2031 else
2032 {
2033- throw XQUERY_EXCEPTION(
2034- err::FORG0001,
2035- ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "unsignedByte" )
2036- );
2037+ throw XQUERY_EXCEPTION(err::FORG0001,
2038+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:unsignedByte"));
2039 }
2040 }
2041
2042+
2043 bool XercesParseUtils::parseXSUnsignedShort(
2044 const zstring& textValue,
2045 store::Item_t &result)
2046@@ -272,12 +263,12 @@
2047 }
2048 else
2049 {
2050- throw XQUERY_EXCEPTION(
2051- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "unsignedShort" )
2052- );
2053+ throw XQUERY_EXCEPTION(err::FORG0001,
2054+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:unsignedShort"));
2055 }
2056 }
2057
2058+
2059 bool XercesParseUtils::parseXSUnsignedInt(
2060 const zstring& textValue,
2061 store::Item_t &result)
2062@@ -300,14 +291,15 @@
2063 }
2064 else
2065 {
2066- throw XQUERY_EXCEPTION(
2067- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "unsignedInt" )
2068- );
2069+ throw XQUERY_EXCEPTION(err::FORG0001,
2070+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:unsignedInt"));
2071 }
2072 }
2073
2074+
2075 bool XercesParseUtils::parseXSUnsignedLong(
2076- const zstring& textValue, store::Item_t &result)
2077+ const zstring& textValue,
2078+ store::Item_t &result)
2079 {
2080 XMLCh* content = XMLString::transcode(textValue.c_str());
2081 XSValue::DataType datatype = XSValue::dt_unsignedLong;
2082@@ -327,13 +319,12 @@
2083 }
2084 else
2085 {
2086- throw XQUERY_EXCEPTION(
2087- err::FORG0001,
2088- ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "unsignedLong" )
2089- );
2090+ throw XQUERY_EXCEPTION(err::FORG0001,
2091+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:unsignedLong"));
2092 }
2093 }
2094
2095+
2096 bool XercesParseUtils::parseXSByte(
2097 const zstring& textValue,
2098 store::Item_t &result)
2099@@ -356,12 +347,12 @@
2100 }
2101 else
2102 {
2103- throw XQUERY_EXCEPTION(
2104- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "byte" )
2105- );
2106+ throw XQUERY_EXCEPTION(err::FORG0001,
2107+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:byte"));
2108 }
2109 }
2110
2111+
2112 bool XercesParseUtils::parseXSShort(
2113 const zstring& textValue,
2114 store::Item_t &result)
2115@@ -384,12 +375,12 @@
2116 }
2117 else
2118 {
2119- throw XQUERY_EXCEPTION(
2120- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "short" )
2121- );
2122+ throw XQUERY_EXCEPTION(err::FORG0001,
2123+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:short"));
2124 }
2125 }
2126
2127+
2128 bool XercesParseUtils::parseXSInt(
2129 const zstring& textValue,
2130 store::Item_t &result)
2131@@ -412,12 +403,12 @@
2132 }
2133 else
2134 {
2135- throw XQUERY_EXCEPTION(
2136- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "int" )
2137- );
2138+ throw XQUERY_EXCEPTION(err::FORG0001,
2139+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:int"));
2140 }
2141 }
2142
2143+
2144 bool XercesParseUtils::parseXSLong(
2145 const zstring& textValue,
2146 store::Item_t &result)
2147@@ -440,12 +431,12 @@
2148 }
2149 else
2150 {
2151- throw XQUERY_EXCEPTION(
2152- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "long" )
2153- );
2154+ throw XQUERY_EXCEPTION(err::FORG0001,
2155+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:long"));
2156 }
2157 }
2158
2159+
2160 bool XercesParseUtils::parseXSFloat(
2161 const zstring& textValue,
2162 store::Item_t &result)
2163@@ -470,7 +461,8 @@
2164 //textValue = textValue.trim(" \n\r\t",4);
2165 zstring textValue2;
2166 utf8::normalize_whitespace(textValue, &textValue2);
2167- try {
2168+ try
2169+ {
2170 xs_float const n(textValue2.c_str());
2171 return GENV_ITEMFACTORY->createFloat(result, n);
2172 }
2173@@ -479,11 +471,11 @@
2174 }
2175 }
2176
2177- throw XQUERY_EXCEPTION(
2178- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "float" )
2179- );
2180+ throw XQUERY_EXCEPTION(err::FORG0001,
2181+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:float"));
2182 }
2183
2184+
2185 bool XercesParseUtils::parseXSDouble(
2186 const zstring& textValue,
2187 store::Item_t &result)
2188@@ -517,11 +509,11 @@
2189 }
2190 }
2191
2192- throw XQUERY_EXCEPTION(
2193- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "double" )
2194- );
2195+ throw XQUERY_EXCEPTION(err::FORG0001,
2196+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:double"));
2197 }
2198
2199+
2200 bool XercesParseUtils::parseXSDecimal(
2201 const zstring& textValue,
2202 store::Item_t &result)
2203@@ -542,12 +534,12 @@
2204 }
2205 else
2206 {
2207- throw XQUERY_EXCEPTION(
2208- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "decimal" )
2209- );
2210+ throw XQUERY_EXCEPTION(err::FORG0001,
2211+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:decimal"));
2212 }
2213 }
2214
2215+
2216 // string types
2217 bool XercesParseUtils::parseXSString(
2218 const zstring& textValue,
2219@@ -560,6 +552,7 @@
2220 return factory->createString(result, textValue2);
2221 }
2222
2223+
2224 bool XercesParseUtils::parseXSNormalizedString(
2225 const zstring& textValue,
2226 store::Item_t &result)
2227@@ -600,9 +593,8 @@
2228 }
2229 else
2230 {
2231- throw XQUERY_EXCEPTION(
2232- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "NMToken" )
2233- );
2234+ throw XQUERY_EXCEPTION(err::FORG0001,
2235+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:NMToken"));
2236 }
2237 }
2238
2239@@ -629,9 +621,8 @@
2240 }
2241 else
2242 {
2243- throw XQUERY_EXCEPTION(
2244- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "NMToken" )
2245- );
2246+ throw XQUERY_EXCEPTION(err::FORG0001,
2247+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:NMToken"));
2248 }
2249 }
2250
2251@@ -659,9 +650,8 @@
2252 }
2253 else
2254 {
2255- throw XQUERY_EXCEPTION(
2256- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "Name" )
2257- );
2258+ throw XQUERY_EXCEPTION(err::FORG0001,
2259+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:Name"));
2260 }
2261 }
2262
2263@@ -688,9 +678,8 @@
2264 }
2265 else
2266 {
2267- throw XQUERY_EXCEPTION(
2268- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "NCName" )
2269- );
2270+ throw XQUERY_EXCEPTION(err::FORG0001,
2271+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:NCName"));
2272 }
2273 }
2274
2275@@ -717,9 +706,8 @@
2276 }
2277 else
2278 {
2279- throw XQUERY_EXCEPTION(
2280- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "ID" )
2281- );
2282+ throw XQUERY_EXCEPTION(err::FORG0001,
2283+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:ID"));
2284 }
2285 }
2286
2287@@ -746,9 +734,8 @@
2288 }
2289 else
2290 {
2291- throw XQUERY_EXCEPTION(
2292- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "IDREF" )
2293- );
2294+ throw XQUERY_EXCEPTION(err::FORG0001,
2295+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:IDREF"));
2296 }
2297 }
2298
2299@@ -775,9 +762,8 @@
2300 }
2301 else
2302 {
2303- throw XQUERY_EXCEPTION(
2304- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "ENTITY" )
2305- );
2306+ throw XQUERY_EXCEPTION(err::FORG0001,
2307+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:ENTITY"));
2308 }
2309 }
2310
2311@@ -804,9 +790,8 @@
2312 }
2313 else
2314 {
2315- throw XQUERY_EXCEPTION(
2316- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "NOTATION" )
2317- );
2318+ throw XQUERY_EXCEPTION(err::FORG0001,
2319+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:NOTATION"));
2320 }
2321 }
2322
2323@@ -855,9 +840,8 @@
2324 }
2325 }
2326
2327- throw XQUERY_EXCEPTION(
2328- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "dateTime" )
2329- );
2330+ throw XQUERY_EXCEPTION(err::FORG0001,
2331+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:dateTime"));
2332 }
2333
2334
2335@@ -896,9 +880,8 @@
2336 }
2337 }
2338
2339- throw XQUERY_EXCEPTION(
2340- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "date" )
2341- );
2342+ throw XQUERY_EXCEPTION(err::FORG0001,
2343+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:date"));
2344 }
2345
2346
2347@@ -942,9 +925,8 @@
2348 }
2349 }
2350
2351- throw XQUERY_EXCEPTION(
2352- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "time" )
2353- );
2354+ throw XQUERY_EXCEPTION(err::FORG0001,
2355+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:time"));
2356 }
2357
2358
2359@@ -978,9 +960,8 @@
2360 }
2361 }
2362
2363- throw XQUERY_EXCEPTION(
2364- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "gYearMonth" )
2365- );
2366+ throw XQUERY_EXCEPTION(err::FORG0001,
2367+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:gYearMonth"));
2368 }
2369
2370
2371@@ -1013,9 +994,8 @@
2372 }
2373 }
2374
2375- throw XQUERY_EXCEPTION(
2376- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "gYear" )
2377- );
2378+ throw XQUERY_EXCEPTION(err::FORG0001,
2379+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:gYear"));
2380 }
2381
2382
2383@@ -1048,9 +1028,8 @@
2384 }
2385 }
2386
2387- throw XQUERY_EXCEPTION(
2388- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "gMonthDay" )
2389- );
2390+ throw XQUERY_EXCEPTION(err::FORG0001,
2391+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:gMonthDay"));
2392 }
2393
2394
2395@@ -1082,9 +1061,8 @@
2396 }
2397 }
2398
2399- throw XQUERY_EXCEPTION(
2400- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "gDay" )
2401- );
2402+ throw XQUERY_EXCEPTION(err::FORG0001,
2403+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:gDay"));
2404 }
2405
2406
2407@@ -1116,9 +1094,8 @@
2408 }
2409 }
2410
2411- throw XQUERY_EXCEPTION(
2412- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "gDay" )
2413- );
2414+ throw XQUERY_EXCEPTION(err::FORG0001,
2415+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:gDay"));
2416 }
2417
2418
2419@@ -1154,9 +1131,8 @@
2420 return factory->createDuration(result, &tValue);
2421 }
2422
2423- throw XQUERY_EXCEPTION(
2424- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "duration" )
2425- );
2426+ throw XQUERY_EXCEPTION(err::FORG0001,
2427+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:duration"));
2428 }
2429
2430
2431@@ -1172,10 +1148,8 @@
2432 return factory->createYearMonthDuration(result, &d);
2433 }
2434
2435- throw XQUERY_EXCEPTION(
2436- err::FORG0001,
2437- ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "yearMonthDuration" )
2438- );
2439+ throw XQUERY_EXCEPTION(err::FORG0001,
2440+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:yearMonthDuration"));
2441 }
2442
2443
2444@@ -1191,10 +1165,8 @@
2445 return factory->createDayTimeDuration(result, &d);
2446 }
2447
2448- throw XQUERY_EXCEPTION(
2449- err::FORG0001,
2450- ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "dayTimeDuration" )
2451- );
2452+ throw XQUERY_EXCEPTION(err::FORG0001,
2453+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:dayTimeDuration"));
2454 }
2455
2456
2457@@ -1241,10 +1213,8 @@
2458 return factory->createBase64Binary(result, tValue);
2459 }
2460
2461- throw XQUERY_EXCEPTION(
2462- err::FORG0001,
2463- ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "base64Binary" )
2464- );
2465+ throw XQUERY_EXCEPTION(err::FORG0001,
2466+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:base64Binary"));
2467 }
2468
2469
2470@@ -1269,9 +1239,8 @@
2471 return factory->createHexBinary(result, tValue);
2472 }
2473
2474- throw XQUERY_EXCEPTION(
2475- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "hexBinary" )
2476- );
2477+ throw XQUERY_EXCEPTION(err::FORG0001,
2478+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:hexBinary"));
2479 }
2480
2481
2482@@ -1296,9 +1265,8 @@
2483 return factory->createAnyURI(result, textValue2);
2484 }
2485
2486- throw XQUERY_EXCEPTION(
2487- err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "anyURI" )
2488- );
2489+ throw XQUERY_EXCEPTION(err::FORG0001,
2490+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:anyURI"));
2491 }
2492
2493
2494
2495=== modified file 'src/types/schema/schema.cpp'
2496--- src/types/schema/schema.cpp 2013-01-08 08:34:08 +0000
2497+++ src/types/schema/schema.cpp 2013-01-11 00:47:24 +0000
2498@@ -1691,7 +1691,7 @@
2499 if (!xsiTypeDV)
2500 {
2501 RAISE_ERROR(err::FORG0001, loc,
2502- ERROR_PARAMS(targetType, ZED(NoTypeInCtx)));
2503+ ERROR_PARAMS(ZED(FORG0001_NoTypeInCtx_2), targetType->toSchemaString()));
2504 }
2505
2506 // workaround for validating xs:NOTATION with Xerces
2507@@ -1712,8 +1712,8 @@
2508 }
2509 else
2510 {
2511- ZORBA_ERROR_DESC_OSS(err::FORG0001, "Prefix '" << prefix <<
2512- "' not found in current namespace context.");
2513+ RAISE_ERROR(err::FORG0001, loc,
2514+ ERROR_PARAMS(ZED(FORG0001_PrefixNotBound_2), prefix));
2515 }
2516 }
2517 else
2518@@ -1725,7 +1725,7 @@
2519 else
2520 {
2521 RAISE_ERROR(err::FORG0001, loc,
2522- ERROR_PARAMS(targetType, ZED(NoTypeInCtx)));
2523+ ERROR_PARAMS(ZED(FORG0001_NoTypeInCtx_2), targetType->toSchemaString()));
2524 }
2525 }
2526 catch (XMLException& idve)
2527@@ -1734,7 +1734,10 @@
2528 transcode(idve.getMessage(), msg);
2529
2530 RAISE_ERROR(err::FORG0001, loc,
2531- ERROR_PARAMS(textValue, ZED(NoCastTo_34o), targetType, msg));
2532+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o),
2533+ textValue,
2534+ targetType->toSchemaString(),
2535+ msg));
2536 }
2537 catch(const OutOfMemoryException&)
2538 {
2539@@ -1831,7 +1834,7 @@
2540 if (atomicTextValues.empty())
2541 {
2542 RAISE_ERROR(err::FORG0001, loc,
2543- ERROR_PARAMS(textValue, ZED(NoCastTo_34o), udt->toSchemaString()));
2544+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, udt->toSchemaString()));
2545 }
2546
2547 for (csize i = 0; i < atomicTextValues.size() ; ++i)
2548@@ -1881,7 +1884,7 @@
2549 }
2550
2551 RAISE_ERROR(err::FORG0001, loc,
2552- ERROR_PARAMS(textValue, ZED(NoCastTo_34o), udt->toSchemaString()));
2553+ ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, udt->toSchemaString()));
2554 }
2555
2556
2557@@ -1906,8 +1909,7 @@
2558 const UserDefinedXQType* udXQType =
2559 static_cast<const UserDefinedXQType*>(aTargetType.getp());
2560
2561- ZORBA_ASSERT( udXQType->isAtomic() || udXQType->isList() ||
2562- udXQType->isUnion() );
2563+ ZORBA_ASSERT(udXQType->isAtomic() || udXQType->isList() || udXQType->isUnion());
2564
2565
2566 switch ( udXQType->getTypeCategory() )
2567
2568=== modified file 'src/zorbatypes/URI.cpp'
2569--- src/zorbatypes/URI.cpp 2012-09-19 21:16:15 +0000
2570+++ src/zorbatypes/URI.cpp 2013-01-11 00:47:24 +0000
2571@@ -945,26 +945,30 @@
2572 {
2573 if ( lIndex + 2 >= lEnd )
2574 {
2575- throw XQUERY_EXCEPTION(
2576- err::XQST0046, ERROR_PARAMS( uri, ZED( BadHexSequence ) )
2577- );
2578+ throw XQUERY_EXCEPTION(err::XQST0046,
2579+ ERROR_PARAMS(uri, ZED(BadHexSequence)));
2580 }
2581+
2582 unicode::code_point lHex1 = lCodepoints[++lIndex];
2583- if(!ascii::is_xdigit(lHex1))
2584- throw XQUERY_EXCEPTION(
2585- err::XQST0046, ERROR_PARAMS( uri, ZED( BadHexDigit_3 ), lHex1 )
2586- );
2587+
2588+ if (!ascii::is_xdigit(lHex1))
2589+ {
2590+ throw XQUERY_EXCEPTION(err::XQST0046,
2591+ ERROR_PARAMS(uri, ZED(XQST0046_BadHexDigit_3), lHex1));
2592+ }
2593+
2594 unicode::code_point lHex2 = lCodepoints[++lIndex];
2595- if(!ascii::is_xdigit(lHex2))
2596- throw XQUERY_EXCEPTION(
2597- err::XQST0046, ERROR_PARAMS( uri, ZED( BadHexDigit_3 ), lHex2 )
2598- );
2599+
2600+ if (!ascii::is_xdigit(lHex2))
2601+ {
2602+ throw XQUERY_EXCEPTION(err::XQST0046,
2603+ ERROR_PARAMS(uri, ZED(XQST0046_BadHexDigit_3), lHex2));
2604+ }
2605 }
2606 else if (!is_unreserved_char(lCp) && !is_path_character(lCp) && valid)
2607 {
2608- throw XQUERY_EXCEPTION(
2609- err::XQST0046, ERROR_PARAMS( uri, ZED( BadUnicodeChar_3 ), lCp )
2610- );
2611+ throw XQUERY_EXCEPTION(err::XQST0046,
2612+ ERROR_PARAMS(uri, ZED(BadUnicodeChar_3), lCp));
2613 }
2614 ++lIndex;
2615 }
2616
2617=== modified file 'src/zorbatypes/binary.cpp'
2618--- src/zorbatypes/binary.cpp 2012-09-19 21:16:15 +0000
2619+++ src/zorbatypes/binary.cpp 2013-01-11 00:47:24 +0000
2620@@ -28,16 +28,16 @@
2621 #include "util/base64_util.h"
2622 #include "util/stl_util.h"
2623
2624-#define CATCH_BASE64_EXCEPTION() \
2625- catch ( base64::exception const &e ) { \
2626- throw XQUERY_EXCEPTION( \
2627- err::FORG0001, ERROR_PARAMS( e.invalid_char(), ZED( Base64BadChar ) ) \
2628- ); \
2629- } \
2630- catch ( std::invalid_argument const& ) { \
2631- throw XQUERY_EXCEPTION( \
2632- err::FORG0001, ERROR_PARAMS( "", ZED( Base64Multiple4 ) ) \
2633- ); \
2634+#define CATCH_BASE64_EXCEPTION() \
2635+ catch (const base64::exception& e) \
2636+ { \
2637+ throw XQUERY_EXCEPTION(err::FORG0001, \
2638+ ERROR_PARAMS(ZED(FORG0001_Base64BadChar_2), e.invalid_char())); \
2639+ } \
2640+ catch (const std::invalid_argument& ) \
2641+ { \
2642+ throw XQUERY_EXCEPTION(err::FORG0001, \
2643+ ERROR_PARAMS(ZED(FORG0001_Base64Multiple4))); \
2644 }
2645
2646 using namespace std;
2647@@ -330,9 +330,8 @@
2648
2649 if (len % 2 != 0)
2650 {
2651- throw XQUERY_EXCEPTION(
2652- err::FORG0001, ERROR_PARAMS( "", ZED( HexBinaryMustBeEven ) )
2653- );
2654+ throw XQUERY_EXCEPTION(err::FORG0001,
2655+ ERROR_PARAMS(ZED(FORG0001_HexBinaryMustBeEven)));
2656 }
2657
2658 for (size_t i = 0; i < len; ++i)
2659@@ -349,9 +348,8 @@
2660 }
2661 else
2662 {
2663- throw XQUERY_EXCEPTION(
2664- err::FORG0001, ERROR_PARAMS( lChar, ZED( BadHexDigit_3 ), lChar )
2665- );
2666+ throw XQUERY_EXCEPTION(err::FORG0001,
2667+ ERROR_PARAMS(ZED(FORG0001_BadHexDigit_2), lChar));
2668 }
2669 }
2670 }
2671
2672=== modified file 'test/rbkt/ExpQueryResults/zorba/trycatch/trycatch4.xml.res'
2673--- test/rbkt/ExpQueryResults/zorba/trycatch/trycatch4.xml.res 2012-09-19 21:16:15 +0000
2674+++ test/rbkt/ExpQueryResults/zorba/trycatch/trycatch4.xml.res 2013-01-11 00:47:24 +0000
2675@@ -1,1 +1,1 @@
2676-Ha! It worked err:FORG0001 "xs:string": invalid value for cast/constructor: can not cast to "xs:integer"
2677+Ha! It worked err:FORG0001 "a": value of type xs:string is not castable to type xs:integer

Subscribers

People subscribed via source and target branches