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: mp+146312@code.launchpad.net |
Commit message
Reworked some catch clauses.
Description of the change
Reworked some catch clauses.
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/
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for merge proposal.
Log at: http://
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/
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for merge proposal.
Log at: http://
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/
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
Progress dashboard at http://
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://
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 | 80 | namespace zorba | 80 | namespace zorba |
6 | 81 | { | 81 | { |
7 | 82 | 82 | ||
8 | 83 | #define QUERY_TRY try | ||
9 | 83 | 84 | ||
10 | 84 | #define QUERY_CATCH \ | 85 | #define QUERY_CATCH \ |
11 | 85 | catch (ZorbaException const& e) \ | 86 | catch (ZorbaException const& e) \ |
12 | @@ -942,7 +943,7 @@ | |||
13 | 942 | { | 943 | { |
14 | 943 | SYNC_CODE(AutoMutex lock(&theMutex);) | 944 | SYNC_CODE(AutoMutex lock(&theMutex);) |
15 | 944 | 945 | ||
17 | 945 | try | 946 | QUERY_TRY |
18 | 946 | { | 947 | { |
19 | 947 | checkNotClosed(); | 948 | checkNotClosed(); |
20 | 948 | checkCompiled(); | 949 | checkCompiled(); |
21 | @@ -965,22 +966,7 @@ | |||
22 | 965 | 966 | ||
23 | 966 | return true; | 967 | return true; |
24 | 967 | } | 968 | } |
41 | 968 | catch (ZorbaException const& e) | 969 | QUERY_CATCH |
26 | 969 | { | ||
27 | 970 | ZorbaImpl::notifyError(theDiagnosticHandler, e); | ||
28 | 971 | } | ||
29 | 972 | catch (FlowCtlException const&) | ||
30 | 973 | { | ||
31 | 974 | ZorbaImpl::notifyError(theDiagnosticHandler, "User interrupt"); | ||
32 | 975 | } | ||
33 | 976 | catch (std::exception const& e) | ||
34 | 977 | { | ||
35 | 978 | ZorbaImpl::notifyError(theDiagnosticHandler, e.what()); | ||
36 | 979 | } | ||
37 | 980 | catch (...) | ||
38 | 981 | { | ||
39 | 982 | ZorbaImpl::notifyError(theDiagnosticHandler); | ||
40 | 983 | } | ||
42 | 984 | 970 | ||
43 | 985 | return false; | 971 | return false; |
44 | 986 | } | 972 | } |
45 | 987 | 973 | ||
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 | 271 | CDynamicContext::free(XQC_DynamicContext* context) | 271 | CDynamicContext::free(XQC_DynamicContext* context) |
51 | 272 | { | 272 | { |
52 | 273 | try { | 273 | try { |
57 | 274 | CDynamicContext* me = CDynamicContext::get(context); | 274 | delete CDynamicContext::get(context); |
54 | 275 | delete me; | ||
55 | 276 | } catch (ZorbaException const&) { | ||
56 | 277 | assert(false); | ||
58 | 278 | } catch (...) { | 275 | } catch (...) { |
59 | 279 | assert(false); | 276 | assert(false); |
60 | 280 | } | 277 | } |
61 | 281 | 278 | ||
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 | 227 | CExpression::free(XQC_Expression* expr) | 227 | CExpression::free(XQC_Expression* expr) |
67 | 228 | { | 228 | { |
68 | 229 | try { | 229 | try { |
73 | 230 | CExpression* me = CExpression::get(expr); | 230 | delete CExpression::get(expr); |
70 | 231 | delete me; | ||
71 | 232 | } catch (ZorbaException const&) { | ||
72 | 233 | assert(false); | ||
74 | 234 | } catch (...) { | 231 | } catch (...) { |
75 | 235 | assert(false); | 232 | assert(false); |
76 | 236 | } | 233 | } |
77 | 237 | 234 | ||
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 | 507 | CImplementation::free(XQC_Implementation* impl) | 507 | CImplementation::free(XQC_Implementation* impl) |
83 | 508 | { | 508 | { |
84 | 509 | try { | 509 | try { |
89 | 510 | CImplementation* me = CImplementation::get(impl); | 510 | delete CImplementation::get(impl); |
86 | 511 | delete me; | ||
87 | 512 | } catch (ZorbaException const&) { | ||
88 | 513 | assert(false); | ||
90 | 514 | } catch (...) { | 511 | } catch (...) { |
91 | 515 | assert(false); | 512 | assert(false); |
92 | 516 | } | 513 | } |
93 | 517 | 514 | ||
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 | 492 | CSequence::free(XQC_Sequence* seq) | 492 | CSequence::free(XQC_Sequence* seq) |
99 | 493 | { | 493 | { |
100 | 494 | try { | 494 | try { |
105 | 495 | CSequence* me = CSequence::get(seq); | 495 | delete CSequence::get(seq); |
102 | 496 | delete me; | ||
103 | 497 | } catch (ZorbaException const&) { | ||
104 | 498 | assert(false); | ||
106 | 499 | } catch (...) { | 496 | } catch (...) { |
107 | 500 | assert(false); | 497 | assert(false); |
108 | 501 | } | 498 | } |
109 | 502 | 499 | ||
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 | 666 | CStaticContext::free(XQC_StaticContext* context) | 666 | CStaticContext::free(XQC_StaticContext* context) |
115 | 667 | { | 667 | { |
116 | 668 | try { | 668 | try { |
121 | 669 | CStaticContext* me = CStaticContext::get(context); | 669 | delete CStaticContext::get(context); |
118 | 670 | delete me; | ||
119 | 671 | } catch (ZorbaException const&) { | ||
120 | 672 | assert(false); | ||
122 | 673 | } catch (...) { | 670 | } catch (...) { |
123 | 674 | assert(false); | 671 | assert(false); |
124 | 675 | } | 672 | } |
125 | 676 | 673 | ||
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 | 21 | #include "util/uri_util.h" | 21 | #include "util/uri_util.h" |
131 | 22 | #include "util/http_util.h" | 22 | #include "util/http_util.h" |
132 | 23 | #include "util/fs_util.h" | 23 | #include "util/fs_util.h" |
133 | 24 | #include "util/string_util.h" | ||
134 | 24 | #include "store/api/store.h" | 25 | #include "store/api/store.h" |
135 | 25 | #include "store/api/item_factory.h" | 26 | #include "store/api/item_factory.h" |
136 | 26 | #include "store/api/collection.h" | 27 | #include "store/api/collection.h" |
137 | @@ -93,6 +94,11 @@ | |||
138 | 93 | new StreamResource(&(lStream->getStream()), lStream->getStreamReleaser()); | 94 | new StreamResource(&(lStream->getStream()), lStream->getStreamReleaser()); |
139 | 94 | lStream->setStreamReleaser(nullptr); | 95 | lStream->setStreamReleaser(nullptr); |
140 | 95 | return lResource; | 96 | return lResource; |
141 | 97 | } catch (std::exception const &e) { | ||
142 | 98 | std::string const msg( | ||
143 | 99 | BUILD_STRING( "Could not create stream resource: ", e.what() ) | ||
144 | 100 | ); | ||
145 | 101 | throw os_error::exception( "", aUrl.c_str(), msg.c_str() ); | ||
146 | 96 | } catch (...) { | 102 | } catch (...) { |
147 | 97 | throw os_error::exception("", aUrl.c_str(), "Could not create stream resource"); | 103 | throw os_error::exception("", aUrl.c_str(), "Could not create stream resource"); |
148 | 98 | } | 104 | } |
149 | 99 | 105 | ||
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 | 205 | if (lCommons->canBreak() && (lCommons->mustBreak(lCause) || | 205 | if (lCommons->canBreak() && (lCommons->mustBreak(lCause) || |
155 | 206 | lCommons->hasToBreakAt(loc) || lCommons->hasToBreakAt(this))) | 206 | lCommons->hasToBreakAt(loc) || lCommons->hasToBreakAt(this))) |
156 | 207 | { | 207 | { |
167 | 208 | try | 208 | lCause = lCause == 0 ? CAUSE_BREAKPOINT : lCause; |
168 | 209 | { | 209 | |
169 | 210 | lCause = lCause == 0 ? CAUSE_BREAKPOINT : lCause; | 210 | // tell everybody that we are the iterator who suspended |
170 | 211 | 211 | //lCommons->setCurrentIterator(this); | |
171 | 212 | // tell everybody that we are the iterator who suspended | 212 | lCommons->setCurrentStaticContext(getStaticContext()); |
172 | 213 | //lCommons->setCurrentIterator(this); | 213 | lCommons->setCurrentDynamicContext(planState->theLocalDynCtx); |
173 | 214 | lCommons->setCurrentStaticContext(getStaticContext()); | 214 | lCommons->setBreak(false); |
174 | 215 | lCommons->setCurrentDynamicContext(planState->theLocalDynCtx); | 215 | lCommons->setPlanState(planState); |
165 | 216 | lCommons->setBreak(false); | ||
166 | 217 | lCommons->setPlanState(planState); | ||
175 | 218 | 216 | ||
184 | 219 | // suspend | 217 | // suspend |
185 | 220 | lCommons->getRuntime()->suspendRuntime(loc, lCause); | 218 | lCommons->getRuntime()->suspendRuntime(loc, lCause); |
186 | 221 | lCause = 0; | 219 | lCause = 0; |
179 | 222 | } | ||
180 | 223 | catch (...) | ||
181 | 224 | { | ||
182 | 225 | throw; | ||
183 | 226 | } | ||
187 | 227 | } | 220 | } |
188 | 228 | } | 221 | } |
189 | 229 | #endif // ZORBA_WITH_DEBUGGER | 222 | #endif // ZORBA_WITH_DEBUGGER |
190 | 230 | 223 | ||
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 | 150 | } | 150 | } |
196 | 151 | catch(...) | 151 | catch(...) |
197 | 152 | { | 152 | { |
201 | 153 | if (key != NULL) | 153 | delete key; |
199 | 154 | delete key; | ||
200 | 155 | |||
202 | 156 | throw; | 154 | throw; |
203 | 157 | } | 155 | } |
204 | 158 | } | 156 | } |
205 | 159 | 157 | ||
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 | 196 | if (theFragmentStream->ctxt == NULL) | 196 | if (theFragmentStream->ctxt == NULL) |
211 | 197 | { | 197 | { |
212 | 198 | theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( XMLParserInitFailed ) ))); | 198 | theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( XMLParserInitFailed ) ))); |
214 | 199 | throw 0; // the argument to throw is not used by the catch clause | 199 | abortload(); |
215 | 200 | thePathStack.clear(); | ||
216 | 201 | return NULL; | ||
217 | 200 | } | 202 | } |
218 | 201 | 203 | ||
219 | 202 | // Apply parser options | 204 | // Apply parser options |
220 | @@ -210,7 +212,9 @@ | |||
221 | 210 | if (input == NULL) | 212 | if (input == NULL) |
222 | 211 | { | 213 | { |
223 | 212 | theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( XMLParserInitFailed ) ))); | 214 | theXQueryDiagnostics->add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( XMLParserInitFailed ) ))); |
225 | 213 | throw 0; // the argument to throw is not used by the catch clause | 215 | abortload(); |
226 | 216 | thePathStack.clear(); | ||
227 | 217 | return NULL; | ||
228 | 214 | } | 218 | } |
229 | 215 | 219 | ||
230 | 216 | // Initialize the parser input (only filename and the pointer to the current char) | 220 | // Initialize the parser input (only filename and the pointer to the current char) |
231 | @@ -253,7 +257,9 @@ | |||
232 | 253 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLNoOpeningTag ))) : | 257 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLNoOpeningTag ))) : |
233 | 254 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLNoOpeningTag ), theDocUri)) | 258 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLNoOpeningTag ), theDocUri)) |
234 | 255 | ); | 259 | ); |
236 | 256 | throw 0; // the argument to throw is not used by the catch clause | 260 | abortload(); |
237 | 261 | thePathStack.clear(); | ||
238 | 262 | return NULL; | ||
239 | 257 | } | 263 | } |
240 | 258 | 264 | ||
241 | 259 | // parse the DOCTYPE declaration, if any | 265 | // parse the DOCTYPE declaration, if any |
242 | @@ -281,7 +287,9 @@ | |||
243 | 281 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( ParseFragmentDoctypeNotAllowedHere ))) : | 287 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( ParseFragmentDoctypeNotAllowedHere ))) : |
244 | 282 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( ParseFragmentDoctypeNotAllowedHere ), theDocUri)) | 288 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( ParseFragmentDoctypeNotAllowedHere ), theDocUri)) |
245 | 283 | ); | 289 | ); |
247 | 284 | throw 0; // the argument to throw is not used by the catch clause | 290 | abortload(); |
248 | 291 | thePathStack.clear(); | ||
249 | 292 | return NULL; | ||
250 | 285 | } | 293 | } |
251 | 286 | else // theLoadProperties.getErrorOnDoctype() == true | 294 | else // theLoadProperties.getErrorOnDoctype() == true |
252 | 287 | { | 295 | { |
253 | @@ -289,7 +297,9 @@ | |||
254 | 289 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( ParseFragmentDoctypeNotAllowed ))) : | 297 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( ParseFragmentDoctypeNotAllowed ))) : |
255 | 290 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( ParseFragmentDoctypeNotAllowed ), theDocUri)) | 298 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( ParseFragmentDoctypeNotAllowed ), theDocUri)) |
256 | 291 | ); | 299 | ); |
258 | 292 | throw 0; // the argument to throw is not used by the catch clause | 300 | abortload(); |
259 | 301 | thePathStack.clear(); | ||
260 | 302 | return NULL; | ||
261 | 293 | } | 303 | } |
262 | 294 | } | 304 | } |
263 | 295 | } | 305 | } |
264 | @@ -332,7 +342,9 @@ | |||
265 | 332 | } | 342 | } |
266 | 333 | 343 | ||
267 | 334 | if ( ! theXQueryDiagnostics->errors().empty()) | 344 | if ( ! theXQueryDiagnostics->errors().empty()) |
269 | 335 | throw 0; // the argument to throw is not used by the catch clause | 345 | abortload(); |
270 | 346 | thePathStack.clear(); | ||
271 | 347 | return NULL; | ||
272 | 336 | } | 348 | } |
273 | 337 | 349 | ||
274 | 338 | // this happens when there are tags that have not been closed | 350 | // this happens when there are tags that have not been closed |
275 | @@ -344,7 +356,9 @@ | |||
276 | 344 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLDocument_2o ))) : | 356 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLDocument_2o ))) : |
277 | 345 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLDocument_2o ), theDocUri)) | 357 | NEW_ZORBA_EXCEPTION(zerr::ZSTR0021_LOADER_PARSING_ERROR, ERROR_PARAMS( ZED( BadXMLDocument_2o ), theDocUri)) |
278 | 346 | ); | 358 | ); |
280 | 347 | throw 0; | 359 | abortload(); |
281 | 360 | thePathStack.clear(); | ||
282 | 361 | return NULL; | ||
283 | 348 | } | 362 | } |
284 | 349 | 363 | ||
285 | 350 | // this happens when the input is an empty string | 364 | // this happens when the input is an empty string |
286 | @@ -355,11 +369,24 @@ | |||
287 | 355 | 369 | ||
288 | 356 | FragmentXmlLoader::endDocument(theFragmentStream->ctxt->userData); // this would not be called otherwise | 370 | FragmentXmlLoader::endDocument(theFragmentStream->ctxt->userData); // this would not be called otherwise |
289 | 357 | } | 371 | } |
290 | 372 | catch( std::exception const &e ) | ||
291 | 373 | { | ||
292 | 374 | theXQueryDiagnostics-> | ||
293 | 375 | add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR, | ||
294 | 376 | ERROR_PARAMS( e.what() ))); | ||
295 | 377 | |||
296 | 378 | abortload(); | ||
297 | 379 | thePathStack.clear(); | ||
298 | 380 | return NULL; | ||
299 | 381 | } | ||
300 | 358 | catch (...) | 382 | catch (...) |
301 | 359 | { | 383 | { |
302 | 384 | theXQueryDiagnostics-> | ||
303 | 385 | add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR)); | ||
304 | 386 | |||
305 | 360 | abortload(); | 387 | abortload(); |
306 | 361 | thePathStack.clear(); | 388 | thePathStack.clear(); |
308 | 362 | return NULL; | 389 | throw; |
309 | 363 | } | 390 | } |
310 | 364 | 391 | ||
311 | 365 | // The doc may be well formed, but it may have other kinds of errors, e.g., unresolved ns prefixes. | 392 | // 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 | 733 | ) | 760 | ) |
314 | 734 | ); | 761 | ); |
315 | 735 | } | 762 | } |
316 | 763 | catch (std::exception const &e) | ||
317 | 764 | { | ||
318 | 765 | theXQueryDiagnostics->add_error( | ||
319 | 766 | NEW_ZORBA_EXCEPTION( | ||
320 | 767 | zerr::ZSTR0020_LOADER_IO_ERROR, ERROR_PARAMS( e.what() ) | ||
321 | 768 | ) | ||
322 | 769 | ); | ||
323 | 770 | } | ||
324 | 736 | catch (...) | 771 | catch (...) |
325 | 737 | { | 772 | { |
326 | 738 | theXQueryDiagnostics->add_error( | 773 | theXQueryDiagnostics->add_error( |
327 | @@ -850,8 +885,19 @@ | |||
328 | 850 | return NULL; | 885 | return NULL; |
329 | 851 | } | 886 | } |
330 | 852 | } | 887 | } |
331 | 888 | catch( std::exception const &e ) | ||
332 | 889 | { | ||
333 | 890 | theXQueryDiagnostics-> | ||
334 | 891 | add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR, ERROR_PARAMS( e.what() ))); | ||
335 | 892 | |||
336 | 893 | abortload(); | ||
337 | 894 | return NULL; | ||
338 | 895 | } | ||
339 | 853 | catch(...) | 896 | catch(...) |
340 | 854 | { | 897 | { |
341 | 898 | theXQueryDiagnostics-> | ||
342 | 899 | add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR)); | ||
343 | 900 | |||
344 | 855 | abortload(); | 901 | abortload(); |
345 | 856 | thePathStack.clear(); | 902 | thePathStack.clear(); |
346 | 857 | return NULL; | 903 | return NULL; |
347 | @@ -1071,6 +1117,14 @@ | |||
348 | 1071 | { | 1117 | { |
349 | 1072 | loader.theXQueryDiagnostics->add_error( e ); | 1118 | loader.theXQueryDiagnostics->add_error( e ); |
350 | 1073 | } | 1119 | } |
351 | 1120 | catch( std::exception const &e ) | ||
352 | 1121 | { | ||
353 | 1122 | loader.theXQueryDiagnostics->add_error( | ||
354 | 1123 | NEW_ZORBA_EXCEPTION( | ||
355 | 1124 | zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) | ||
356 | 1125 | ) | ||
357 | 1126 | ); | ||
358 | 1127 | } | ||
359 | 1074 | catch (...) | 1128 | catch (...) |
360 | 1075 | { | 1129 | { |
361 | 1076 | loader.theXQueryDiagnostics->add_error( | 1130 | loader.theXQueryDiagnostics->add_error( |
362 | @@ -1153,6 +1207,14 @@ | |||
363 | 1153 | { | 1207 | { |
364 | 1154 | loader.theXQueryDiagnostics->add_error( e ); | 1208 | loader.theXQueryDiagnostics->add_error( e ); |
365 | 1155 | } | 1209 | } |
366 | 1210 | catch( std::exception const &e ) | ||
367 | 1211 | { | ||
368 | 1212 | loader.theXQueryDiagnostics->add_error( | ||
369 | 1213 | NEW_ZORBA_EXCEPTION( | ||
370 | 1214 | zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) | ||
371 | 1215 | ) | ||
372 | 1216 | ); | ||
373 | 1217 | } | ||
374 | 1156 | catch (...) | 1218 | catch (...) |
375 | 1157 | { | 1219 | { |
376 | 1158 | loader.theXQueryDiagnostics->add_error( | 1220 | loader.theXQueryDiagnostics->add_error( |
377 | @@ -1447,6 +1509,14 @@ | |||
378 | 1447 | { | 1509 | { |
379 | 1448 | loader.theXQueryDiagnostics->add_error( e ); | 1510 | loader.theXQueryDiagnostics->add_error( e ); |
380 | 1449 | } | 1511 | } |
381 | 1512 | catch( std::exception const &e ) | ||
382 | 1513 | { | ||
383 | 1514 | loader.theXQueryDiagnostics->add_error( | ||
384 | 1515 | NEW_ZORBA_EXCEPTION( | ||
385 | 1516 | zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) | ||
386 | 1517 | ) | ||
387 | 1518 | ); | ||
388 | 1519 | } | ||
389 | 1450 | catch (...) | 1520 | catch (...) |
390 | 1451 | { | 1521 | { |
391 | 1452 | loader.theXQueryDiagnostics-> | 1522 | loader.theXQueryDiagnostics-> |
392 | @@ -1579,6 +1649,14 @@ | |||
393 | 1579 | { | 1649 | { |
394 | 1580 | loader.theXQueryDiagnostics->add_error( e ); | 1650 | loader.theXQueryDiagnostics->add_error( e ); |
395 | 1581 | } | 1651 | } |
396 | 1652 | catch( std::exception const &e ) | ||
397 | 1653 | { | ||
398 | 1654 | loader.theXQueryDiagnostics->add_error( | ||
399 | 1655 | NEW_ZORBA_EXCEPTION( | ||
400 | 1656 | zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) | ||
401 | 1657 | ) | ||
402 | 1658 | ); | ||
403 | 1659 | } | ||
404 | 1582 | catch (...) | 1660 | catch (...) |
405 | 1583 | { | 1661 | { |
406 | 1584 | loader.theXQueryDiagnostics->add_error( | 1662 | loader.theXQueryDiagnostics->add_error( |
407 | @@ -1630,6 +1708,14 @@ | |||
408 | 1630 | { | 1708 | { |
409 | 1631 | loader.theXQueryDiagnostics->add_error( e ); | 1709 | loader.theXQueryDiagnostics->add_error( e ); |
410 | 1632 | } | 1710 | } |
411 | 1711 | catch( std::exception const &e ) | ||
412 | 1712 | { | ||
413 | 1713 | loader.theXQueryDiagnostics->add_error( | ||
414 | 1714 | NEW_ZORBA_EXCEPTION( | ||
415 | 1715 | zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) | ||
416 | 1716 | ) | ||
417 | 1717 | ); | ||
418 | 1718 | } | ||
419 | 1633 | catch (...) | 1719 | catch (...) |
420 | 1634 | { | 1720 | { |
421 | 1635 | loader.theXQueryDiagnostics->add_error( | 1721 | loader.theXQueryDiagnostics->add_error( |
422 | @@ -1683,6 +1769,14 @@ | |||
423 | 1683 | { | 1769 | { |
424 | 1684 | loader.theXQueryDiagnostics->add_error( e ); | 1770 | loader.theXQueryDiagnostics->add_error( e ); |
425 | 1685 | } | 1771 | } |
426 | 1772 | catch( std::exception const &e ) | ||
427 | 1773 | { | ||
428 | 1774 | loader.theXQueryDiagnostics->add_error( | ||
429 | 1775 | NEW_ZORBA_EXCEPTION( | ||
430 | 1776 | zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) | ||
431 | 1777 | ) | ||
432 | 1778 | ); | ||
433 | 1779 | } | ||
434 | 1686 | catch (...) | 1780 | catch (...) |
435 | 1687 | { | 1781 | { |
436 | 1688 | loader.theXQueryDiagnostics->add_error( | 1782 | loader.theXQueryDiagnostics->add_error( |
437 | @@ -1733,6 +1827,14 @@ | |||
438 | 1733 | { | 1827 | { |
439 | 1734 | loader.theXQueryDiagnostics->add_error( e ); | 1828 | loader.theXQueryDiagnostics->add_error( e ); |
440 | 1735 | } | 1829 | } |
441 | 1830 | catch( std::exception const &e ) | ||
442 | 1831 | { | ||
443 | 1832 | loader.theXQueryDiagnostics->add_error( | ||
444 | 1833 | NEW_ZORBA_EXCEPTION( | ||
445 | 1834 | zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) | ||
446 | 1835 | ) | ||
447 | 1836 | ); | ||
448 | 1837 | } | ||
449 | 1736 | catch (...) | 1838 | catch (...) |
450 | 1737 | { | 1839 | { |
451 | 1738 | loader.theXQueryDiagnostics->add_error( | 1840 | loader.theXQueryDiagnostics->add_error( |
452 | @@ -1776,6 +1878,14 @@ | |||
453 | 1776 | { | 1878 | { |
454 | 1777 | loader.theXQueryDiagnostics->add_error( e ); | 1879 | loader.theXQueryDiagnostics->add_error( e ); |
455 | 1778 | } | 1880 | } |
456 | 1881 | catch( std::exception const &e ) | ||
457 | 1882 | { | ||
458 | 1883 | loader.theXQueryDiagnostics->add_error( | ||
459 | 1884 | NEW_ZORBA_EXCEPTION( | ||
460 | 1885 | zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) | ||
461 | 1886 | ) | ||
462 | 1887 | ); | ||
463 | 1888 | } | ||
464 | 1779 | catch (...) | 1889 | catch (...) |
465 | 1780 | { | 1890 | { |
466 | 1781 | loader.theXQueryDiagnostics->add_error( | 1891 | loader.theXQueryDiagnostics->add_error( |
467 | 1782 | 1892 | ||
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 | 72 | return; \ | 72 | return; \ |
473 | 73 | } while (0); | 73 | } while (0); |
474 | 74 | 74 | ||
475 | 75 | #define LOADER_TRY try | ||
476 | 76 | |||
477 | 77 | #define LOADER_CATCH \ | ||
478 | 78 | catch ( ZorbaException const &e ) { \ | ||
479 | 79 | loader.theXQueryDiagnostics->add_error( e ); \ | ||
480 | 80 | } \ | ||
481 | 81 | catch ( std::exception const &e ) { \ | ||
482 | 82 | loader.theXQueryDiagnostics->add_error( \ | ||
483 | 83 | NEW_ZORBA_EXCEPTION( \ | ||
484 | 84 | zerr::ZXQP0003_INTERNAL_ERROR, ERROR_PARAMS( e.what() ) \ | ||
485 | 85 | ) \ | ||
486 | 86 | ); \ | ||
487 | 87 | } \ | ||
488 | 88 | catch ( ... ) { \ | ||
489 | 89 | loader.theXQueryDiagnostics->add_error( \ | ||
490 | 90 | NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR ) \ | ||
491 | 91 | ); \ | ||
492 | 92 | } | ||
493 | 93 | |||
494 | 75 | 94 | ||
495 | 76 | /******************************************************************************* | 95 | /******************************************************************************* |
496 | 77 | 96 | ||
497 | @@ -334,7 +353,8 @@ | |||
498 | 334 | 353 | ||
499 | 335 | return stream.gcount(); | 354 | return stream.gcount(); |
500 | 336 | } | 355 | } |
502 | 337 | catch (std::iostream::failure e) | 356 | // catch-TODO: should ZorbaException be caught seperately here? |
503 | 357 | catch (std::exception const &e) | ||
504 | 338 | { | 358 | { |
505 | 339 | theXQueryDiagnostics->add_error( | 359 | theXQueryDiagnostics->add_error( |
506 | 340 | NEW_ZORBA_EXCEPTION( | 360 | NEW_ZORBA_EXCEPTION( |
507 | @@ -445,7 +465,7 @@ | |||
508 | 445 | if (numChars < 0) | 465 | if (numChars < 0) |
509 | 446 | { | 466 | { |
510 | 447 | theXQueryDiagnostics-> | 467 | theXQueryDiagnostics-> |
512 | 448 | add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR)); | 468 | add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR)); |
513 | 449 | 469 | ||
514 | 450 | abortload(); | 470 | abortload(); |
515 | 451 | return NULL; | 471 | return NULL; |
516 | @@ -453,10 +473,22 @@ | |||
517 | 453 | 473 | ||
518 | 454 | xmlParseChunk(ctxt, theBuffer, 0, 1); | 474 | xmlParseChunk(ctxt, theBuffer, 0, 1); |
519 | 455 | } | 475 | } |
520 | 476 | catch( std::exception const &e ) | ||
521 | 477 | { | ||
522 | 478 | theXQueryDiagnostics-> | ||
523 | 479 | add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR, | ||
524 | 480 | ERROR_PARAMS( e.what() ))); | ||
525 | 481 | |||
526 | 482 | abortload(); | ||
527 | 483 | return NULL; | ||
528 | 484 | } | ||
529 | 456 | catch(...) | 485 | catch(...) |
530 | 457 | { | 486 | { |
531 | 487 | theXQueryDiagnostics-> | ||
532 | 488 | add_error(NEW_ZORBA_EXCEPTION(zerr::ZSTR0020_LOADER_IO_ERROR)); | ||
533 | 489 | |||
534 | 458 | abortload(); | 490 | abortload(); |
536 | 459 | return NULL; | 491 | throw; |
537 | 460 | } | 492 | } |
538 | 461 | 493 | ||
539 | 462 | bool ok = ctxt->wellFormed != 0; | 494 | bool ok = ctxt->wellFormed != 0; |
540 | @@ -505,7 +537,7 @@ | |||
541 | 505 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>(ctx)); | 537 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>(ctx)); |
542 | 506 | ZORBA_LOADER_CHECK_ERROR(loader); | 538 | ZORBA_LOADER_CHECK_ERROR(loader); |
543 | 507 | 539 | ||
545 | 508 | try | 540 | LOADER_TRY |
546 | 509 | { | 541 | { |
547 | 510 | DocumentNode* docNode = GET_STORE().getNodeFactory().createDocumentNode(); | 542 | DocumentNode* docNode = GET_STORE().getNodeFactory().createDocumentNode(); |
548 | 511 | 543 | ||
549 | @@ -530,15 +562,7 @@ | |||
550 | 530 | 562 | ||
551 | 531 | LOADER_TRACE1("Start Doc Node = " << docNode); | 563 | LOADER_TRACE1("Start Doc Node = " << docNode); |
552 | 532 | } | 564 | } |
562 | 533 | catch (ZorbaException const& e) | 565 | LOADER_CATCH |
554 | 534 | { | ||
555 | 535 | loader.theXQueryDiagnostics->add_error( e ); | ||
556 | 536 | } | ||
557 | 537 | catch (...) | ||
558 | 538 | { | ||
559 | 539 | loader.theXQueryDiagnostics-> | ||
560 | 540 | add_error(NEW_ZORBA_EXCEPTION(zerr::ZXQP0003_INTERNAL_ERROR)); | ||
561 | 541 | } | ||
563 | 542 | } | 566 | } |
564 | 543 | 567 | ||
565 | 544 | 568 | ||
566 | @@ -561,7 +585,7 @@ | |||
567 | 561 | DocumentNode* docNode; | 585 | DocumentNode* docNode; |
568 | 562 | XmlNode* currChild; | 586 | XmlNode* currChild; |
569 | 563 | 587 | ||
571 | 564 | try | 588 | LOADER_TRY |
572 | 565 | { | 589 | { |
573 | 566 | // This check is required because it is possible (in case of mal-formed doc) | 590 | // This check is required because it is possible (in case of mal-formed doc) |
574 | 567 | // that libXml calls endDocument() without having called startDocument(). | 591 | // that libXml calls endDocument() without having called startDocument(). |
575 | @@ -615,16 +639,7 @@ | |||
576 | 615 | 639 | ||
577 | 616 | LOADER_TRACE2("End Doc Node = " << docNode); | 640 | LOADER_TRACE2("End Doc Node = " << docNode); |
578 | 617 | } | 641 | } |
589 | 618 | catch (ZorbaException const& e) | 642 | LOADER_CATCH |
580 | 619 | { | ||
581 | 620 | loader.theXQueryDiagnostics->add_error( e ); | ||
582 | 621 | } | ||
583 | 622 | catch (...) | ||
584 | 623 | { | ||
585 | 624 | loader.theXQueryDiagnostics->add_error( | ||
586 | 625 | NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR ) | ||
587 | 626 | ); | ||
588 | 627 | } | ||
590 | 628 | } | 643 | } |
591 | 629 | 644 | ||
592 | 630 | 645 | ||
593 | @@ -665,7 +680,7 @@ | |||
594 | 665 | zorba::Stack<PathStepInfo>& pathStack = loader.thePathStack; | 680 | zorba::Stack<PathStepInfo>& pathStack = loader.thePathStack; |
595 | 666 | zstring baseUri; | 681 | zstring baseUri; |
596 | 667 | 682 | ||
598 | 668 | try | 683 | LOADER_TRY |
599 | 669 | { | 684 | { |
600 | 670 | csize numAttributes = static_cast<csize>(numAttrs); | 685 | csize numAttributes = static_cast<csize>(numAttrs); |
601 | 671 | csize numBindings = static_cast<csize>(numNamespaces); | 686 | csize numBindings = static_cast<csize>(numNamespaces); |
602 | @@ -856,15 +871,7 @@ | |||
603 | 856 | nodeStack.push(NULL); | 871 | nodeStack.push(NULL); |
604 | 857 | pathStack.push(PathStepInfo(elemNode, baseUri)); | 872 | pathStack.push(PathStepInfo(elemNode, baseUri)); |
605 | 858 | } | 873 | } |
615 | 859 | catch (ZorbaException const& e) | 874 | LOADER_CATCH |
607 | 860 | { | ||
608 | 861 | loader.theXQueryDiagnostics->add_error( e ); | ||
609 | 862 | } | ||
610 | 863 | catch (...) | ||
611 | 864 | { | ||
612 | 865 | loader.theXQueryDiagnostics-> | ||
613 | 866 | add_error(NEW_ZORBA_EXCEPTION(zerr::ZXQP0003_INTERNAL_ERROR)); | ||
614 | 867 | } | ||
616 | 868 | } | 875 | } |
617 | 869 | 876 | ||
618 | 870 | 877 | ||
619 | @@ -897,7 +904,7 @@ | |||
620 | 897 | XmlNode* prevChild = NULL; | 904 | XmlNode* prevChild = NULL; |
621 | 898 | XmlNode* currChild; | 905 | XmlNode* currChild; |
622 | 899 | 906 | ||
624 | 900 | try | 907 | LOADER_TRY |
625 | 901 | { | 908 | { |
626 | 902 | // Find the position of the 1st child of this element node in the node stack | 909 | // Find the position of the 1st child of this element node in the node stack |
627 | 903 | firstChildPos = stackSize - 1; | 910 | firstChildPos = stackSize - 1; |
628 | @@ -984,16 +991,7 @@ | |||
629 | 984 | } | 991 | } |
630 | 985 | #endif | 992 | #endif |
631 | 986 | } | 993 | } |
642 | 987 | catch (ZorbaException const& e) | 994 | LOADER_CATCH |
633 | 988 | { | ||
634 | 989 | loader.theXQueryDiagnostics->add_error( e ); | ||
635 | 990 | } | ||
636 | 991 | catch (...) | ||
637 | 992 | { | ||
638 | 993 | loader.theXQueryDiagnostics->add_error( | ||
639 | 994 | NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR ) | ||
640 | 995 | ); | ||
641 | 996 | } | ||
643 | 997 | } | 995 | } |
644 | 998 | 996 | ||
645 | 999 | 997 | ||
646 | @@ -1009,7 +1007,7 @@ | |||
647 | 1009 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>( ctx )); | 1007 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>( ctx )); |
648 | 1010 | ZORBA_LOADER_CHECK_ERROR(loader); | 1008 | ZORBA_LOADER_CHECK_ERROR(loader); |
649 | 1011 | 1009 | ||
651 | 1012 | try | 1010 | LOADER_TRY |
652 | 1013 | { | 1011 | { |
653 | 1014 | const char* charp = reinterpret_cast<const char*>(ch); | 1012 | const char* charp = reinterpret_cast<const char*>(ch); |
654 | 1015 | zstring content(charp, len); | 1013 | zstring content(charp, len); |
655 | @@ -1035,16 +1033,7 @@ | |||
656 | 1035 | LOADER_TRACE2(lSs.str()); | 1033 | LOADER_TRACE2(lSs.str()); |
657 | 1036 | #endif | 1034 | #endif |
658 | 1037 | } | 1035 | } |
669 | 1038 | catch (ZorbaException const& e) | 1036 | LOADER_CATCH |
660 | 1039 | { | ||
661 | 1040 | loader.theXQueryDiagnostics->add_error( e ); | ||
662 | 1041 | } | ||
663 | 1042 | catch (...) | ||
664 | 1043 | { | ||
665 | 1044 | loader.theXQueryDiagnostics->add_error( | ||
666 | 1045 | NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR ) | ||
667 | 1046 | ); | ||
668 | 1047 | } | ||
670 | 1048 | } | 1037 | } |
671 | 1049 | 1038 | ||
672 | 1050 | 1039 | ||
673 | @@ -1060,7 +1049,7 @@ | |||
674 | 1060 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>( ctx )); | 1049 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>( ctx )); |
675 | 1061 | ZORBA_LOADER_CHECK_ERROR(loader); | 1050 | ZORBA_LOADER_CHECK_ERROR(loader); |
676 | 1062 | 1051 | ||
678 | 1063 | try | 1052 | LOADER_TRY |
679 | 1064 | { | 1053 | { |
680 | 1065 | // If a doc contains an element like <cdata><![CDATA[ <> ]]></cdata>, | 1054 | // If a doc contains an element like <cdata><![CDATA[ <> ]]></cdata>, |
681 | 1066 | // libxml returns the string " <> ". | 1055 | // libxml returns the string " <> ". |
682 | @@ -1088,16 +1077,7 @@ | |||
683 | 1088 | LOADER_TRACE2(lSs.str()); | 1077 | LOADER_TRACE2(lSs.str()); |
684 | 1089 | #endif | 1078 | #endif |
685 | 1090 | } | 1079 | } |
696 | 1091 | catch (ZorbaException const& e) | 1080 | LOADER_CATCH |
687 | 1092 | { | ||
688 | 1093 | loader.theXQueryDiagnostics->add_error( e ); | ||
689 | 1094 | } | ||
690 | 1095 | catch (...) | ||
691 | 1096 | { | ||
692 | 1097 | loader.theXQueryDiagnostics->add_error( | ||
693 | 1098 | NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR ) | ||
694 | 1099 | ); | ||
695 | 1100 | } | ||
697 | 1101 | } | 1081 | } |
698 | 1102 | 1082 | ||
699 | 1103 | 1083 | ||
700 | @@ -1115,7 +1095,7 @@ | |||
701 | 1115 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>( ctx )); | 1095 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>( ctx )); |
702 | 1116 | ZORBA_LOADER_CHECK_ERROR(loader); | 1096 | ZORBA_LOADER_CHECK_ERROR(loader); |
703 | 1117 | 1097 | ||
705 | 1118 | try | 1098 | LOADER_TRY |
706 | 1119 | { | 1099 | { |
707 | 1120 | // bugfix: handling PIs with no data (i.e. data being NULL) | 1100 | // bugfix: handling PIs with no data (i.e. data being NULL) |
708 | 1121 | zstring content; | 1101 | zstring content; |
709 | @@ -1138,16 +1118,7 @@ | |||
710 | 1138 | << targetp << std::endl << " ordpath = " | 1118 | << targetp << std::endl << " ordpath = " |
711 | 1139 | << piNode->getOrdPath().show() << std::endl); | 1119 | << piNode->getOrdPath().show() << std::endl); |
712 | 1140 | } | 1120 | } |
723 | 1141 | catch (ZorbaException const& e) | 1121 | LOADER_CATCH |
714 | 1142 | { | ||
715 | 1143 | loader.theXQueryDiagnostics->add_error( e ); | ||
716 | 1144 | } | ||
717 | 1145 | catch (...) | ||
718 | 1146 | { | ||
719 | 1147 | loader.theXQueryDiagnostics->add_error( | ||
720 | 1148 | NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR ) | ||
721 | 1149 | ); | ||
722 | 1150 | } | ||
724 | 1151 | } | 1122 | } |
725 | 1152 | 1123 | ||
726 | 1153 | 1124 | ||
727 | @@ -1162,7 +1133,7 @@ | |||
728 | 1162 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>( ctx )); | 1133 | FastXmlLoader& loader = *(static_cast<FastXmlLoader *>( ctx )); |
729 | 1163 | ZORBA_LOADER_CHECK_ERROR(loader); | 1134 | ZORBA_LOADER_CHECK_ERROR(loader); |
730 | 1164 | 1135 | ||
732 | 1165 | try | 1136 | LOADER_TRY |
733 | 1166 | { | 1137 | { |
734 | 1167 | const char* charp = reinterpret_cast<const char*>(ch); | 1138 | const char* charp = reinterpret_cast<const char*>(ch); |
735 | 1168 | zstring content; | 1139 | zstring content; |
736 | @@ -1183,16 +1154,7 @@ | |||
737 | 1183 | << charp << std::endl << " ordpath = " | 1154 | << charp << std::endl << " ordpath = " |
738 | 1184 | << commentNode->getOrdPath().show() << std::endl); | 1155 | << commentNode->getOrdPath().show() << std::endl); |
739 | 1185 | } | 1156 | } |
750 | 1186 | catch (ZorbaException const& e) | 1157 | LOADER_CATCH |
741 | 1187 | { | ||
742 | 1188 | loader.theXQueryDiagnostics->add_error( e ); | ||
743 | 1189 | } | ||
744 | 1190 | catch (...) | ||
745 | 1191 | { | ||
746 | 1192 | loader.theXQueryDiagnostics->add_error( | ||
747 | 1193 | NEW_ZORBA_EXCEPTION( zerr::ZXQP0003_INTERNAL_ERROR ) | ||
748 | 1194 | ); | ||
749 | 1195 | } | ||
751 | 1196 | } | 1158 | } |
752 | 1197 | 1159 | ||
753 | 1198 | 1160 | ||
754 | 1199 | 1161 | ||
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 | 763 | if (theParent == NULL) | 763 | if (theParent == NULL) |
760 | 764 | return false; | 764 | return false; |
761 | 765 | 765 | ||
763 | 766 | try | 766 | if (getNodeKind() == store::StoreConsts::attributeNode) |
764 | 767 | { | 767 | { |
779 | 768 | if (getNodeKind() == store::StoreConsts::attributeNode) | 768 | csize numAttrs = theParent->numAttrs(); |
780 | 769 | { | 769 | pos = theParent->removeAttr(this); |
781 | 770 | csize numAttrs = theParent->numAttrs(); | 770 | ZORBA_FATAL(pos <= numAttrs, ""); |
782 | 771 | pos = theParent->removeAttr(this); | 771 | return (pos < numAttrs); |
769 | 772 | ZORBA_FATAL(pos <= numAttrs, ""); | ||
770 | 773 | return (pos < numAttrs); | ||
771 | 774 | } | ||
772 | 775 | else | ||
773 | 776 | { | ||
774 | 777 | csize numChildren = theParent->numChildren(); | ||
775 | 778 | pos = theParent->removeChild(this); | ||
776 | 779 | ZORBA_FATAL(pos <= numChildren, ""); | ||
777 | 780 | return (pos < numChildren); | ||
778 | 781 | } | ||
783 | 782 | } | 772 | } |
785 | 783 | catch(...) | 773 | else |
786 | 784 | { | 774 | { |
788 | 785 | ZORBA_FATAL(false, "Unexpected exception"); | 775 | csize numChildren = theParent->numChildren(); |
789 | 776 | pos = theParent->removeChild(this); | ||
790 | 777 | ZORBA_FATAL(pos <= numChildren, ""); | ||
791 | 778 | return (pos < numChildren); | ||
792 | 786 | } | 779 | } |
793 | 787 | } | 780 | } |
794 | 788 | 781 | ||
795 | @@ -857,17 +850,10 @@ | |||
796 | 857 | ********************************************************************************/ | 850 | ********************************************************************************/ |
797 | 858 | void XmlNode::destroy(bool removeType) | 851 | void XmlNode::destroy(bool removeType) |
798 | 859 | { | 852 | { |
803 | 860 | try | 853 | csize pos; |
804 | 861 | { | 854 | disconnect(pos); |
801 | 862 | csize pos; | ||
802 | 863 | disconnect(pos); | ||
805 | 864 | 855 | ||
812 | 865 | destroyInternal(removeType); | 856 | destroyInternal(removeType); |
807 | 866 | } | ||
808 | 867 | catch (...) | ||
809 | 868 | { | ||
810 | 869 | ZORBA_FATAL(false, "Unexpected exception"); | ||
811 | 870 | } | ||
813 | 871 | } | 857 | } |
814 | 872 | 858 | ||
815 | 873 | 859 | ||
816 | 874 | 860 | ||
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 | 328 | ********************************************************************************/ | 328 | ********************************************************************************/ |
822 | 329 | void XmlNode::detach() | 329 | void XmlNode::detach() |
823 | 330 | { | 330 | { |
911 | 331 | try | 331 | ZORBA_ASSERT(theParent != NULL); |
912 | 332 | { | 332 | |
913 | 333 | ZORBA_ASSERT(theParent != NULL); | 333 | ulong refcount = 0; |
914 | 334 | 334 | ||
915 | 335 | ulong refcount = 0; | 335 | XmlTree* oldTree = getTree(); |
916 | 336 | 336 | XmlTree* newTree = GET_STORE().getNodeFactory().createXmlTree(); | |
917 | 337 | XmlTree* oldTree = getTree(); | 337 | newTree->setRoot(this); |
918 | 338 | XmlTree* newTree = GET_STORE().getNodeFactory().createXmlTree(); | 338 | |
919 | 339 | newTree->setRoot(this); | 339 | if (oldTree->getRoot() == this) |
920 | 340 | 340 | oldTree->setRoot(NULL); | |
921 | 341 | if (oldTree->getRoot() == this) | 341 | |
922 | 342 | oldTree->setRoot(NULL); | 342 | store::StoreConsts::NodeKind nodeKind = getNodeKind(); |
923 | 343 | 343 | ||
924 | 344 | store::StoreConsts::NodeKind nodeKind = getNodeKind(); | 344 | // ???? What we do here is not really thread-safe. For example, consider the |
925 | 345 | 345 | // following scenario: Let T1 be "this" thread and T2 be another thread that | |
926 | 346 | // ???? What we do here is not really thread-safe. For example, consider the | 346 | // has an rchandle, rc2, on N. Right after T1 acquires the rclock on the old |
927 | 347 | // following scenario: Let T1 be "this" thread and T2 be another thread that | 347 | // tree, T2 tries to make a copy of rc2; as a result, T2 will block on the |
928 | 348 | // has an rchandle, rc2, on N. Right after T1 acquires the rclock on the old | 348 | // old tree rclock. When T1 releases the old rclock, the old tree may be |
929 | 349 | // tree, T2 tries to make a copy of rc2; as a result, T2 will block on the | 349 | // destroyed already, so T2 will be trying to acquire a deallocated lock. |
930 | 350 | // old tree rclock. When T1 releases the old rclock, the old tree may be | 350 | // Even if the old tree is there, T2 will increment the ref counter of the |
931 | 351 | // destroyed already, so T2 will be trying to acquire a deallocated lock. | 351 | // new tree while holding the lock of the old tree. In fact, the setTree() |
932 | 352 | // Even if the old tree is there, T2 will increment the ref counter of the | 352 | // method istself is not safe (if T2 tries to copy rc2 after T1 has returned |
933 | 353 | // new tree while holding the lock of the old tree. In fact, the setTree() | 353 | // from setTree(), then things are ok). |
934 | 354 | // method istself is not safe (if T2 tries to copy rc2 after T1 has returned | 354 | SYNC_CODE(oldTree->getRCLock()->acquire()); |
935 | 355 | // from setTree(), then things are ok). | 355 | SYNC_CODE(newTree->getRCLock()->acquire()); |
936 | 356 | SYNC_CODE(oldTree->getRCLock()->acquire()); | 356 | |
937 | 357 | SYNC_CODE(newTree->getRCLock()->acquire()); | 357 | refcount += theRefCount; |
938 | 358 | 358 | ||
939 | 359 | refcount += theRefCount; | 359 | switch (nodeKind) |
940 | 360 | 360 | { | |
941 | 361 | switch (nodeKind) | 361 | case store::StoreConsts::attributeNode: |
942 | 362 | { | 362 | { |
943 | 363 | case store::StoreConsts::attributeNode: | 363 | setTree(newTree); |
944 | 364 | { | 364 | theParent->removeAttr(this); |
945 | 365 | setTree(newTree); | 365 | theParent = NULL; |
946 | 366 | theParent->removeAttr(this); | 366 | break; |
947 | 367 | theParent = NULL; | 367 | } |
948 | 368 | break; | 368 | case store::StoreConsts::piNode: |
949 | 369 | } | 369 | case store::StoreConsts::commentNode: |
950 | 370 | case store::StoreConsts::piNode: | 370 | { |
951 | 371 | case store::StoreConsts::commentNode: | 371 | setTree(newTree); |
952 | 372 | { | 372 | theParent->removeChild(this); |
953 | 373 | setTree(newTree); | 373 | theParent = NULL; |
954 | 374 | theParent->removeChild(this); | 374 | break; |
955 | 375 | theParent = NULL; | 375 | } |
956 | 376 | break; | 376 | case store::StoreConsts::textNode: |
957 | 377 | } | 377 | { |
958 | 378 | case store::StoreConsts::textNode: | 378 | setTree(newTree); |
959 | 379 | { | 379 | |
960 | 380 | setTree(newTree); | 380 | reinterpret_cast<TextNode*>(this)->revertToTextContent(); |
961 | 381 | 381 | ||
962 | 382 | reinterpret_cast<TextNode*>(this)->revertToTextContent(); | 382 | theParent->removeChild(this); |
963 | 383 | 383 | theParent = NULL; | |
964 | 384 | theParent->removeChild(this); | 384 | break; |
965 | 385 | theParent = NULL; | 385 | } |
966 | 386 | break; | 386 | case store::StoreConsts::elementNode: |
967 | 387 | } | 387 | { |
968 | 388 | case store::StoreConsts::elementNode: | 388 | ElementNode* rootNode = reinterpret_cast<ElementNode*>(this); |
969 | 389 | { | 389 | |
970 | 390 | ElementNode* rootNode = reinterpret_cast<ElementNode*>(this); | 390 | // If the baseUri property of N is inherited from its ancestors, make a |
971 | 391 | 391 | // local copy of it, before disconnecting N from its parent. | |
972 | 392 | // If the baseUri property of N is inherited from its ancestors, make a | 392 | bool localBaseUri; |
973 | 393 | // local copy of it, before disconnecting N from its parent. | 393 | zstring baseUri; |
974 | 394 | bool localBaseUri; | 394 | getBaseURIInternal(baseUri, localBaseUri); |
975 | 395 | zstring baseUri; | 395 | if (!localBaseUri && !baseUri.empty()) |
976 | 396 | getBaseURIInternal(baseUri, localBaseUri); | 396 | { |
977 | 397 | if (!localBaseUri && !baseUri.empty()) | 397 | zstring dummyUri; |
978 | 398 | { | 398 | rootNode->addBaseUriProperty(baseUri, dummyUri); |
979 | 399 | zstring dummyUri; | 399 | } |
980 | 400 | rootNode->addBaseUriProperty(baseUri, dummyUri); | 400 | |
981 | 401 | } | 401 | // For each node in the nodes stack, we must save the nsCtx of its |
982 | 402 | 402 | // parent node in the parentNsCtxs stack, because the nsCtx of the | |
983 | 403 | // For each node in the nodes stack, we must save the nsCtx of its | 403 | // parent may change during the while loop below. |
984 | 404 | // parent node in the parentNsCtxs stack, because the nsCtx of the | 404 | std::stack<XmlNode*> nodes; |
985 | 405 | // parent may change during the while loop below. | 405 | std::stack<NsBindingsContext*> parentNsCtxs; |
986 | 406 | std::stack<XmlNode*> nodes; | 406 | |
987 | 407 | std::stack<NsBindingsContext*> parentNsCtxs; | 407 | nodes.push(this); |
988 | 408 | 408 | parentNsCtxs.push(rootNode->theParent->getNsContext()); | |
989 | 409 | nodes.push(this); | 409 | |
990 | 410 | parentNsCtxs.push(rootNode->theParent->getNsContext()); | 410 | while (!nodes.empty()) |
991 | 411 | 411 | { | |
992 | 412 | while (!nodes.empty()) | 412 | XmlNode* node = nodes.top(); |
993 | 413 | { | 413 | nodes.pop(); |
994 | 414 | XmlNode* node = nodes.top(); | 414 | |
995 | 415 | nodes.pop(); | 415 | if (node->getNodeKind() == store::StoreConsts::elementNode) |
996 | 416 | 416 | { | |
997 | 417 | if (node->getNodeKind() == store::StoreConsts::elementNode) | 417 | ElementNode* elemNode = reinterpret_cast<ElementNode*>(node); |
998 | 418 | |||
999 | 419 | node->setTree(newTree); | ||
1000 | 420 | |||
1001 | 421 | // Preserve the namespace bindings of the current node | ||
1002 | 422 | NsBindingsContext* nsContext = elemNode->getNsContext(); | ||
1003 | 423 | NsBindingsContext* parentNsContext = parentNsCtxs.top(); | ||
1004 | 424 | parentNsCtxs.pop(); | ||
1005 | 425 | |||
1006 | 426 | // If the current node is N, or a node in NT that does not inherit ns | ||
1007 | 427 | // bindings directly from its parent (but may inherit from some other | ||
1008 | 428 | // ancestor). | ||
1009 | 429 | if (elemNode == rootNode || | ||
1010 | 430 | nsContext == NULL || | ||
1011 | 431 | (elemNode->haveLocalBindings() && | ||
1012 | 432 | nsContext->getParent() != parentNsContext) || | ||
1013 | 433 | nsContext != parentNsContext) | ||
1014 | 418 | { | 434 | { |
1032 | 419 | ElementNode* elemNode = reinterpret_cast<ElementNode*>(node); | 435 | if (nsContext != NULL) |
1016 | 420 | |||
1017 | 421 | node->setTree(newTree); | ||
1018 | 422 | |||
1019 | 423 | // Preserve the namespace bindings of the current node | ||
1020 | 424 | NsBindingsContext* nsContext = elemNode->getNsContext(); | ||
1021 | 425 | NsBindingsContext* parentNsContext = parentNsCtxs.top(); | ||
1022 | 426 | parentNsCtxs.pop(); | ||
1023 | 427 | |||
1024 | 428 | // If the current node is N, or a node in NT that does not inherit ns | ||
1025 | 429 | // bindings directly from its parent (but may inherit from some other | ||
1026 | 430 | // ancestor). | ||
1027 | 431 | if (elemNode == rootNode || | ||
1028 | 432 | nsContext == NULL || | ||
1029 | 433 | (elemNode->haveLocalBindings() && | ||
1030 | 434 | nsContext->getParent() != parentNsContext) || | ||
1031 | 435 | nsContext != parentNsContext) | ||
1033 | 436 | { | 436 | { |
1035 | 437 | if (nsContext != NULL) | 437 | std::auto_ptr<NsBindingsContext> ctx(new NsBindingsContext()); |
1036 | 438 | elemNode->getNamespaceBindings(ctx->getBindings()); | ||
1037 | 439 | |||
1038 | 440 | if (!ctx->empty()) | ||
1039 | 438 | { | 441 | { |
1048 | 439 | std::auto_ptr<NsBindingsContext> ctx(new NsBindingsContext()); | 442 | elemNode->theNsContext = ctx.release(); |
1049 | 440 | elemNode->getNamespaceBindings(ctx->getBindings()); | 443 | elemNode->theFlags |= HaveLocalBindings; |
1042 | 441 | |||
1043 | 442 | if (!ctx->empty()) | ||
1044 | 443 | { | ||
1045 | 444 | elemNode->theNsContext = ctx.release(); | ||
1046 | 445 | elemNode->theFlags |= HaveLocalBindings; | ||
1047 | 446 | } | ||
1050 | 447 | } | 444 | } |
1051 | 448 | } | 445 | } |
1052 | 449 | |||
1053 | 450 | // Else the current node is not N and it inherits ns bindings directly | ||
1054 | 451 | // from its parent. | ||
1055 | 452 | else | ||
1056 | 453 | { | ||
1057 | 454 | elemNode->setNsContext(elemNode->theParent->getNsContext()); | ||
1058 | 455 | } | ||
1059 | 456 | |||
1060 | 457 | // Detach the attributes of the current node | ||
1061 | 458 | InternalNode::iterator ite = elemNode->attrsBegin(); | ||
1062 | 459 | InternalNode::iterator end = elemNode->attrsEnd(); | ||
1063 | 460 | |||
1064 | 461 | for (; ite != end; ++ite) | ||
1065 | 462 | { | ||
1066 | 463 | AttributeNode* attrNode = static_cast<AttributeNode*>(*ite); | ||
1067 | 464 | refcount += attrNode->theRefCount; | ||
1068 | 465 | attrNode->setTree(newTree); | ||
1069 | 466 | } | ||
1070 | 467 | |||
1071 | 468 | // Detach the children of the current node | ||
1072 | 469 | ite = elemNode->childrenBegin(); | ||
1073 | 470 | end = elemNode->childrenEnd(); | ||
1074 | 471 | |||
1075 | 472 | for (; ite != end; ++ite) | ||
1076 | 473 | { | ||
1077 | 474 | XmlNode* child = (*ite); | ||
1078 | 475 | refcount += child->theRefCount; | ||
1079 | 476 | |||
1080 | 477 | nodes.push(child); | ||
1081 | 478 | |||
1082 | 479 | if (child->getNodeKind() == store::StoreConsts::elementNode) | ||
1083 | 480 | parentNsCtxs.push(nsContext); | ||
1084 | 481 | } | ||
1085 | 482 | } | 446 | } |
1086 | 447 | |||
1087 | 448 | // Else the current node is not N and it inherits ns bindings directly | ||
1088 | 449 | // from its parent. | ||
1089 | 483 | else | 450 | else |
1090 | 484 | { | 451 | { |
1131 | 485 | node->setTree(newTree); | 452 | elemNode->setNsContext(elemNode->theParent->getNsContext()); |
1132 | 486 | } | 453 | } |
1133 | 487 | } // done traversing tree | 454 | |
1134 | 488 | 455 | // Detach the attributes of the current node | |
1135 | 489 | theParent->removeChild(this); | 456 | InternalNode::iterator ite = elemNode->attrsBegin(); |
1136 | 490 | theParent = NULL; | 457 | InternalNode::iterator end = elemNode->attrsEnd(); |
1137 | 491 | 458 | ||
1138 | 492 | break; | 459 | for (; ite != end; ++ite) |
1139 | 493 | } | 460 | { |
1140 | 494 | default: | 461 | AttributeNode* attrNode = static_cast<AttributeNode*>(*ite); |
1141 | 495 | { | 462 | refcount += attrNode->theRefCount; |
1142 | 496 | ZORBA_ASSERT(false); | 463 | attrNode->setTree(newTree); |
1143 | 497 | } | 464 | } |
1144 | 498 | } | 465 | |
1145 | 499 | 466 | // Detach the children of the current node | |
1146 | 500 | newTree->getRefCount() += refcount; | 467 | ite = elemNode->childrenBegin(); |
1147 | 501 | if (newTree->getRefCount() == 0) | 468 | end = elemNode->childrenEnd(); |
1148 | 502 | { | 469 | |
1149 | 503 | SYNC_CODE(newTree->getRCLock()->release()); | 470 | for (; ite != end; ++ite) |
1150 | 504 | newTree->free(); | 471 | { |
1151 | 505 | } | 472 | XmlNode* child = (*ite); |
1152 | 506 | else | 473 | refcount += child->theRefCount; |
1153 | 507 | { | 474 | |
1154 | 508 | SYNC_CODE(newTree->getRCLock()->release()); | 475 | nodes.push(child); |
1155 | 509 | } | 476 | |
1156 | 510 | 477 | if (child->getNodeKind() == store::StoreConsts::elementNode) | |
1157 | 511 | oldTree->getRefCount() -= refcount; | 478 | parentNsCtxs.push(nsContext); |
1158 | 512 | if (oldTree->getRefCount() == 0) | 479 | } |
1159 | 513 | { | 480 | } |
1160 | 514 | SYNC_CODE(oldTree->getRCLock()->release()); | 481 | else |
1161 | 515 | oldTree->free(); | 482 | { |
1162 | 516 | } | 483 | node->setTree(newTree); |
1163 | 517 | else | 484 | } |
1164 | 518 | { | 485 | } // done traversing tree |
1165 | 519 | SYNC_CODE(oldTree->getRCLock()->release()); | 486 | |
1166 | 520 | } | 487 | theParent->removeChild(this); |
1167 | 521 | } | 488 | theParent = NULL; |
1168 | 522 | catch(...) | 489 | |
1169 | 523 | { | 490 | break; |
1170 | 524 | ZORBA_FATAL(0, "Unexpected exception"); | 491 | } |
1171 | 492 | default: | ||
1172 | 493 | { | ||
1173 | 494 | ZORBA_ASSERT(false); | ||
1174 | 495 | } | ||
1175 | 496 | } | ||
1176 | 497 | |||
1177 | 498 | newTree->getRefCount() += refcount; | ||
1178 | 499 | if (newTree->getRefCount() == 0) | ||
1179 | 500 | { | ||
1180 | 501 | SYNC_CODE(newTree->getRCLock()->release()); | ||
1181 | 502 | newTree->free(); | ||
1182 | 503 | } | ||
1183 | 504 | else | ||
1184 | 505 | { | ||
1185 | 506 | SYNC_CODE(newTree->getRCLock()->release()); | ||
1186 | 507 | } | ||
1187 | 508 | |||
1188 | 509 | oldTree->getRefCount() -= refcount; | ||
1189 | 510 | if (oldTree->getRefCount() == 0) | ||
1190 | 511 | { | ||
1191 | 512 | SYNC_CODE(oldTree->getRCLock()->release()); | ||
1192 | 513 | oldTree->free(); | ||
1193 | 514 | } | ||
1194 | 515 | else | ||
1195 | 516 | { | ||
1196 | 517 | SYNC_CODE(oldTree->getRCLock()->release()); | ||
1197 | 525 | } | 518 | } |
1198 | 526 | } | 519 | } |
1199 | 527 | 520 | ||
1200 | 528 | 521 | ||
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 | 744 | { | 744 | { |
1206 | 745 | theRevalidationPul->applyUpdates(false); | 745 | theRevalidationPul->applyUpdates(false); |
1207 | 746 | } | 746 | } |
1208 | 747 | catch (std::exception const &e) | ||
1209 | 748 | { | ||
1210 | 749 | ZORBA_FATAL(false, "Error during the in-place validation: " << e.what()); | ||
1211 | 750 | } | ||
1212 | 747 | catch (...) | 751 | catch (...) |
1213 | 748 | { | 752 | { |
1215 | 749 | ZORBA_FATAL(0, "Error during the in-place validation"); | 753 | ZORBA_FATAL(false, "Error during the in-place validation"); |
1216 | 750 | } | 754 | } |
1217 | 751 | 755 | ||
1218 | 752 | theIsApplied = true; | 756 | theIsApplied = true; |
1219 | 753 | 757 | ||
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 | 575 | } | 575 | } |
1225 | 576 | catch(...) | 576 | catch(...) |
1226 | 577 | { | 577 | { |
1230 | 578 | if (key != NULL) | 578 | delete key; |
1228 | 579 | delete key; | ||
1229 | 580 | |||
1231 | 581 | sourceIter->close(); | 579 | sourceIter->close(); |
1232 | 582 | throw; | 580 | throw; |
1233 | 583 | } | 581 | } |
1234 | @@ -1051,6 +1049,7 @@ | |||
1235 | 1051 | catch(...) | 1049 | catch(...) |
1236 | 1052 | { | 1050 | { |
1237 | 1053 | delete stream; | 1051 | delete stream; |
1238 | 1052 | // catch-TODO: "throw;" here? | ||
1239 | 1054 | } | 1053 | } |
1240 | 1055 | return docitem; | 1054 | return docitem; |
1241 | 1056 | } | 1055 | } |
1242 | 1057 | 1056 | ||
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 | 1785 | targetType->toSchemaString(), | 1785 | targetType->toSchemaString(), |
1248 | 1786 | msg)); | 1786 | msg)); |
1249 | 1787 | } | 1787 | } |
1250 | 1788 | catch(const OutOfMemoryException&) | ||
1251 | 1789 | { | ||
1252 | 1790 | throw; | ||
1253 | 1791 | } | ||
1254 | 1792 | catch (const ZorbaException&) | ||
1255 | 1793 | { | ||
1256 | 1794 | throw; | ||
1257 | 1795 | } | ||
1258 | 1796 | catch (...) | ||
1259 | 1797 | { | ||
1260 | 1798 | throw; | ||
1261 | 1799 | } | ||
1262 | 1800 | #endif //ZORBA_NO_XMLSCHEMA | 1788 | #endif //ZORBA_NO_XMLSCHEMA |
1263 | 1801 | 1789 | ||
1264 | 1802 | // find the non user defined base type | 1790 | // find the non user defined base type |
1265 | @@ -2093,15 +2081,9 @@ | |||
1266 | 2093 | BinMemOutputStream binmemoutputstream; | 2081 | BinMemOutputStream binmemoutputstream; |
1267 | 2094 | zstring binstr; | 2082 | zstring binstr; |
1268 | 2095 | 2083 | ||
1278 | 2096 | try | 2084 | theGrammarPool->serializeGrammars(&binmemoutputstream); |
1279 | 2097 | { | 2085 | binstr.assign((char*)binmemoutputstream.getRawBuffer(), |
1280 | 2098 | theGrammarPool->serializeGrammars(&binmemoutputstream); | 2086 | static_cast<zstring::size_type>(binmemoutputstream.getSize()) ); |
1272 | 2099 | binstr.assign((char*)binmemoutputstream.getRawBuffer(), | ||
1273 | 2100 | static_cast<zstring::size_type>(binmemoutputstream.getSize()) ); | ||
1274 | 2101 | } | ||
1275 | 2102 | catch (...) | ||
1276 | 2103 | { | ||
1277 | 2104 | } | ||
1281 | 2105 | 2087 | ||
1282 | 2106 | ar & binstr; | 2088 | ar & binstr; |
1283 | 2107 | } | 2089 | } |
Validation queue starting for merge proposal. zorbatest. lambda. nu:8080/ remotequeue/ bug-1103819- 2013-02- 09T08-51- 07.388Z/ log.html
Log at: http://