-
Notifications
You must be signed in to change notification settings - Fork 2
UFAL/Clarinuserregistration nullpoint exception #941
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
UFAL/Clarinuserregistration nullpoint exception #941
Conversation
WalkthroughA null check for the Changes
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/CLRUAUserMetadataLinkRepository.java (2)
57-58: Minor typo in error message.There's a typo in the error message: "for if: " should be "for id: " to match the error message pattern used in other similar locations.
- throw new ResourceNotFoundException("The ClarinLicenseResourceUserAllowance for if: " + clruaID + + throw new ResourceNotFoundException("The ClarinLicenseResourceUserAllowance for id: " + clruaID + " couldn't be found");
62-65: Minor spacing issue in error message.There's a missing space between "clruaID" and "doesn't" in the error message, which would cause the error message to display without proper spacing.
- "with id: " + clruaID + "doesn't exists."); + "with id: " + clruaID + " doesn't exist.");Additionally, grammatically, "doesn't exists" should be "doesn't exist".
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/CLRUAUUserRegistrationLinkRepository.java(2 hunks)dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/CLRUAUserMetadataLinkRepository.java(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: dspace-dependencies / docker-build (linux/amd64, ubuntu-latest, true)
- GitHub Check: Run Integration Tests
- GitHub Check: Run Unit Tests
🔇 Additional comments (6)
dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/CLRUAUUserRegistrationLinkRepository.java (3)
15-15: Import added for exception handling improvement.The import of
org.dspace.app.rest.exception.RESTAuthorizationExceptionhas been added to support the changes in exception handling.
43-44: Method signature updated to reflect exception handling changes.The method signature has been modified to replace
AuthorizeExceptionwithRESTAuthorizationException. This change aligns the method signature with the updated exception handling approach.
47-52: Improved exception handling to prevent null pointer exceptions.The code now properly catches
AuthorizeExceptionthrown by the service layer and converts it to aRESTAuthorizationException. This is a good practice as it:
- Maintains the REST API's exception hierarchy
- Properly encapsulates internal authorization exceptions
- Provides consistent error handling in the REST layer
This change directly addresses the null pointer issue mentioned in the PR objectives.
dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/CLRUAUserMetadataLinkRepository.java (3)
17-17: Import added for exception handling improvement.The import of
org.dspace.app.rest.exception.RESTAuthorizationExceptionhas been added to support the changes in exception handling.
46-47: Method signature updated to reflect exception handling changes.The method signature has been modified to replace
AuthorizeExceptionwithRESTAuthorizationException. This change aligns the method signature with the updated exception handling approach.
49-55: Improved exception handling to prevent null pointer exceptions.The code now properly catches
AuthorizeExceptionthrown by the service layer and converts it to aRESTAuthorizationException. This change:
- Maintains consistent exception handling across the REST layer
- Aligns with the changes made in
CLRUAUUserRegistrationLinkRepository- Directly addresses the null pointer issue mentioned in the PR objectives
This implementation follows best practices for exception handling in a layered architecture by translating service-layer exceptions to appropriate REST-layer exceptions.
* Enhanced file preview feature - Run file preview as authenticated user (#936), Property to allow composing file previews (#935), Do not create temp file during generating preview (#921) * Use the handle url instead of the items url with the UUID (#938) * Items file metadata not correctly updated (#940) * Remove duplicate dependency element with identical content (warnings in build) * Anonymous users should be able to use shortener * Fixed internal server error, when context.commit() was called multiple times in search request * Catch DSpaceBadRequestException rather than BadRequestException * Fixed security issue for downloading file with non anonymous license * Fixed Clarinuserregistration nullpoint exception (#941)
pulling changes from latest (lindat-2025.04.14600125143) dataquest release This contains the following changes: - UFAL/Run file preview as authenticated user (dataquest-dev#936) - Property to allow composing file previews (dataquest-dev#935) - File preview is not loaded properly for big zip file (dataquest-dev#921) - UFAL/Clarinuserregistration nullpoint exception (dataquest-dev#941) - UFAL/Use the handle url instead of the items url with the UUID (dataquest-dev#938) - UFAL/Items file metadata not correctly updated (dataquest-dev#940) - Synchronize ufal and dataquest main branches (dataquest-dev#939)
Problem description
The endpoints: ..server/api/core/clarinlruallowances/330/userMetadata(userRegistration) throw nullpoint exception.
Summary by CodeRabbit