slimina / spymemcached

Automatically exported from code.google.com/p/spymemcached
0 stars 0 forks source link

Divide by zero error when MemcachedClient has no nodes #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The java api yacks a "java.lang.ArithmeticException: / by zero" error if
the MemcachedClient is started with no servers.

The MemcachedClient constructor should fail-fast if the List or Array of
InetSocketAddresses is empty.

I realize this is a "well don't do that" type error, but a divide by zero
on our first get/set isn't fun to troubleshoot at first glance :)

Adding the following checks to the Memcached constructor would prevent this
error...
  assert addrs != null  : "InetSocketAddress list cannot be null";
  assert !addrs.isEmpty() : "InetSocketAddress list cannot be empty";

Original issue reported on code.google.com by raykrue...@gmail.com on 25 Mar 2008 at 1:19

GoogleCodeExporter commented 9 years ago
Thanks.  I went through a bunch of constructor stuff on the train this morning. 
 I
think I've gone through every constructor path and validated the input. 
NullPointerException or IllegalArgumentException will be thrown for the above, 
and
there are assertion errors in the cases where your connection factory doesn't 
behave
properly.

I'll roll out a 2.0.1 at some point.

Original comment by dsalli...@gmail.com on 25 Mar 2008 at 6:04