Merge lp:~zorba-coders/zorba/bug-1103819 into lp:zorba
- bug-1103819
- Merge into trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~zorba-coders/zorba/bug-1103819 |
Merge into: | lp:zorba |
Diff against target: |
1283 lines (+397/-393) 16 files modified
src/api/xqueryimpl.cpp (+3/-17) src/capi/cdynamic_context.cpp (+1/-4) src/capi/cexpression.cpp (+1/-4) src/capi/cimplementation.cpp (+1/-4) src/capi/csequence.cpp (+1/-4) src/capi/cstatic_context.cpp (+1/-4) src/context/default_url_resolvers.cpp (+6/-0) src/runtime/debug/debug_iterator_impl.cpp (+11/-18) src/runtime/indexing/doc_indexer.cpp (+1/-3) src/store/naive/loader_dtd.cpp (+118/-8) src/store/naive/loader_fast.cpp (+51/-89) src/store/naive/node_items.cpp (+13/-27) src/store/naive/node_updates.cpp (+179/-186) src/store/naive/pul_primitives.cpp (+5/-1) src/store/naive/store.cpp (+2/-3) src/types/schema/schema.cpp (+3/-21) |
To merge this branch: | bzr merge lp:~zorba-coders/zorba/bug-1103819 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Chris Hillery | Needs Information | ||
Paul J. Lucas | Approve | ||
Review via email:
|
Commit message
Reworked some catch clauses.
Description of the change
Reworked some catch clauses.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Zorba Build Bot (zorba-buildbot) wrote : | # |
The attempt to merge lp:~zorba-coders/zorba/bug-1103819 into lp:zorba failed. Below is the output from the failed tests.
CMake Error at /home/ceej/
Validation queue job bug-1103819-2013-02-
final status was:
31 tests did not succeed - changes not commited.
Error in read script: /home/ceej/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for merge proposal.
Log at: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Zorba Build Bot (zorba-buildbot) wrote : | # |
The attempt to merge lp:~zorba-coders/zorba/bug-1103819 into lp:zorba failed. Below is the output from the failed tests.
CMake Error at /home/ceej/
Validation queue job bug-1103819-2013-02-
final status was:
6 tests did not succeed - changes not commited.
Error in read script: /home/ceej/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for merge proposal.
Log at: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Zorba Build Bot (zorba-buildbot) wrote : | # |
The attempt to merge lp:~zorba-coders/zorba/bug-1103819 into lp:zorba failed. Below is the output from the failed tests.
CMake Error at /home/ceej/
Validation queue job bug-1103819-2013-04-
final status was:
117 tests did not succeed - changes not commited.
Error in read script: /home/ceej/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
Progress dashboard at http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue result for https:/
Stage "TestZorbaUbuntu" failed.
115 tests failed (8402 total tests run).
Check test results at http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Chris Hillery (ceejatec) wrote : | # |
A great number of parsing and serializing test cases fail with these changes. Do we have any plans to fix them up? It's not clear to me if anyone is driving this issue anymore...
Unmerged revisions
- 11213. By Cezar Andrei <email address hidden>
-
Remove catch throws, leave exceptions bubble up.
- 11212. By Cezar Andrei <email address hidden>
-
One more catch ... fix.
- 11211. By Cezar Andrei <email address hidden>
-
Fix catch( ... ).
- 11210. By Paul J. Lucas
-
Merge from bug1103819-catchAll.
- 11209. By Paul J. Lucas
-
Merge from trunk.
- 11208. By Paul J. Lucas
-
Merge from trunk.
- 11207. By Paul J. Lucas
-
Merge from trunk.
- 11206. By Paul J. Lucas
-
Merge from trunk.
- 11205. By Paul J. Lucas
-
Merge from trunk.
- 11204. By Paul J. Lucas
-
Merge from trunk.
Preview Diff
1 | === modified file 'src/api/xqueryimpl.cpp' |
2 | --- src/api/xqueryimpl.cpp 2013-04-10 10:13:31 +0000 |
3 | +++ src/api/xqueryimpl.cpp 2013-04-30 17:01:29 +0000 |
4 | @@ -80,6 +80,7 @@ |
5 | namespace zorba |
6 | { |
7 | |
8 | +#define QUERY_TRY try |
9 | |
10 | #define QUERY_CATCH \ |
11 | catch (ZorbaException const& e) \ |
12 | @@ -942,7 +943,7 @@ |
13 | { |
14 | SYNC_CODE(AutoMutex lock(&theMutex);) |
15 | |
16 | - try |
17 | + QUERY_TRY |
18 | { |
19 | checkNotClosed(); |
20 | checkCompiled(); |
21 | @@ -965,22 +966,7 @@ |
22 | |
23 | return true; |
24 | } |
25 | - catch (ZorbaException const& e) |
26 | - { |
27 | - ZorbaImpl::notifyError(theDiagnosticHandler, e); |
28 | - } |
29 | - catch (FlowCtlException const&) |
30 | - { |
31 | - ZorbaImpl::notifyError(theDiagnosticHandler, "User interrupt"); |
32 | - } |
33 | - catch (std::exception const& e) |
34 | - { |
35 | - ZorbaImpl::notifyError(theDiagnosticHandler, e.what()); |
36 | - } |
37 | - catch (...) |
38 | - { |
39 | - ZorbaImpl::notifyError(theDiagnosticHandler); |
40 | - } |
41 | + QUERY_CATCH |
42 | |
43 | return false; |
44 | } |
45 | |
46 | === modified file 'src/capi/cdynamic_context.cpp' |
47 | --- src/capi/cdynamic_context.cpp 2013-02-07 17:24:36 +0000 |
48 | +++ src/capi/cdynamic_context.cpp 2013-04-30 17:01:29 +0000 |
49 | @@ -271,10 +271,7 @@ |
50 | CDynamicContext::free(XQC_DynamicContext* context) |
51 | { |
52 | try { |
53 | - CDynamicContext* me = CDynamicContext::get(context); |
54 | - delete me; |
55 | - } catch (ZorbaException const&) { |
56 | - assert(false); |
57 | + delete CDynamicContext::get(context); |
58 | } catch (...) { |
59 | assert(false); |
60 | } |
61 | |
62 | === modified file 'src/capi/cexpression.cpp' |
63 | --- src/capi/cexpression.cpp 2013-02-07 17:24:36 +0000 |
64 | +++ src/capi/cexpression.cpp 2013-04-30 17:01:29 +0000 |
65 | @@ -227,10 +227,7 @@ |
66 | CExpression::free(XQC_Expression* expr) |
67 | { |
68 | try { |
69 | - CExpression* me = CExpression::get(expr); |
70 | - delete me; |
71 | - } catch (ZorbaException const&) { |
72 | - assert(false); |
73 | + delete CExpression::get(expr); |
74 | } catch (...) { |
75 | assert(false); |
76 | } |
77 | |
78 | === modified file 'src/capi/cimplementation.cpp' |
79 | --- src/capi/cimplementation.cpp 2013-02-07 17:24:36 +0000 |
80 | +++ src/capi/cimplementation.cpp 2013-04-30 17:01:29 +0000 |
81 | @@ -507,10 +507,7 @@ |
82 | CImplementation::free(XQC_Implementation* impl) |
83 | { |
84 | try { |
85 | - CImplementation* me = CImplementation::get(impl); |
86 | - delete me; |
87 | - } catch (ZorbaException const&) { |
88 | - assert(false); |
89 | + delete CImplementation::get(impl); |
90 | } catch (...) { |
91 | assert(false); |
92 | } |
93 | |
94 | === modified file 'src/capi/csequence.cpp' |
95 | --- src/capi/csequence.cpp 2013-02-07 17:24:36 +0000 |
96 | +++ src/capi/csequence.cpp 2013-04-30 17:01:29 +0000 |
97 | @@ -492,10 +492,7 @@ |
98 | CSequence::free(XQC_Sequence* seq) |
99 | { |
100 | try { |
101 | - CSequence* me = CSequence::get(seq); |
102 | - delete me; |
103 | - } catch (ZorbaException const&) { |
104 | - assert(false); |
105 | + delete CSequence::get(seq); |
106 | } catch (...) { |
107 | assert(false); |
108 | } |
109 | |
110 | === modified file 'src/capi/cstatic_context.cpp' |
111 | --- src/capi/cstatic_context.cpp 2013-02-07 17:24:36 +0000 |
112 | +++ src/capi/cstatic_context.cpp 2013-04-30 17:01:29 +0000 |
113 | @@ -666,10 +666,7 @@ |
114 | CStaticContext::free(XQC_StaticContext* context) |
115 | { |
116 | try { |
117 | - CStaticContext* me = CStaticContext::get(context); |
118 | - delete me; |
119 | - } catch (ZorbaException const&) { |
120 | - assert(false); |
121 | + delete CStaticContext::get(context); |
122 | } catch (...) { |
123 | assert(false); |
124 | } |
125 | |
126 | === modified file 'src/context/default_url_resolvers.cpp' |
127 | --- src/context/default_url_resolvers.cpp 2013-02-07 17:24:36 +0000 |
128 | +++ src/context/default_url_resolvers.cpp 2013-04-30 17:01:29 +0000 |
129 | @@ -21,6 +21,7 @@ |
130 | #include "util/uri_util.h" |
131 | #include "util/http_util.h" |
132 | #include "util/fs_util.h" |
133 | +#include "util/string_util.h" |
134 | #include "store/api/store.h" |
135 | #include "store/api/item_factory.h" |
136 | #include "store/api/collection.h" |
137 | @@ -93,6 +94,11 @@ |
138 | new StreamResource(&(lStream->getStream()), lStream->getStreamReleaser()); |
139 | lStream->setStreamReleaser(nullptr); |
140 | return lResource; |
141 | + } catch (std::exception const &e) { |
142 | + std::string const msg( |
143 | + BUILD_STRING( "Could not create stream resource: ", e.what() ) |
144 | + ); |
145 | + throw os_error::exception( "", aUrl.c_str(), msg.c_str() ); |
146 | } catch (...) { |
147 | throw os_error::exception("", aUrl.c_str(), "Could not create stream resource"); |
148 | } |
149 | |
150 | === modified file 'src/runtime/debug/debug_iterator_impl.cpp' |
151 | --- src/runtime/debug/debug_iterator_impl.cpp 2013-02-07 17:24:36 +0000 |
152 | +++ src/runtime/debug/debug_iterator_impl.cpp 2013-04-30 17:01:29 +0000 |
153 | @@ -205,25 +205,18 @@ |
154 | if (lCommons->canBreak() && (lCommons->mustBreak(lCause) || |
155 | lCommons->hasToBreakAt(loc) || lCommons->hasToBreakAt(this))) |
156 | { |
157 | - try |
158 | - { |
159 | - lCause = lCause == 0 ? CAUSE_BREAKPOINT : lCause; |
160 | - |
161 | - // tell everybody that we are the iterator who suspended |
162 | - //lCommons->setCurrentIterator(this); |
163 | - lCommons->setCurrentStaticContext(getStaticContext()); |
164 | - lCommons->setCurrentDynamicContext(planState->theLocalDynCtx); |
165 | - lCommons->setBreak(false); |
166 | - lCommons->setPlanState(planState); |
167 | + lCause = lCause == 0 ? CAUSE_BREAKPOINT : lCause; |
168 | + |
169 | + // tell everybody that we are the iterator who suspended |
170 | + //lCommons->setCurrentIterator(this); |
171 | + lCommons->setCurrentStaticContext(getStaticContext()); |
172 | + lCommons->setCurrentDynamicContext(planState->theLocalDynCtx); |
173 | + lCommons->setBreak(false); |
174 | + lCommons->setPlanState(planState); |
175 | |
176 | - // suspend |
177 | - lCommons->getRuntime()->suspendRuntime(loc, lCause); |
178 | - lCause = 0; |
179 | - } |
180 | - catch (...) |
181 | - { |
182 | - throw; |
183 | - } |
184 | + // suspend |
185 | + lCommons->getRuntime()->suspendRuntime(loc, lCause); |
186 | + lCause = 0; |
187 | } |
188 | } |
189 | #endif // ZORBA_WITH_DEBUGGER |
190 | |
191 | === modified file 'src/runtime/indexing/doc_indexer.cpp' |
192 | --- src/runtime/indexing/doc_indexer.cpp 2013-02-07 17:24:36 +0000 |
193 | +++ src/runtime/indexing/doc_indexer.cpp 2013-04-30 17:01:29 +0000 |
194 | @@ -150,9 +150,7 @@ |
195 | } |
196 | catch(...) |
197 | { |
198 | - if (key != NULL) |
199 | - delete key; |
200 | - |
201 | + delete key; |
202 | throw; |
203 | } |
204 | } |
205 | |
206 | === modified file 'src/store/naive/loader_dtd.cpp' |
207 | --- src/store/naive/loader_dtd.cpp 2013-04-16 21:12:12 +0000 |
208 | +++ src/store/naive/loader_dtd.cpp 2013-04-30 17:01:29 +0000 |
209 | @@ -196,7 +196,9 @@ |
210 | if (theFragmentStream->ctxt == NULL) |
211 | { |
212 | theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( XMLParserInitFailed ) ))); |
213 | - throw 0; // the argument to throw is not used by the catch clause |
214 | + abortload(); |
215 | + thePathStack.clear(); |
216 | + return NULL; |
217 | } |
218 | |
219 | // Apply parser options |
220 | @@ -210,7 +212,9 @@ |
221 | if (input == NULL) |
222 | { |
223 | theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( XMLParserInitFailed ) ))); |
224 | - throw 0; // the argument to throw is not used by the catch clause |
225 | + abortload(); |
226 | + thePathStack.clear(); |
227 | + return NULL; |
228 | } |
229 | |
230 | // Initialize the parser input (only filename and the pointer to the current char) |
231 | @@ -253,7 +257,9 @@ |
232 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLNoOpeningTag ))) : |
233 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLNoOpeningTag ), theDocUri)) |
234 | ); |
235 | - throw 0; // the argument to throw is not used by the catch clause |
236 | + abortload(); |
237 | + thePathStack.clear(); |
238 | + return NULL; |
239 | } |
240 | |
241 | // parse the DOCTYPE declaration, if any |
242 | @@ -281,7 +287,9 @@ |
243 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( ParseFragmentDoctypeNotAllowedHere ))) : |
244 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( ParseFragmentDoctypeNotAllowedHere ), theDocUri)) |
245 | ); |
246 | - throw 0; // the argument to throw is not used by the catch clause |
247 | + abortload(); |
248 | + thePathStack.clear(); |
249 | + return NULL; |
250 | } |
251 | else // theLoadProperties.getErrorOnDoctype() == true |
252 | { |
253 | @@ -289,7 +297,9 @@ |
254 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( ParseFragmentDoctypeNotAllowed ))) : |
255 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( ParseFragmentDoctypeNotAllowed ), theDocUri)) |
256 | ); |
257 | - throw 0; // the argument to throw is not used by the catch clause |
258 | + abortload(); |
259 | + thePathStack.clear(); |
260 | + return NULL; |
261 | } |
262 | } |
263 | } |
264 | @@ -332,7 +342,9 @@ |
265 | } |
266 | |
267 | if ( ! theXQueryDiagnostics->errors().empty()) |
268 | - throw 0; // the argument to throw is not used by the catch clause |
269 | + abortload(); |
270 | + thePathStack.clear(); |
271 | + return NULL; |
272 | } |
273 | |
274 | // this happens when there are tags that have not been closed |
275 | @@ -344,7 +356,9 @@ |
276 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLDocument_2o ))) : |
277 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLDocument_2o ), theDocUri)) |
278 | ); |
279 | - throw 0; |
280 | + abortload(); |
281 | + thePathStack.clear(); |
282 | + return NULL; |
283 | } |
284 | |
285 | // this happens when the input is an empty string |
286 | @@ -355,11 +369,24 @@ |
287 | |
288 | FragmentXmlLoader::endDocument(theFragmentStream->ctxt->userData); // this would not be called otherwise |
289 | } |
290 | + catch( std::exception const &e ) |
291 | + { |
292 | + theXQueryDiagnostics-> |
293 | + add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR, |
294 | + ERROR_PARAMS( e.what() ))); |
295 | + |
296 | + abortload(); |
297 | + thePathStack.clear(); |
298 | + return NULL; |
299 | + } |
300 | catch (...) |
301 | { |
302 | + theXQueryDiagnostics-> |
303 | + add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR)); |
304 | + |
305 | abortload(); |
306 | thePathStack.clear(); |
307 | - return NULL; |
308 | + throw; |
309 | } |
310 | |
311 | // The doc may be well formed, but it may have other kinds of errors, e.g., unresolved ns prefixes. |
312 | @@ -733,6 +760,14 @@ |
313 | ) |
314 | ); |
315 | } |
316 | + catch (std::exception const &e) |
317 | + { |
318 | + theXQueryDiagnostics->add_error( |
319 | + NEW_ZORBA_EXCEPTION( |
320 | + zerr::ZSTR0020_LOADER_IO_ERROR, ERROR_PARAMS( e.what() ) |
321 | + ) |
322 | + ); |
323 | + } |
324 | catch (...) |
325 | { |
326 | theXQueryDiagnostics->add_error( |
327 | @@ -850,8 +885,19 @@ |
328 | return NULL; |
329 | } |
330 | } |
331 | + catch( std::exception const &e ) |
332 | + { |
333 | + theXQueryDiagnostics-> |
334 | + add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR, ERROR_PARAMS( e.what() ))); |
335 | + |
336 | + abortload(); |
337 | + return NULL; |
338 | + } |
339 | catch(...) |
340 | { |
341 | + theXQueryDiagnostics-> |
342 | + add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR)); |
343 | + |
344 | abortload(); |
345 | thePathStack.clear(); |
346 | return NULL; |
347 | @@ -1071,6 +1117,14 @@ |
348 | { |
349 | loader.theXQueryDiagnostics->add_error( e ); |
350 | } |
351 | + catch( std::exception const &e ) |
352 | + { |
353 | + loader.theXQueryDiagnostics->add_error( |
354 | + NEW_ZORBA_EXCEPTION( |
355 | + zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) |
356 | + ) |
357 | + ); |
358 | + } |
359 | catch (...) |
360 | { |
361 | loader.theXQueryDiagnostics->add_error( |
362 | @@ -1153,6 +1207,14 @@ |
363 | { |
364 | loader.theXQueryDiagnostics->add_error( e ); |
365 | } |
366 | + catch( std::exception const &e ) |
367 | + { |
368 | + loader.theXQueryDiagnostics->add_error( |
369 | + NEW_ZORBA_EXCEPTION( |
370 | + zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) |
371 | + ) |
372 | + ); |
373 | + } |
374 | catch (...) |
375 | { |
376 | loader.theXQueryDiagnostics->add_error( |
377 | @@ -1447,6 +1509,14 @@ |
378 | { |
379 | loader.theXQueryDiagnostics->add_error( e ); |
380 | } |
381 | + catch( std::exception const &e ) |
382 | + { |
383 | + loader.theXQueryDiagnostics->add_error( |
384 | + NEW_ZORBA_EXCEPTION( |
385 | + zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) |
386 | + ) |
387 | + ); |
388 | + } |
389 | catch (...) |
390 | { |
391 | loader.theXQueryDiagnostics-> |
392 | @@ -1579,6 +1649,14 @@ |
393 | { |
394 | loader.theXQueryDiagnostics->add_error( e ); |
395 | } |
396 | + catch( std::exception const &e ) |
397 | + { |
398 | + loader.theXQueryDiagnostics->add_error( |
399 | + NEW_ZORBA_EXCEPTION( |
400 | + zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) |
401 | + ) |
402 | + ); |
403 | + } |
404 | catch (...) |
405 | { |
406 | loader.theXQueryDiagnostics->add_error( |
407 | @@ -1630,6 +1708,14 @@ |
408 | { |
409 | loader.theXQueryDiagnostics->add_error( e ); |
410 | } |
411 | + catch( std::exception const &e ) |
412 | + { |
413 | + loader.theXQueryDiagnostics->add_error( |
414 | + NEW_ZORBA_EXCEPTION( |
415 | + zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) |
416 | + ) |
417 | + ); |
418 | + } |
419 | catch (...) |
420 | { |
421 | loader.theXQueryDiagnostics->add_error( |
422 | @@ -1683,6 +1769,14 @@ |
423 | { |
424 | loader.theXQueryDiagnostics->add_error( e ); |
425 | } |
426 | + catch( std::exception const &e ) |
427 | + { |
428 | + loader.theXQueryDiagnostics->add_error( |
429 | + NEW_ZORBA_EXCEPTION( |
430 | + zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) |
431 | + ) |
432 | + ); |
433 | + } |
434 | catch (...) |
435 | { |
436 | loader.theXQueryDiagnostics->add_error( |
437 | @@ -1733,6 +1827,14 @@ |
438 | { |
439 | loader.theXQueryDiagnostics->add_error( e ); |
440 | } |
441 | + catch( std::exception const &e ) |
442 | + { |
443 | + loader.theXQueryDiagnostics->add_error( |
444 | + NEW_ZORBA_EXCEPTION( |
445 | + zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) |
446 | + ) |
447 | + ); |
448 | + } |
449 | catch (...) |
450 | { |
451 | loader.theXQueryDiagnostics->add_error( |
452 | @@ -1776,6 +1878,14 @@ |
453 | { |
454 | loader.theXQueryDiagnostics->add_error( e ); |
455 | } |
456 | + catch( std::exception const &e ) |
457 | + { |
458 | + loader.theXQueryDiagnostics->add_error( |
459 | + NEW_ZORBA_EXCEPTION( |
460 | + zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) |
461 | + ) |
462 | + ); |
463 | + } |
464 | catch (...) |
465 | { |
466 | loader.theXQueryDiagnostics->add_error( |
467 | |
468 | === modified file 'src/store/naive/loader_fast.cpp' |
469 | --- src/store/naive/loader_fast.cpp 2013-04-08 22:59:58 +0000 |
470 | +++ src/store/naive/loader_fast.cpp 2013-04-30 17:01:29 +0000 |
471 | @@ -72,6 +72,25 @@ |
472 | return; \ |
473 | } while (0); |
474 | |
475 | +#define LOADER_TRY try |
476 | + |
477 | +#define LOADER_CATCH \ |
478 | + catch ( ZorbaException const &e ) { \ |
479 | + loader.theXQueryDiagnostics->add_error( e ); \ |
480 | + } \ |
481 | + catch ( std::exception const &e ) { \ |
482 | + loader.theXQueryDiagnostics->add_error( \ |
483 | + NEW_ZORBA_EXCEPTION( \ |
484 | + zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) \ |
485 | + ) \ |
486 | + ); \ |
487 | + } \ |
488 | + catch ( ... ) { \ |
489 | + loader.theXQueryDiagnostics->add_error( \ |
490 | + NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR ) \ |
491 | + ); \ |
492 | + } |
493 | + |
494 | |
495 | /******************************************************************************* |
496 | |
497 | @@ -334,7 +353,8 @@ |
498 | |
499 | return stream.gcount(); |
500 | } |
501 | - catch (std::iostream::failure e) |
502 | + // catch-TODO: should ZorbaException be caught seperately here? |
503 | + catch (std::exception const &e) |
504 | { |
505 | theXQueryDiagnostics->add_error( |
506 | NEW_ZORBA_EXCEPTION( |
507 | @@ -445,7 +465,7 @@ |
508 | if (numChars < 0) |
509 | { |
510 | theXQueryDiagnostics-> |
511 | - add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR)); |
512 | + add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR)); |
513 | |
514 | abortload(); |
515 | return NULL; |
516 | @@ -453,10 +473,22 @@ |
517 | |
518 | xmlParseChunk(ctxt, theBuffer, 0, 1); |
519 | } |
520 | + catch( std::exception const &e ) |
521 | + { |
522 | + theXQueryDiagnostics-> |
523 | + add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR, |
524 | + ERROR_PARAMS( e.what() ))); |
525 | + |
526 | + abortload(); |
527 | + return NULL; |
528 | + } |
529 | catch(...) |
530 | { |
531 | + theXQueryDiagnostics-> |
532 | + add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR)); |
533 | + |
534 | abortload(); |
535 | - return NULL; |
536 | + throw; |
537 | } |
538 | |
539 | bool ok = ctxt->wellFormed != 0; |
540 | @@ -505,7 +537,7 @@ |
541 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>(ctx)); |
542 | ZORBA_LOADER_CHECK_ERROR(loader); |
543 | |
544 | - try |
545 | + LOADER_TRY |
546 | { |
547 | DocumentNode* docNode = GET_STORE().getNodeFactory().createDocumentNode(); |
548 | |
549 | @@ -530,15 +562,7 @@ |
550 | |
551 | LOADER_TRACE1("Start Doc Node = " << docNode); |
552 | } |
553 | - catch (ZorbaException const& e) |
554 | - { |
555 | - loader.theXQueryDiagnostics->add_error( e ); |
556 | - } |
557 | - catch (...) |
558 | - { |
559 | - loader.theXQueryDiagnostics-> |
560 | - add_error(NEW_ZORBA_EXCEPTION(zerr::ZXQP0003_INTERNAL_ERROR)); |
561 | - } |
562 | + LOADER_CATCH |
563 | } |
564 | |
565 | |
566 | @@ -561,7 +585,7 @@ |
567 | DocumentNode* docNode; |
568 | XmlNode* currChild; |
569 | |
570 | - try |
571 | + LOADER_TRY |
572 | { |
573 | // This check is required because it is possible (in case of mal-formed doc) |
574 | // that libXml calls endDocument() without having called startDocument(). |
575 | @@ -615,16 +639,7 @@ |
576 | |
577 | LOADER_TRACE2("End Doc Node = " << docNode); |
578 | } |
579 | - catch (ZorbaException const& e) |
580 | - { |
581 | - loader.theXQueryDiagnostics->add_error( e ); |
582 | - } |
583 | - catch (...) |
584 | - { |
585 | - loader.theXQueryDiagnostics->add_error( |
586 | - NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR ) |
587 | - ); |
588 | - } |
589 | + LOADER_CATCH |
590 | } |
591 | |
592 | |
593 | @@ -665,7 +680,7 @@ |
594 | zorba::Stack<PathStepInfo>& pathStack = loader.thePathStack; |
595 | zstring baseUri; |
596 | |
597 | - try |
598 | + LOADER_TRY |
599 | { |
600 | csize numAttributes = static_cast<csize>(numAttrs); |
601 | csize numBindings = static_cast<csize>(numNamespaces); |
602 | @@ -856,15 +871,7 @@ |
603 | nodeStack.push(NULL); |
604 | pathStack.push(PathStepInfo(elemNode, baseUri)); |
605 | } |
606 | - catch (ZorbaException const& e) |
607 | - { |
608 | - loader.theXQueryDiagnostics->add_error( e ); |
609 | - } |
610 | - catch (...) |
611 | - { |
612 | - loader.theXQueryDiagnostics-> |
613 | - add_error(NEW_ZORBA_EXCEPTION(zerr::ZXQP0003_INTERNAL_ERROR)); |
614 | - } |
615 | + LOADER_CATCH |
616 | } |
617 | |
618 | |
619 | @@ -897,7 +904,7 @@ |
620 | XmlNode* prevChild = NULL; |
621 | XmlNode* currChild; |
622 | |
623 | - try |
624 | + LOADER_TRY |
625 | { |
626 | // Find the position of the 1st child of this element node in the node stack |
627 | firstChildPos = stackSize - 1; |
628 | @@ -984,16 +991,7 @@ |
629 | } |
630 | #endif |
631 | } |
632 | - catch (ZorbaException const& e) |
633 | - { |
634 | - loader.theXQueryDiagnostics->add_error( e ); |
635 | - } |
636 | - catch (...) |
637 | - { |
638 | - loader.theXQueryDiagnostics->add_error( |
639 | - NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR ) |
640 | - ); |
641 | - } |
642 | + LOADER_CATCH |
643 | } |
644 | |
645 | |
646 | @@ -1009,7 +1007,7 @@ |
647 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>( ctx )); |
648 | ZORBA_LOADER_CHECK_ERROR(loader); |
649 | |
650 | - try |
651 | + LOADER_TRY |
652 | { |
653 | const char* charp = reinterpret_cast<const char*>(ch); |
654 | zstring content(charp, len); |
655 | @@ -1035,16 +1033,7 @@ |
656 | LOADER_TRACE2(lSs.str()); |
657 | #endif |
658 | } |
659 | - catch (ZorbaException const& e) |
660 | - { |
661 | - loader.theXQueryDiagnostics->add_error( e ); |
662 | - } |
663 | - catch (...) |
664 | - { |
665 | - loader.theXQueryDiagnostics->add_error( |
666 | - NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR ) |
667 | - ); |
668 | - } |
669 | + LOADER_CATCH |
670 | } |
671 | |
672 | |
673 | @@ -1060,7 +1049,7 @@ |
674 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>( ctx )); |
675 | ZORBA_LOADER_CHECK_ERROR(loader); |
676 | |
677 | - try |
678 | + LOADER_TRY |
679 | { |
680 | // If a doc contains an element like <cdata><![CDATA[ <> ]]></cdata>, |
681 | // libxml returns the string " <> ". |
682 | @@ -1088,16 +1077,7 @@ |
683 | LOADER_TRACE2(lSs.str()); |
684 | #endif |
685 | } |
686 | - catch (ZorbaException const& e) |
687 | - { |
688 | - loader.theXQueryDiagnostics->add_error( e ); |
689 | - } |
690 | - catch (...) |
691 | - { |
692 | - loader.theXQueryDiagnostics->add_error( |
693 | - NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR ) |
694 | - ); |
695 | - } |
696 | + LOADER_CATCH |
697 | } |
698 | |
699 | |
700 | @@ -1115,7 +1095,7 @@ |
701 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>( ctx )); |
702 | ZORBA_LOADER_CHECK_ERROR(loader); |
703 | |
704 | - try |
705 | + LOADER_TRY |
706 | { |
707 | // bugfix: handling PIs with no data (i.e. data being NULL) |
708 | zstring content; |
709 | @@ -1138,16 +1118,7 @@ |
710 | << targetp << std::endl << " ordpath = " |
711 | << piNode->getOrdPath().show() << std::endl); |
712 | } |
713 | - catch (ZorbaException const& e) |
714 | - { |
715 | - loader.theXQueryDiagnostics->add_error( e ); |
716 | - } |
717 | - catch (...) |
718 | - { |
719 | - loader.theXQueryDiagnostics->add_error( |
720 | - NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR ) |
721 | - ); |
722 | - } |
723 | + LOADER_CATCH |
724 | } |
725 | |
726 | |
727 | @@ -1162,7 +1133,7 @@ |
728 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>( ctx )); |
729 | ZORBA_LOADER_CHECK_ERROR(loader); |
730 | |
731 | - try |
732 | + LOADER_TRY |
733 | { |
734 | const char* charp = reinterpret_cast<const char*>(ch); |
735 | zstring content; |
736 | @@ -1183,16 +1154,7 @@ |
737 | << charp << std::endl << " ordpath = " |
738 | << commentNode->getOrdPath().show() << std::endl); |
739 | } |
740 | - catch (ZorbaException const& e) |
741 | - { |
742 | - loader.theXQueryDiagnostics->add_error( e ); |
743 | - } |
744 | - catch (...) |
745 | - { |
746 | - loader.theXQueryDiagnostics->add_error( |
747 | - NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR ) |
748 | - ); |
749 | - } |
750 | + LOADER_CATCH |
751 | } |
752 | |
753 | |
754 | |
755 | === modified file 'src/store/naive/node_items.cpp' |
756 | --- src/store/naive/node_items.cpp 2013-04-17 12:37:36 +0000 |
757 | +++ src/store/naive/node_items.cpp 2013-04-30 17:01:29 +0000 |
758 | @@ -763,26 +763,19 @@ |
759 | if (theParent == NULL) |
760 | return false; |
761 | |
762 | - try |
763 | + if (getNodeKind() == store::StoreConsts::attributeNode) |
764 | { |
765 | - if (getNodeKind() == store::StoreConsts::attributeNode) |
766 | - { |
767 | - csize numAttrs = theParent->numAttrs(); |
768 | - pos = theParent->removeAttr(this); |
769 | - ZORBA_FATAL(pos <= numAttrs, ""); |
770 | - return (pos < numAttrs); |
771 | - } |
772 | - else |
773 | - { |
774 | - csize numChildren = theParent->numChildren(); |
775 | - pos = theParent->removeChild(this); |
776 | - ZORBA_FATAL(pos <= numChildren, ""); |
777 | - return (pos < numChildren); |
778 | - } |
779 | + csize numAttrs = theParent->numAttrs(); |
780 | + pos = theParent->removeAttr(this); |
781 | + ZORBA_FATAL(pos <= numAttrs, ""); |
782 | + return (pos < numAttrs); |
783 | } |
784 | - catch(...) |
785 | + else |
786 | { |
787 | - ZORBA_FATAL(false, "Unexpected exception"); |
788 | + csize numChildren = theParent->numChildren(); |
789 | + pos = theParent->removeChild(this); |
790 | + ZORBA_FATAL(pos <= numChildren, ""); |
791 | + return (pos < numChildren); |
792 | } |
793 | } |
794 | |
795 | @@ -857,17 +850,10 @@ |
796 | ********************************************************************************/ |
797 | void XmlNode::destroy(bool removeType) |
798 | { |
799 | - try |
800 | - { |
801 | - csize pos; |
802 | - disconnect(pos); |
803 | + csize pos; |
804 | + disconnect(pos); |
805 | |
806 | - destroyInternal(removeType); |
807 | - } |
808 | - catch (...) |
809 | - { |
810 | - ZORBA_FATAL(false, "Unexpected exception"); |
811 | - } |
812 | + destroyInternal(removeType); |
813 | } |
814 | |
815 | |
816 | |
817 | === modified file 'src/store/naive/node_updates.cpp' |
818 | --- src/store/naive/node_updates.cpp 2013-02-07 17:24:36 +0000 |
819 | +++ src/store/naive/node_updates.cpp 2013-04-30 17:01:29 +0000 |
820 | @@ -328,200 +328,193 @@ |
821 | ********************************************************************************/ |
822 | void XmlNode::detach() |
823 | { |
824 | - try |
825 | - { |
826 | - ZORBA_ASSERT(theParent != NULL); |
827 | - |
828 | - ulong refcount = 0; |
829 | - |
830 | - XmlTree* oldTree = getTree(); |
831 | - XmlTree* newTree = GET_STORE().getNodeFactory().createXmlTree(); |
832 | - newTree->setRoot(this); |
833 | - |
834 | - if (oldTree->getRoot() == this) |
835 | - oldTree->setRoot(NULL); |
836 | - |
837 | - store::StoreConsts::NodeKind nodeKind = getNodeKind(); |
838 | - |
839 | - // ???? What we do here is not really thread-safe. For example, consider the |
840 | - // following scenario: Let T1 be "this" thread and T2 be another thread that |
841 | - // has an rchandle, rc2, on N. Right after T1 acquires the rclock on the old |
842 | - // tree, T2 tries to make a copy of rc2; as a result, T2 will block on the |
843 | - // old tree rclock. When T1 releases the old rclock, the old tree may be |
844 | - // destroyed already, so T2 will be trying to acquire a deallocated lock. |
845 | - // Even if the old tree is there, T2 will increment the ref counter of the |
846 | - // new tree while holding the lock of the old tree. In fact, the setTree() |
847 | - // method istself is not safe (if T2 tries to copy rc2 after T1 has returned |
848 | - // from setTree(), then things are ok). |
849 | - SYNC_CODE(oldTree->getRCLock()->acquire()); |
850 | - SYNC_CODE(newTree->getRCLock()->acquire()); |
851 | - |
852 | - refcount += theRefCount; |
853 | - |
854 | - switch (nodeKind) |
855 | - { |
856 | - case store::StoreConsts::attributeNode: |
857 | - { |
858 | - setTree(newTree); |
859 | - theParent->removeAttr(this); |
860 | - theParent = NULL; |
861 | - break; |
862 | - } |
863 | - case store::StoreConsts::piNode: |
864 | - case store::StoreConsts::commentNode: |
865 | - { |
866 | - setTree(newTree); |
867 | - theParent->removeChild(this); |
868 | - theParent = NULL; |
869 | - break; |
870 | - } |
871 | - case store::StoreConsts::textNode: |
872 | - { |
873 | - setTree(newTree); |
874 | - |
875 | - reinterpret_cast<TextNode*>(this)->revertToTextContent(); |
876 | - |
877 | - theParent->removeChild(this); |
878 | - theParent = NULL; |
879 | - break; |
880 | - } |
881 | - case store::StoreConsts::elementNode: |
882 | - { |
883 | - ElementNode* rootNode = reinterpret_cast<ElementNode*>(this); |
884 | - |
885 | - // If the baseUri property of N is inherited from its ancestors, make a |
886 | - // local copy of it, before disconnecting N from its parent. |
887 | - bool localBaseUri; |
888 | - zstring baseUri; |
889 | - getBaseURIInternal(baseUri, localBaseUri); |
890 | - if (!localBaseUri && !baseUri.empty()) |
891 | - { |
892 | - zstring dummyUri; |
893 | - rootNode->addBaseUriProperty(baseUri, dummyUri); |
894 | - } |
895 | - |
896 | - // For each node in the nodes stack, we must save the nsCtx of its |
897 | - // parent node in the parentNsCtxs stack, because the nsCtx of the |
898 | - // parent may change during the while loop below. |
899 | - std::stack<XmlNode*> nodes; |
900 | - std::stack<NsBindingsContext*> parentNsCtxs; |
901 | - |
902 | - nodes.push(this); |
903 | - parentNsCtxs.push(rootNode->theParent->getNsContext()); |
904 | - |
905 | - while (!nodes.empty()) |
906 | - { |
907 | - XmlNode* node = nodes.top(); |
908 | - nodes.pop(); |
909 | - |
910 | - if (node->getNodeKind() == store::StoreConsts::elementNode) |
911 | + ZORBA_ASSERT(theParent != NULL); |
912 | + |
913 | + ulong refcount = 0; |
914 | + |
915 | + XmlTree* oldTree = getTree(); |
916 | + XmlTree* newTree = GET_STORE().getNodeFactory().createXmlTree(); |
917 | + newTree->setRoot(this); |
918 | + |
919 | + if (oldTree->getRoot() == this) |
920 | + oldTree->setRoot(NULL); |
921 | + |
922 | + store::StoreConsts::NodeKind nodeKind = getNodeKind(); |
923 | + |
924 | + // ???? What we do here is not really thread-safe. For example, consider the |
925 | + // following scenario: Let T1 be "this" thread and T2 be another thread that |
926 | + // has an rchandle, rc2, on N. Right after T1 acquires the rclock on the old |
927 | + // tree, T2 tries to make a copy of rc2; as a result, T2 will block on the |
928 | + // old tree rclock. When T1 releases the old rclock, the old tree may be |
929 | + // destroyed already, so T2 will be trying to acquire a deallocated lock. |
930 | + // Even if the old tree is there, T2 will increment the ref counter of the |
931 | + // new tree while holding the lock of the old tree. In fact, the setTree() |
932 | + // method istself is not safe (if T2 tries to copy rc2 after T1 has returned |
933 | + // from setTree(), then things are ok). |
934 | + SYNC_CODE(oldTree->getRCLock()->acquire()); |
935 | + SYNC_CODE(newTree->getRCLock()->acquire()); |
936 | + |
937 | + refcount += theRefCount; |
938 | + |
939 | + switch (nodeKind) |
940 | + { |
941 | + case store::StoreConsts::attributeNode: |
942 | + { |
943 | + setTree(newTree); |
944 | + theParent->removeAttr(this); |
945 | + theParent = NULL; |
946 | + break; |
947 | + } |
948 | + case store::StoreConsts::piNode: |
949 | + case store::StoreConsts::commentNode: |
950 | + { |
951 | + setTree(newTree); |
952 | + theParent->removeChild(this); |
953 | + theParent = NULL; |
954 | + break; |
955 | + } |
956 | + case store::StoreConsts::textNode: |
957 | + { |
958 | + setTree(newTree); |
959 | + |
960 | + reinterpret_cast<TextNode*>(this)->revertToTextContent(); |
961 | + |
962 | + theParent->removeChild(this); |
963 | + theParent = NULL; |
964 | + break; |
965 | + } |
966 | + case store::StoreConsts::elementNode: |
967 | + { |
968 | + ElementNode* rootNode = reinterpret_cast<ElementNode*>(this); |
969 | + |
970 | + // If the baseUri property of N is inherited from its ancestors, make a |
971 | + // local copy of it, before disconnecting N from its parent. |
972 | + bool localBaseUri; |
973 | + zstring baseUri; |
974 | + getBaseURIInternal(baseUri, localBaseUri); |
975 | + if (!localBaseUri && !baseUri.empty()) |
976 | + { |
977 | + zstring dummyUri; |
978 | + rootNode->addBaseUriProperty(baseUri, dummyUri); |
979 | + } |
980 | + |
981 | + // For each node in the nodes stack, we must save the nsCtx of its |
982 | + // parent node in the parentNsCtxs stack, because the nsCtx of the |
983 | + // parent may change during the while loop below. |
984 | + std::stack<XmlNode*> nodes; |
985 | + std::stack<NsBindingsContext*> parentNsCtxs; |
986 | + |
987 | + nodes.push(this); |
988 | + parentNsCtxs.push(rootNode->theParent->getNsContext()); |
989 | + |
990 | + while (!nodes.empty()) |
991 | + { |
992 | + XmlNode* node = nodes.top(); |
993 | + nodes.pop(); |
994 | + |
995 | + if (node->getNodeKind() == store::StoreConsts::elementNode) |
996 | + { |
997 | + ElementNode* elemNode = reinterpret_cast<ElementNode*>(node); |
998 | + |
999 | + node->setTree(newTree); |
1000 | + |
1001 | + // Preserve the namespace bindings of the current node |
1002 | + NsBindingsContext* nsContext = elemNode->getNsContext(); |
1003 | + NsBindingsContext* parentNsContext = parentNsCtxs.top(); |
1004 | + parentNsCtxs.pop(); |
1005 | + |
1006 | + // If the current node is N, or a node in NT that does not inherit ns |
1007 | + // bindings directly from its parent (but may inherit from some other |
1008 | + // ancestor). |
1009 | + if (elemNode == rootNode || |
1010 | + nsContext == NULL || |
1011 | + (elemNode->haveLocalBindings() && |
1012 | + nsContext->getParent() != parentNsContext) || |
1013 | + nsContext != parentNsContext) |
1014 | { |
1015 | - ElementNode* elemNode = reinterpret_cast<ElementNode*>(node); |
1016 | - |
1017 | - node->setTree(newTree); |
1018 | - |
1019 | - // Preserve the namespace bindings of the current node |
1020 | - NsBindingsContext* nsContext = elemNode->getNsContext(); |
1021 | - NsBindingsContext* parentNsContext = parentNsCtxs.top(); |
1022 | - parentNsCtxs.pop(); |
1023 | - |
1024 | - // If the current node is N, or a node in NT that does not inherit ns |
1025 | - // bindings directly from its parent (but may inherit from some other |
1026 | - // ancestor). |
1027 | - if (elemNode == rootNode || |
1028 | - nsContext == NULL || |
1029 | - (elemNode->haveLocalBindings() && |
1030 | - nsContext->getParent() != parentNsContext) || |
1031 | - nsContext != parentNsContext) |
1032 | + if (nsContext != NULL) |
1033 | { |
1034 | - if (nsContext != NULL) |
1035 | + std::auto_ptr<NsBindingsContext> ctx(new NsBindingsContext()); |
1036 | + elemNode->getNamespaceBindings(ctx->getBindings()); |
1037 | + |
1038 | + if (!ctx->empty()) |
1039 | { |
1040 | - std::auto_ptr<NsBindingsContext> ctx(new NsBindingsContext()); |
1041 | - elemNode->getNamespaceBindings(ctx->getBindings()); |
1042 | - |
1043 | - if (!ctx->empty()) |
1044 | - { |
1045 | - elemNode->theNsContext = ctx.release(); |
1046 | - elemNode->theFlags |= HaveLocalBindings; |
1047 | - } |
1048 | + elemNode->theNsContext = ctx.release(); |
1049 | + elemNode->theFlags |= HaveLocalBindings; |
1050 | } |
1051 | } |
1052 | - |
1053 | - // Else the current node is not N and it inherits ns bindings directly |
1054 | - // from its parent. |
1055 | - else |
1056 | - { |
1057 | - elemNode->setNsContext(elemNode->theParent->getNsContext()); |
1058 | - } |
1059 | - |
1060 | - // Detach the attributes of the current node |
1061 | - InternalNode::iterator ite = elemNode->attrsBegin(); |
1062 | - InternalNode::iterator end = elemNode->attrsEnd(); |
1063 | - |
1064 | - for (; ite != end; ++ite) |
1065 | - { |
1066 | - AttributeNode* attrNode = static_cast<AttributeNode*>(*ite); |
1067 | - refcount += attrNode->theRefCount; |
1068 | - attrNode->setTree(newTree); |
1069 | - } |
1070 | - |
1071 | - // Detach the children of the current node |
1072 | - ite = elemNode->childrenBegin(); |
1073 | - end = elemNode->childrenEnd(); |
1074 | - |
1075 | - for (; ite != end; ++ite) |
1076 | - { |
1077 | - XmlNode* child = (*ite); |
1078 | - refcount += child->theRefCount; |
1079 | - |
1080 | - nodes.push(child); |
1081 | - |
1082 | - if (child->getNodeKind() == store::StoreConsts::elementNode) |
1083 | - parentNsCtxs.push(nsContext); |
1084 | - } |
1085 | } |
1086 | + |
1087 | + // Else the current node is not N and it inherits ns bindings directly |
1088 | + // from its parent. |
1089 | else |
1090 | { |
1091 | - node->setTree(newTree); |
1092 | - } |
1093 | - } // done traversing tree |
1094 | - |
1095 | - theParent->removeChild(this); |
1096 | - theParent = NULL; |
1097 | - |
1098 | - break; |
1099 | - } |
1100 | - default: |
1101 | - { |
1102 | - ZORBA_ASSERT(false); |
1103 | - } |
1104 | - } |
1105 | - |
1106 | - newTree->getRefCount() += refcount; |
1107 | - if (newTree->getRefCount() == 0) |
1108 | - { |
1109 | - SYNC_CODE(newTree->getRCLock()->release()); |
1110 | - newTree->free(); |
1111 | - } |
1112 | - else |
1113 | - { |
1114 | - SYNC_CODE(newTree->getRCLock()->release()); |
1115 | - } |
1116 | - |
1117 | - oldTree->getRefCount() -= refcount; |
1118 | - if (oldTree->getRefCount() == 0) |
1119 | - { |
1120 | - SYNC_CODE(oldTree->getRCLock()->release()); |
1121 | - oldTree->free(); |
1122 | - } |
1123 | - else |
1124 | - { |
1125 | - SYNC_CODE(oldTree->getRCLock()->release()); |
1126 | - } |
1127 | - } |
1128 | - catch(...) |
1129 | - { |
1130 | - ZORBA_FATAL(0, "Unexpected exception"); |
1131 | + elemNode->setNsContext(elemNode->theParent->getNsContext()); |
1132 | + } |
1133 | + |
1134 | + // Detach the attributes of the current node |
1135 | + InternalNode::iterator ite = elemNode->attrsBegin(); |
1136 | + InternalNode::iterator end = elemNode->attrsEnd(); |
1137 | + |
1138 | + for (; ite != end; ++ite) |
1139 | + { |
1140 | + AttributeNode* attrNode = static_cast<AttributeNode*>(*ite); |
1141 | + refcount += attrNode->theRefCount; |
1142 | + attrNode->setTree(newTree); |
1143 | + } |
1144 | + |
1145 | + // Detach the children of the current node |
1146 | + ite = elemNode->childrenBegin(); |
1147 | + end = elemNode->childrenEnd(); |
1148 | + |
1149 | + for (; ite != end; ++ite) |
1150 | + { |
1151 | + XmlNode* child = (*ite); |
1152 | + refcount += child->theRefCount; |
1153 | + |
1154 | + nodes.push(child); |
1155 | + |
1156 | + if (child->getNodeKind() == store::StoreConsts::elementNode) |
1157 | + parentNsCtxs.push(nsContext); |
1158 | + } |
1159 | + } |
1160 | + else |
1161 | + { |
1162 | + node->setTree(newTree); |
1163 | + } |
1164 | + } // done traversing tree |
1165 | + |
1166 | + theParent->removeChild(this); |
1167 | + theParent = NULL; |
1168 | + |
1169 | + break; |
1170 | + } |
1171 | + default: |
1172 | + { |
1173 | + ZORBA_ASSERT(false); |
1174 | + } |
1175 | + } |
1176 | + |
1177 | + newTree->getRefCount() += refcount; |
1178 | + if (newTree->getRefCount() == 0) |
1179 | + { |
1180 | + SYNC_CODE(newTree->getRCLock()->release()); |
1181 | + newTree->free(); |
1182 | + } |
1183 | + else |
1184 | + { |
1185 | + SYNC_CODE(newTree->getRCLock()->release()); |
1186 | + } |
1187 | + |
1188 | + oldTree->getRefCount() -= refcount; |
1189 | + if (oldTree->getRefCount() == 0) |
1190 | + { |
1191 | + SYNC_CODE(oldTree->getRCLock()->release()); |
1192 | + oldTree->free(); |
1193 | + } |
1194 | + else |
1195 | + { |
1196 | + SYNC_CODE(oldTree->getRCLock()->release()); |
1197 | } |
1198 | } |
1199 | |
1200 | |
1201 | === modified file 'src/store/naive/pul_primitives.cpp' |
1202 | --- src/store/naive/pul_primitives.cpp 2013-02-26 04:12:43 +0000 |
1203 | +++ src/store/naive/pul_primitives.cpp 2013-04-30 17:01:29 +0000 |
1204 | @@ -744,9 +744,13 @@ |
1205 | { |
1206 | theRevalidationPul->applyUpdates(false); |
1207 | } |
1208 | + catch (std::exception const &e) |
1209 | + { |
1210 | + ZORBA_FATAL(false, "Error during the in-place validation: " << e.what()); |
1211 | + } |
1212 | catch (...) |
1213 | { |
1214 | - ZORBA_FATAL(0, "Error during the in-place validation"); |
1215 | + ZORBA_FATAL(false, "Error during the in-place validation"); |
1216 | } |
1217 | |
1218 | theIsApplied = true; |
1219 | |
1220 | === modified file 'src/store/naive/store.cpp' |
1221 | --- src/store/naive/store.cpp 2013-03-20 18:39:54 +0000 |
1222 | +++ src/store/naive/store.cpp 2013-04-30 17:01:29 +0000 |
1223 | @@ -575,9 +575,7 @@ |
1224 | } |
1225 | catch(...) |
1226 | { |
1227 | - if (key != NULL) |
1228 | - delete key; |
1229 | - |
1230 | + delete key; |
1231 | sourceIter->close(); |
1232 | throw; |
1233 | } |
1234 | @@ -1051,6 +1049,7 @@ |
1235 | catch(...) |
1236 | { |
1237 | delete stream; |
1238 | + // catch-TODO: "throw;" here? |
1239 | } |
1240 | return docitem; |
1241 | } |
1242 | |
1243 | === modified file 'src/types/schema/schema.cpp' |
1244 | --- src/types/schema/schema.cpp 2013-04-16 21:12:12 +0000 |
1245 | +++ src/types/schema/schema.cpp 2013-04-30 17:01:29 +0000 |
1246 | @@ -1785,18 +1785,6 @@ |
1247 | targetType->toSchemaString(), |
1248 | msg)); |
1249 | } |
1250 | - catch(const OutOfMemoryException&) |
1251 | - { |
1252 | - throw; |
1253 | - } |
1254 | - catch (const ZorbaException&) |
1255 | - { |
1256 | - throw; |
1257 | - } |
1258 | - catch (...) |
1259 | - { |
1260 | - throw; |
1261 | - } |
1262 | #endif //ZORBA_NO_XMLSCHEMA |
1263 | |
1264 | // find the non user defined base type |
1265 | @@ -2093,15 +2081,9 @@ |
1266 | BinMemOutputStream binmemoutputstream; |
1267 | zstring binstr; |
1268 | |
1269 | - try |
1270 | - { |
1271 | - theGrammarPool->serializeGrammars(&binmemoutputstream); |
1272 | - binstr.assign((char*)binmemoutputstream.getRawBuffer(), |
1273 | - static_cast<zstring::size_type>(binmemoutputstream.getSize()) ); |
1274 | - } |
1275 | - catch (...) |
1276 | - { |
1277 | - } |
1278 | + theGrammarPool->serializeGrammars(&binmemoutputstream); |
1279 | + binstr.assign((char*)binmemoutputstream.getRawBuffer(), |
1280 | + static_cast<zstring::size_type>(binmemoutputstream.getSize()) ); |
1281 | |
1282 | ar & binstr; |
1283 | } |
Validation queue starting for merge proposal. zorbatest. lambda. nu:8080/ remotequeue/ bug-1103819- 2013-02- 09T08-51- 07.388Z/ log.html
Log at: http://