Github user jasongin commented on a diff in the pull request:

    
https://github.com/apache/cordova-plugin-contacts/pull/95#discussion_r46598691
  
    --- Diff: src/android/ContactAccessorSdk5.java ---
    @@ -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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org

Reply via email to