banana-j / bananaj

Java API wrapper for MailChimp API 3.0
MIT License
38 stars 33 forks source link

Null check is required for Member Subscription Status in case of conversion to JSON. #47

Closed ydrozhdzhal closed 4 years ago

ydrozhdzhal commented 4 years ago

https://github.com/banana-j/bananaj/blob/21ac5d5528abb763b1c3483a303fdf9128308181/src/main/java/com/github/alexanderwe/bananaj/model/list/member/Member.java#L728

As I understood from API docs this field is not required for new member and can be taken from StatusIfNew field.

gscriver commented 4 years ago

Looks like there could potentially be an issue when MailChimpList#addOrUpdateMember(Member) is called with a partially constructed Member (i.e. no status is provided). When no status is supplied the expected behavior for an existing member is for the status to remain unchanged. StatusIfNew will be used when a new member is created and no status is provided. After a code review it looks like the above mentioned line could throw an unexpected null pointer exception under some circumstances.