Use of "catch (...)" swallows exceptions
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zorba |
New
|
Medium
|
Ghislain Fourny |
Bug Description
In store.cpp for the loadDocument() function, a "catch (...)" is used without rethrowing the exception via "throw;" The problem is that the "catch (...)" swallows all other exceptions silently. This causes very hard-to-find bugs (as I recently had the misfortune of debugging).
The rule should be that if you ever write "catch (...)," the end of the catch block should ALWAYS rethrow the exception via "throw;". The catch block in this way only does some clean-up but makes no attempt to swallow the exception.
Note that I have already cleaned up several other uses of "catch (...)" in the code (see bug #1103819). This bug is a related bug in that it's about the (mis)use of "catch (...)" but specifically a case I don't feel comfortable fixing myself. There is already a branch for all "catch (...)" fixes -- please use the bug-1103819 branch.
Related branches
- Chris Hillery: Needs Information
- Paul J. Lucas: Approve
-
Diff: 1283 lines (+397/-393)16 files modifiedsrc/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)
Changed in zorba: | |
assignee: | ghislain_cote (ghislain) → nobody |
assignee: | nobody → Ghislain Fourny (gislenius) |
Changed in zorba: | |
milestone: | 2.9 → none |