LS,
in PrivateIpDaoImpl a null pointer is returned when no db object can be found:
@Override
public PrivateIpVO allocateIpAddress(long dcId, long networkId,
String requestedIp) {
...
PrivateIpVO vo = lockOneRandomRow(sc, true);
if (vo == null) {
txn.rollback()
There is no good answer IMHO. The designer of the API chose this design.
Throwing a checked exception or returning Null is equivalent.
Throwing a runtime exception is probably wrong since there may be some
recovery possible.
We could annotate the method with @Nullable so that the compiler/IDE can
Chiradeep,
I think you mean throwing a runtime exception or returning null is
equivalent. A checked exception would enforce handling of the empty
return.
I think @Nullable is a good idea. In this case or in cases where there
is queried for lists I would think an empty list is the best thing to
do.