{"action":"created","issue":{"url":"https://api.github.com/repos/mCodex/react-native-sensitive-info/issues/74","repository_url":"https://api.github.com/repos/mCodex/react-native-sensitive-info","labels_url":"https://api.github.com/repos/mCodex/react-native-sensitive-info/issues/74/labels{/name}","comments_url":"https://api.github.com/repos/mCodex/react-native-sensitive-info/issues/74/comments","events_url":"https://api.github.com/repos/mCodex/react-native-sensitive-info/issues/74/events","html_url":"https://github.com/mCodex/react-native-sensitive-info/pull/74","id":318388253,"number":74,"title":"Fixing the \"java.lang.NullPointerException\" at RNSensitiveInfo module","user":{"login":"igorrfc","id":7783787,"avatar_url":"https://avatars1.githubusercontent.com/u/7783787?v=4","gravatar_id":"","url":"https://api.github.com/users/igorrfc","html_url":"https://github.com/igorrfc","followers_url":"https://api.github.com/users/igorrfc/followers","following_url":"https://api.github.com/users/igorrfc/following{/other_user}","gists_url":"https://api.github.com/users/igorrfc/gists{/gist_id}","starred_url":"https://api.github.com/users/igorrfc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorrfc/subscriptions","organizations_url":"https://api.github.com/users/igorrfc/orgs","repos_url":"https://api.github.com/users/igorrfc/repos","events_url":"https://api.github.com/users/igorrfc/events{/privacy}","received_events_url":"https://api.github.com/users/igorrfc/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-27T12:18:15Z","updated_at":"2018-05-23T23:00:21Z","closed_at":"2018-05-23T22:59:08Z","author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/mCodex/react-native-sensitive-info/pulls/74","html_url":"https://github.com/mCodex/react-native-sensitive-info/pull/74","diff_url":"https://github.com/mCodex/react-native-sensitive-info/pull/74.diff","patch_url":"https://github.com/mCodex/react-native-sensitive-info/pull/74.patch"},"body":"# Context\r\n\r\nA weird error (describe at #73) was being raised at [RNSensitiveInfoModule](https://github.com/mCodex/react-native-sensitive-info/blob/keystore/android/src/main/java/br/com/classapp/RNSensitiveInfo/RNSensitiveInfoModule.java).   After some investigation, me and @luisfmsouza have discovered that the root cause was a problem at the error handling on the `catch` block of the [getAllItems](https://github.com/mCodex/react-native-sensitive-info/blob/keystore/android/src/main/java/br/com/classapp/RNSensitiveInfo/RNSensitiveInfoModule.java#L125) function. This was happening because some exceptions caused at decrypt function doesn't have an explicit cause and because of that, the getCause() at the getAllItems' catch was returning null and trying to call the getMessage(). Which is not possible, of course.\r\n\r\n\r\n# Changes:\r\n\r\n  - changed the getAllItems method error handling to log the error stack trace instead of the `getCause().getMessage()` chain. This was needed because some exceptions caused at decrypt function doesn't have an explicit cause and because of that, the getCause() at the getAllItems' catch was returning null and trying to call the getMessage(). Which is not possible, of course.\r\n  - added a new argument validation at decrypt method, checking if the encrypted attribute is null;\r\n\r\nCloses #73 "},"comment":{"url":"https://api.github.com/repos/mCodex/react-native-sensitive-info/issues/comments/391527010","html_url":"https://github.com/mCodex/react-native-sensitive-info/pull/74#issuecomment-391527010","issue_url":"https://api.github.com/repos/mCodex/react-native-sensitive-info/issues/74","id":391527010,"user":{"login":"mCodex","id":5920613,"avatar_url":"https://avatars2.githubusercontent.com/u/5920613?v=4","gravatar_id":"","url":"https://api.github.com/users/mCodex","html_url":"https://github.com/mCodex","followers_url":"https://api.github.com/users/mCodex/followers","following_url":"https://api.github.com/users/mCodex/following{/other_user}","gists_url":"https://api.github.com/users/mCodex/gists{/gist_id}","starred_url":"https://api.github.com/users/mCodex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mCodex/subscriptions","organizations_url":"https://api.github.com/users/mCodex/orgs","repos_url":"https://api.github.com/users/mCodex/repos","events_url":"https://api.github.com/users/mCodex/events{/privacy}","received_events_url":"https://api.github.com/users/mCodex/received_events","type":"User","site_admin":false},"created_at":"2018-05-23T23:00:21Z","updated_at":"2018-05-23T23:00:21Z","author_association":"OWNER","body":"Hey man! Thanks!"}}
{"actor":{"display_login":"mCodex"}}