Dear XWiki devs
I recently wanted to refactor the usage of XWikiContext and XWikiDocument
in my code with DocumentAccessBridge and DocumentModelBridge.
I however was suprised that many methods in DocumentAccessBridge throw
java.lang.Exception. This is generally considered bad practice since it
forces all clients to catch java.lang.Exception and therefore also
unchecked Exceptions - from which the client potentially can't or shouldn't
recover.
For in depth arguments see e.g. Joshua Bloch's "Effective Java" where he
states to "use checked exceptions for recoverable conditions and runtime
exceptions for programming errors", "throw exceptions appropriate to the
abstraction" and "always declare checked exceptions individually".
Can somebody explain to me the reasoning behind throwing
java.lang.Exception in this interface? Are there any plans to deprecate and
replace it by an interface without this caveat?
Thanks
Marc
synventis GmbH