cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daan Hoogland <>
Subject [DISCUSS][PROPOSE] use of optional instead of null
Date Tue, 17 Nov 2015 16:16:03 GMT

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]

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



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message