Bug #572

Improve Exception choiche for Client class in Java OCA.

Added by Gian Uberto Lauri about 10 years ago. Updated almost 10 years ago.

Status:ClosedStart date:04/11/2011
Priority:NormalDue date:
Assignee:Carlos Martín% Done:


Category:Client API & Library
Target version:Release 3.0
Resolution:fixed Pull request:
Affected Versions:


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
SHA-1 algorithm.

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,

Client.java Magnifier - Modified Client.java file (6.77 KB) Gian Uberto Lauri, 04/11/2011 05:16 PM

OpenNebulaConfigurationError.java Magnifier - The new Error subclass. (1.52 KB) Gian Uberto Lauri, 04/11/2011 05:16 PM

OpenNebulaConfigurationError.java Magnifier - This version does not break legacy code. (1.62 KB) Gian Uberto Lauri, 04/11/2011 05:27 PM

Associated revisions

Revision b8491fb5
Added by Carlos Martín about 10 years ago

Bug #572: Java OCA, better choice of Exceptions. Thanks to Gian Uberto Lauri <>

Revision dda3ceaa
Added by Abel Coronado over 3 years ago

F #5539: Host capacity take into account Cluster overcommitment (#572)


#1 Updated by Gian Uberto Lauri about 10 years ago

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.

#2 Updated by Ruben S. Montero about 10 years ago

  • Target version changed from Release 2.2 to Release 3.0

This is initially scheduled for 2.4

#3 Updated by Carlos Martín almost 10 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

Also available in: Atom PDF