- Notifications
You must be signed in to change notification settings - Fork1.4k
Fix NullPointerException in VersionHistoryService.getVersion() method#11677
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
saschaszott commentedDec 15, 2025
@Paurikova2 , the change looks good. However, there are additional calls to A more general question: is a |
Paurikova2 commentedDec 16, 2025
@saschaszott Hi, I’ll identify the relevant places, analyze them, and then we can discuss. |
Paurikova2 commentedDec 17, 2025
@saschaszott I reviewed the additional calls. From the current implementation, it appears that a After the recent changes, I think we should also throw an exception in the following place In addition, I believe there is a bug in the following place: the return value of |
Uh oh!
There was an error while loading.Please reload this page.
Description
Fixes#11670
Fixed a bug where getVersion() threw a NullPointerException when called for an item without a version. The method now safely checks for null before accessing version history and returns null instead of throwing an error. Added a unit test to cover this case and prevent future regressions.
Instructions for Reviewers
Verify null check in VersionHistoryServiceImpl.getVersion() prevents NPE
Confirm method returns null gracefully for items without versions
Check new test testGetVersionWithNullPointerException() covers the bug scenario
Run new unit test (should pass)
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).pom.xml), I've made sure their licenses align with theDSpace BSD License based on theLicensing of Contributions documentation.