NullPointerException in Implementation of Validator

39 views
Skip to first unread message

Alex Chevrier

unread,
Feb 24, 2016, 7:00:53 AM2/24/16
to Couchbase Mobile
HI,

I've been trying to implement a Validator that has for sole purpose to log information about the revision that gets
validated. One of the information that I need is the list of key that changed :
List<String> keys = validationContext.getChangedKeys();

And when I called this at line 3 of getChangedKeys() (ValidationContextImpl.java) :
Map<String, Object> cur = getCurrentRevision().getProperties();

Alex Chevrier

unread,
Feb 24, 2016, 7:03:01 AM2/24/16
to Couchbase Mobile
getCurrentRevision() is null and getProperties then cause a NullPointerException.

Then I loose all the information that I what supposed to log after.

Is there anything I can do to obtain those informations without causing a NullPointerException ?

Regards,


Alex Chevrier

Jens Alfke

unread,
Feb 24, 2016, 1:06:35 PM2/24/16
to mobile-c...@googlegroups.com
That sounds like a bug in the implementation. Please file a bug report on Github.

getChangedKeys is just a convenience; you can look at the old and new revision maps passed to the validation function and see which keys changed.

—Jens

Reply all
Reply to author
Forward
0 new messages