cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasongin <>
Subject [GitHub] cordova-plugin-contacts pull request: CB-8115 Save contact birthda...
Date Thu, 03 Dec 2015 19:30:25 GMT
Github user jasongin commented on a diff in the pull request:
    --- Diff: src/android/ ---
    @@ -1854,6 +1859,39 @@ public boolean remove(String id) {
             return (result > 0) ? true : false;
    +    /**
    +     * Gets birthday date from contact JSON object
    +     * @param contact an object to get birthday from
    +     * @return birthday or null, if the field isn't present or
    +     *   is malformed in the contact
    +     */
    +    private Date getBirthday(JSONObject contact) {
    +        try {
    +            Long timestamp = contact.getLong("birthday");
    +            return new Date(timestamp);
    +        } catch (JSONException e) {
    +            Log.d(LOG_TAG, "Could not get birthday: " + e.getMessage());
    --- End diff --
    As a general good practice, instead of appending the exception message to the error string,
pass the exception object to the log method overload that takes a throwable as the third parameter.
The exception message and stack trace will then be printed to logcat.
    Also, it would be more appropriate to use Log.e() instead of Log.d() for this kind of
unexpected error.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message