mlaccetti/MailJimp — Issue #11: Inconsistent handling null arguments of getListMembers()
Author: jeromyevans
Created: 2011-12-05 07:50:18+00:00
State: open

The API is a little inconsistent handling null arguments.

An invocation of `getListMembers(listId, MemberStatus.SUBSCRIBED, null, null, null)` will work correctly and list a batch of subscribed members using MailChimp's default batch size (currently 100) and any since date.

An invocation of `getListMembers(listId, MemberStatus.SUBSCRIBED, aDate, 0, 100)` will work correctly and list a batch of subscribed members on page 0, batch size 100 and a since date as specified.

However an invocation of `getListMembers(listId, MemberStatus.SUBSCRIBED, null, 0, 100)` will fail. MailJimp ignores the first null argument and attempts to assign the next argument (0) as the since argument and assigns 100 as the offset.

In this case it will likely return no data. However if offset is 10 for example, an XmlRpcException occurs because assigning 10 to the since date is not valid (eg. `org.apache.xmlrpc.XmlRpcException: Invalid Date Time (re): "10"`)

The cause is the way MailJimp populates the array of arguments for the invocation (quote below at (1) and (2)) . If since or start are null they are skipped and the index of the subsequent arguments become incorrect. A solution is to provide default values for since and start if the arguments are null, or leave them null if permitted by the invocation.

```java
public Map getListMembers(String listId, MemberStatus memberStatus, Date since, Integer start, Integer limit) throws MailJimpException {
List