TRUNK-000: Add null safety check in MySQLBooleanType#6005
TRUNK-000: Add null safety check in MySQLBooleanType#6005Kanishka680 wants to merge 1 commit intoopenmrs:masterfrom
Conversation
Added a null guard in toDatabaseDataType to prevent potential NullPointerExceptions when the database object is null. This ensures safer delegation to the super class.
|
|
This look small but slightly useful one to be defensive against NPE but it would be better where you could add before and after scenario via the test cases which will prove and demonstrate this change . And please raise the ticket for traceability before the PR. |
|
|
||
| @Override | ||
| public DatabaseDataType toDatabaseDataType(Database database) { | ||
| if (database == null) { |
There was a problem hiding this comment.
Implementing null safety guards in the database layer is a fundamental best practice for preventing unpredictable NullPointerExceptions. The logic here is concise and matches the core module's patterns.
ashuverma25
left a comment
There was a problem hiding this comment.
Overall, these null safety guards are a great addition to the persistence layer. The implementation is clean and follows our standard architectural patterns.
|
The null safety check looks appropriate here. One suggestion: it might be worth adding a brief inline comment explaining why the null check is necessary in this specific context, to make the intent clearer for future contributors reading the code. |
fierce-adventurer
left a comment
There was a problem hiding this comment.
You PR format is invalid you need to create a ticket on jira before dropping a PR secondly you have not checked out any test cases third you should tell in your pr what your issue was and what the code does , also for every method you write you need to write junit tests to check if anything is broken due to your code.
RTFM before dropping the PR.
Nis200111
left a comment
There was a problem hiding this comment.
The null safety check added to toDatabaseDataType in MySQLBooleanType is a great practice. It prevents potential NullPointerExceptions during database operations. Code looks solid.
Nis200111
left a comment
There was a problem hiding this comment.
Good null safety check in MySQLBooleanType. It prevents potential NullPointerExceptions. LGTM!



Added a null guard in toDatabaseDataType to prevent potential NullPointerExceptions when the database object is null. This ensures safer delegation to the super class.
Description of what I changed
Issue I worked on
see https://issues.openmrs.org/browse/TRUNK-
Checklist: I completed these to help reviewers :)
My IDE is configured to follow the code style of this project.
No? Unsure? -> configure your IDE, format the code and add the changes with
git add . && git commit --amendI have added tests to cover my changes. (If you refactored
existing code that was well tested you do not have to add tests)
No? -> write tests and add them to this commit
git add . && git commit --amendI ran
mvn clean packageright before creating this pull request andadded all formatting changes to my commit.
No? -> execute above command
All new and existing tests passed.
No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.
My pull request is based on the latest changes of the master branch.
No? Unsure? -> execute command
git pull --rebase upstream master