Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null checks on fields #7

Merged
merged 5 commits into from
May 19, 2024
Merged

Null checks on fields #7

merged 5 commits into from
May 19, 2024

Conversation

aarahmanqa
Copy link
Contributor

@aarahmanqa aarahmanqa commented Oct 29, 2023

Whenever we retrieve a value from the json field, we use .toString() which could throw NullPointerException. That field may be allowed to have null but since we have .toString() we would end up with NPE. This PR aims at avoiding such NPE. Its a better alternative to null check.
More info on this approach is here

Note : This PR contains the changes made in #6 too.

@shivam1608
Copy link
Owner

@aarahmanqa can you resolve the merge conflicts for this pull request after that i'll test the code and merge accordingly.

@shivam1608 shivam1608 added the enhancement New feature or request label Oct 30, 2023
@aarahmanqa
Copy link
Contributor Author

@shivam1608 , sorry for delay. I have resolved conflicts. Kindly review it.

@shivam1608
Copy link
Owner

@aarahmanqa np for delays , currently i don't have my pc with me, i'm using my mobile. i'll soon check the commits when i reach home.

@aarahmanqa
Copy link
Contributor Author

@shivam1608 , could you please review the PR and get it merged?

Copy link
Owner

@shivam1608 shivam1608 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Completed.
Thanks to @NotTheRambo

@shivam1608 shivam1608 merged commit bf22b1c into shivam1608:main May 19, 2024
shivam1608 added a commit that referenced this pull request Jun 14, 2024
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* ignore eclipse project file

* bugfix in example(generating random domain)

Domains.getRandomDomain() returns an Domain object.
It does not override toString(), so
"thisismychoice@"+Domains.getRandomDomain() will be like
thisismychoice@me.shivzee.util.Domain@7fb4f2a9
This cause following Exception :
javax.security.auth.login.LoginException: Something went wrong while
creating account! Try Againjavax.security.auth.login.LoginException:
Account Already Exists! Error 422
	at me.shivzee.util.JMailBuilder.createAndLogin(JMailBuilder.java:94)

To fix this, I called getDomainName() to get real domain name, and it
worked fine. :)

* add .gitignore for eclipse

Sorry, since I'm in army, all  I can use in here is just Eclipse
Portable XD

* FunctionalInterface annotation because a lambda can be WorkCallback

* add Synchronous methods

* name Threads

* change version number

* fixed pr3

Added Reusability of Code & Updated Java Docs

* Updated Version

* Update README.md

* Added EventListener

* Fix:Patch Request

* Added Checks

* Added: EventListener

* Fix: Naming Convention

* Removed Old Docs

* Added EventListener

* Update: Docs

* Update: EventListener

* Update: Java Docs

* Update: Version

* Add: JMailTM.jar

* Update README.md

* Added: onAccountUpdate Event

* Update: Bind to Logger

* Fixed: Documentation

* Updated: Documentation

* Updated: Version

* Updated: Version

* 1. Added status code 429 Exception
2. Added created/updated time in ZonedDateTime format

* Updated as per comment

* Updated: Version

* Added: Examples Directory

* Added: Login with Token

* Updated: JavaDocs

* Update README.md

* Added if condition for hasAttachments (#6)

* Added if condition for hasAttachments

* As per review comments, modified the if block to minimal

---------

Co-authored-by: aarahman <aarahman@tekion.com>

* Null checks on fields (#7)

* Added if condition for hasAttachments

* Added safeEval() so that if any field is null calling toString will not cause issue

* Changed the primitive data type to Wrapper type in POJO classes

---------

Co-authored-by: aarahman <aarahman@tekion.com>

* Update readme tags

---------

Co-authored-by: awidesky <awidesky@naver.com>
Co-authored-by: VigneshwaranT <vigneshwarant@tekion.com>
Co-authored-by: Ahamed Abdul Rahman <ahamedabdulrahman@gmail.com>
Co-authored-by: aarahman <aarahman@tekion.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants