Proposal: Address potential null return in getRevisionById for general entities#34
Proposal: Address potential null return in getRevisionById for general entities#34yousung1020 wants to merge 1 commit intoopenmrs:mainfrom
Conversation
|
Thanks for the PR, have you got chance to read this : https://openmrs.atlassian.net/wiki/spaces/docs/pages/25477199/Pull+Request+Tips |
|
Thank you for sharing the Pull Request Tips, and I apologize for missing the guidelines initially. |
|
Hi @yousung1020, I think for now you just close the PR, when you get the permission then you can again open the PR. |
|
Thank you for advice! |
Description of what I changed
While working on unit tests for AUDIT-14, I noticed a behavior in AuditServiceImpl.getRevisionById() that I would like to discuss.
It appears that UtilClass.getEntityIdAsString() converts all entity IDs to String. However, getRevisionById() currently only processes String IDs for Role and GlobalProperty classes, returning null for other general entities (like Patient or Encounter).
In my local testing, this caused the audit log details (Diffs) to be empty(null) for these general entities because the "Old Value" could not be retrieved from the database.
Issue I worked on
see https://openmrs.atlassian.net/browse/AUDIT-14
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