Input parameter checking in Java API

Evan Martin evan.martin at gmail.com
Sat May 14 11:14:56 PDT 2005


I think the point of a nullpointerexception is to tell you that you've
done something wrong.  Passing null to these functions makes no sense.

On 5/14/05, Michael Su <shuoshuo at gmail.com> wrote:
> Hi all,
> 
> I found that the following methods may need some NULL checks to avoid
> java.lang.NullPointerException ...
> 
> * public Object get(String key, Integer hashCode)
>    - check if (key == NULL)
> * private boolean set(String cmdname, String key, Object value, Date
> expiry, Integer hashCode, boolean asString)
>    - check if (key == NULL || value == NULL)
> * public boolean delete(String key, Integer hashCode, Date expiry)
>    - check if (key == NULL)
> * private long incrdecr(String cmdname, String key, long inc, Integer hashCode)
>    - check if (key == NULL)
> 
> Please correct me if I'm wrong ~~ :)
> 
> BR
> Shuo
>


More information about the memcached mailing list