Input parameter checking in Java API

Greg Whalin gwhalin at
Sat May 14 13:14:14 PDT 2005

True, which is partly why I did not do checking on the values passed in, 
but now that I think about it more, seems I should handle the situation 
a bit more gracefully.  Just log an error and bail earlier.  I will 
update source before next release of the client.

Evan Martin wrote:
> 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> 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 ~~ :)

More information about the memcached mailing list