cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Hitchins" <a...@alexhitchins.com>
Subject RE: Review Request 19616: Added check for null return.
Date Fri, 11 Apr 2014 18:47:07 GMT
OK, so that should be 

       if(snapshotInfoReturn==null){
         throw new ResourceAllocationException("Take snapshot for VolumeId:
"
 + volumeId + " failed.", ResourceType.snapshot);
       }

So I get null - I should raise an exception.

Alex Hitchins | 07788 423 969 | 01892 523 587
---------------------------------------------

-----Original Message-----
From: Daan Hoogland [mailto:daan.hoogland@gmail.com] 
Sent: 11 April 2014 18:33
To: dev
Cc: Alex Hitchins; Edison Su; Laszlo Hornyak
Subject: Re: Review Request 19616: Added check for null return.

On Fri, Apr 11, 2014 at 9:50 AM, Alex Hitchins <alex@alexhitchins.com>
wrote:
>
>       if(snapshotInfoReturn.equals(null)){
>         throw new ResourceAllocationException("Take snapshot for VolumeId:
"
> + volumeId + " failed.", ResourceType.snapshot);
>       }


This will never throw a ResourceAllocationException. It will throw a
NullPointerException or pass, as you call a method on an Object to see if it
is null (no object).

--
Daan


Mime
View raw message