LS, As a spin off from a discussion in a PR where it is no longer relevant I made another PR to show the principle of the use of Optionals[1] <https://github.com/apache/cloudstack/pull/1060>
Miguel from Schuberg Philis has been proposing this as replacement of the bad practice of returning null in methods and I agree. In seldom cases it might be more expedient to throw an exception, most notably when a null is returned but no check against is done in the calling method. In those cases throwing a CloudRuntimeException would be an easier way to go then the pattern in this PR. This is a runtime exception however so maybe creating an explicit one is more appropriate in those places. Anyway I want to propose to move to using the pattern from the PR from now on. [1] https://github.com/apache/cloudstack/pull/1060 thoughts? -- Daan