Improve Exception choiche for Client class in Java OCA.
|Assignee:||Carlos Martín||% Done:|
|Category:||Client API & Library|
|Target version:||Release 3.0|
Peeking in the code, I discovered that the Client class throws it when
it does not find two mandatory resources, the $ONE_AUTH file and the
In my (not so) humble opinion, the use of the raw Exception is not
meaningful enought, the use of a OneSetupException would have add NO
testing or correctness complication and could be more useful for the
Furthermore, I think these are Errors, not Exceptions since you have
no way to recover from one with a try/catch, you have to stop the VM,
correct the setup and restart.
I attach a modified version that uses an Error subclass named OpenNebulaConfigurationError. A long name, but nobody else should write it :).
BTW, putting in the Error I discovered that IOExceptions caused by an unreadable ONE_AUTH where not handled and slipped up as normal Exceptions.
If the OpenNebula team wants, may change the superclass and the name of OpenNebulaConfigurationError, but I would like to know it soon since I am working on some OVF aware OCCI interface for the Venus-C project. Thank you,
#1 Updated by Gian Uberto Lauri almost 9 years ago
- File OpenNebulaConfigurationError.java added
I realized that Error does not extend Exception but Throwable. I switched to RuntimeException because you should not write a catch block for OpenNebulaConfigurationError (it is an Error in disguise), but it does not break legacy code. Both versions are interchangeable.